[cfe-commits] r57721 - /cfe/trunk/lib/CodeGen/CGStmt.cpp

Daniel Dunbar daniel at zuster.org
Fri Oct 17 13:58:01 PDT 2008


Author: ddunbar
Date: Fri Oct 17 15:58:01 2008
New Revision: 57721

URL: http://llvm.org/viewvc/llvm-project?rev=57721&view=rev
Log:
Emit error unsupported when asm string conversion fails instead of
assert.

Modified:
    cfe/trunk/lib/CodeGen/CGStmt.cpp

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=57721&r1=57720&r2=57721&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Fri Oct 17 15:58:01 2008
@@ -624,7 +624,9 @@
 }
 
 static std::string ConvertAsmString(const char *Start, unsigned NumOperands,
-                                    bool IsSimple) {
+                                    bool IsSimple, bool &Failed) {
+  Failed = false;
+
   static unsigned AsmCounter = 0;
   AsmCounter++;
   std::string Result;
@@ -696,7 +698,8 @@
         Result += "${" + llvm::utostr(n) + ':' + EscapedChar + '}';
         Start = End - 1;
       } else {
-        assert(0 && "Unhandled asm escaped character!");
+        Failed = true;
+        return "";
       }
     }
     Start++;
@@ -731,10 +734,17 @@
 }
 
 void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
+  bool Failed;
   std::string AsmString = 
     ConvertAsmString(std::string(S.getAsmString()->getStrData(),
                                  S.getAsmString()->getByteLength()).c_str(),
-                     S.getNumOutputs() + S.getNumInputs(), S.isSimple());
+                     S.getNumOutputs() + S.getNumInputs(), S.isSimple(),
+                     Failed);
+
+  if (Failed) {
+    ErrorUnsupported(&S, "asm string");
+    return;
+  }
   
   std::string Constraints;
   





More information about the cfe-commits mailing list