diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-05 18:44:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-05 18:44:00 +0000 |
commit | da081a8e1f295ffdd670f87dba19f470a9a5acaa (patch) | |
tree | 1c0bfd524703fdd2c519154f8e7509f58e965d16 | |
parent | e30614cfdd8a5b8ceba1b3d56d1aaa1b0845a9ca (diff) | |
download | bcm5719-llvm-da081a8e1f295ffdd670f87dba19f470a9a5acaa.tar.gz bcm5719-llvm-da081a8e1f295ffdd670f87dba19f470a9a5acaa.zip |
fix PR6780, properly handling the IR {|} escapes in inline asm strings.
llvm-svn: 100449
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 14 | ||||
-rw-r--r-- | clang/test/CodeGen/asm.c | 12 |
2 files changed, 21 insertions, 5 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 8347249a466..97023820e24 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -249,14 +249,18 @@ unsigned AsmStmt::AnalyzeAsmString(llvm::SmallVectorImpl<AsmStringPiece>&Pieces, } char CurChar = *CurPtr++; - if (CurChar == '$') { - CurStringPiece += "$$"; - continue; - } else if (CurChar != '%') { + switch (CurChar) { + case '$': CurStringPiece += "$$"; continue; + case '{': CurStringPiece += "$("; continue; + case '|': CurStringPiece += "$|"; continue; + case '}': CurStringPiece += "$)"; continue; + case '%': + break; + default: CurStringPiece += CurChar; continue; } - + // Escaped "%" character in asm string. if (CurPtr == StrEnd) { // % at end of string is invalid (no escape). diff --git a/clang/test/CodeGen/asm.c b/clang/test/CodeGen/asm.c index bf1c806a2c4..ace0db9af6d 100644 --- a/clang/test/CodeGen/asm.c +++ b/clang/test/CodeGen/asm.c @@ -135,3 +135,15 @@ int t18(unsigned data) { // CHECK-NEXT: extractvalue // CHECK-NEXT: extractvalue } + + +// PR6780 +int t19(unsigned data) { + int a, b; + + asm("x{abc|def|ghi}z" :"=r"(a): "r"(data)); + return a + b; + // CHECK: t19(i32 + // CHECK: = call {{.*}}asm "x$(abc$|def$|ghi$)z" +} + |