mirror of https://github.com/microsoft/clang.git
[ASTImporter] Import fix of GCCAsmStmts w/ missing symbolic operands
Patch by Zoltan Gera! Differential Revision: https://reviews.llvm.org/D30831 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297627 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
de06f0b75e
commit
5f2fe71e3a
|
@ -5218,13 +5218,17 @@ Stmt *ASTNodeImporter::VisitGCCAsmStmt(GCCAsmStmt *S) {
|
|||
SmallVector<IdentifierInfo *, 4> Names;
|
||||
for (unsigned I = 0, E = S->getNumOutputs(); I != E; I++) {
|
||||
IdentifierInfo *ToII = Importer.Import(S->getOutputIdentifier(I));
|
||||
if (!ToII)
|
||||
// ToII is nullptr when no symbolic name is given for output operand
|
||||
// see ParseStmtAsm::ParseAsmOperandsOpt
|
||||
if (!ToII && S->getOutputIdentifier(I))
|
||||
return nullptr;
|
||||
Names.push_back(ToII);
|
||||
}
|
||||
for (unsigned I = 0, E = S->getNumInputs(); I != E; I++) {
|
||||
IdentifierInfo *ToII = Importer.Import(S->getInputIdentifier(I));
|
||||
if (!ToII)
|
||||
// ToII is nullptr when no symbolic name is given for input operand
|
||||
// see ParseStmtAsm::ParseAsmOperandsOpt
|
||||
if (!ToII && S->getInputIdentifier(I))
|
||||
return nullptr;
|
||||
Names.push_back(ToII);
|
||||
}
|
||||
|
|
|
@ -9,3 +9,13 @@ unsigned char asmFunc(unsigned char a, unsigned char b) {
|
|||
res = bigres;
|
||||
return res;
|
||||
}
|
||||
|
||||
int asmFunc2(int i) {
|
||||
int res;
|
||||
asm ("mov %1, %0 \t\n"
|
||||
"inc %0 "
|
||||
: "=r" (res)
|
||||
: "r" (i)
|
||||
: "cc");
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -4,4 +4,5 @@
|
|||
|
||||
void testAsmImport() {
|
||||
asmFunc(12, 42);
|
||||
asmFunc2(42);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue