r297627 - [ASTImporter] Import fix of GCCAsmStmts w/ missing symbolic operands
Gabor Horvath via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 13 08:32:24 PDT 2017
Author: xazax
Date: Mon Mar 13 10:32:24 2017
New Revision: 297627
URL: http://llvm.org/viewvc/llvm-project?rev=297627&view=rev
Log:
[ASTImporter] Import fix of GCCAsmStmts w/ missing symbolic operands
Patch by Zoltan Gera!
Differential Revision: https://reviews.llvm.org/D30831
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/test/ASTMerge/asm/Inputs/asm-function.cpp
cfe/trunk/test/ASTMerge/asm/test.cpp
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=297627&r1=297626&r2=297627&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Mar 13 10:32:24 2017
@@ -5218,13 +5218,17 @@ Stmt *ASTNodeImporter::VisitGCCAsmStmt(G
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);
}
Modified: cfe/trunk/test/ASTMerge/asm/Inputs/asm-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/asm/Inputs/asm-function.cpp?rev=297627&r1=297626&r2=297627&view=diff
==============================================================================
--- cfe/trunk/test/ASTMerge/asm/Inputs/asm-function.cpp (original)
+++ cfe/trunk/test/ASTMerge/asm/Inputs/asm-function.cpp Mon Mar 13 10:32:24 2017
@@ -9,3 +9,13 @@ unsigned char asmFunc(unsigned char a, u
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;
+}
Modified: cfe/trunk/test/ASTMerge/asm/test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/asm/test.cpp?rev=297627&r1=297626&r2=297627&view=diff
==============================================================================
--- cfe/trunk/test/ASTMerge/asm/test.cpp (original)
+++ cfe/trunk/test/ASTMerge/asm/test.cpp Mon Mar 13 10:32:24 2017
@@ -4,4 +4,5 @@
void testAsmImport() {
asmFunc(12, 42);
+ asmFunc2(42);
}
More information about the cfe-commits
mailing list