fix PR6780, properly handling the IR {|} escapes in inline asm strings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100449 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 8347249..9702382 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -249,14 +249,18 @@
     }
 
     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/test/CodeGen/asm.c b/test/CodeGen/asm.c
index bf1c806..ace0db9 100644
--- a/test/CodeGen/asm.c
+++ b/test/CodeGen/asm.c
@@ -135,3 +135,15 @@
 // 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"
+}
+