diff options
| author | Gabor Horvath <xazax.hun@gmail.com> | 2017-03-13 15:32:24 +0000 |
|---|---|---|
| committer | Gabor Horvath <xazax.hun@gmail.com> | 2017-03-13 15:32:24 +0000 |
| commit | 27f5ff66cc5a07a535046bc158a6844cb684422e (patch) | |
| tree | a8f0b9b42fb227e6d42101dad03e6c072dea7140 | |
| parent | 083b727da914b6eddcc31e6f56e88741d04d5731 (diff) | |
| download | bcm5719-llvm-27f5ff66cc5a07a535046bc158a6844cb684422e.tar.gz bcm5719-llvm-27f5ff66cc5a07a535046bc158a6844cb684422e.zip | |
[ASTImporter] Import fix of GCCAsmStmts w/ missing symbolic operands
Patch by Zoltan Gera!
Differential Revision: https://reviews.llvm.org/D30831
llvm-svn: 297627
| -rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 8 | ||||
| -rw-r--r-- | clang/test/ASTMerge/asm/Inputs/asm-function.cpp | 10 | ||||
| -rw-r--r-- | clang/test/ASTMerge/asm/test.cpp | 1 |
3 files changed, 17 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 525d82e22d6..2a7768a4249 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -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); } diff --git a/clang/test/ASTMerge/asm/Inputs/asm-function.cpp b/clang/test/ASTMerge/asm/Inputs/asm-function.cpp index 59c4edfbcd2..1b8783354fc 100644 --- a/clang/test/ASTMerge/asm/Inputs/asm-function.cpp +++ b/clang/test/ASTMerge/asm/Inputs/asm-function.cpp @@ -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; +} diff --git a/clang/test/ASTMerge/asm/test.cpp b/clang/test/ASTMerge/asm/test.cpp index 3a0a205720f..8c3bdfe17b7 100644 --- a/clang/test/ASTMerge/asm/test.cpp +++ b/clang/test/ASTMerge/asm/test.cpp @@ -4,4 +4,5 @@ void testAsmImport() { asmFunc(12, 42); + asmFunc2(42); } |

