[cfe-commits] r91073 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/return.c

Mike Stump mrs at apple.com
Thu Dec 10 14:57:48 PST 2009


Author: mrs
Date: Thu Dec 10 16:57:48 2009
New Revision: 91073

URL: http://llvm.org/viewvc/llvm-project?rev=91073&view=rev
Log:
Don't complain about falling off the end of a function with an asm
block, if the function is supposed to return a value as we don't know
exactly what the asm code does.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/Sema/return.c

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=91073&r1=91072&r2=91073&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Dec 10 16:57:48 2009
@@ -1253,6 +1253,11 @@
       HasFakeEdge = true;
       continue;
     }
+    if (isa<AsmStmt>(S)) {
+      HasFakeEdge = true;
+      HasLiveReturn = true;
+      continue;
+    }
     bool NoReturnEdge = false;
     if (CallExpr *C = dyn_cast<CallExpr>(S)) {
       Expr *CEE = C->getCallee()->IgnoreParenCasts();

Modified: cfe/trunk/test/Sema/return.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/return.c?rev=91073&r1=91072&r2=91073&view=diff

==============================================================================
--- cfe/trunk/test/Sema/return.c (original)
+++ cfe/trunk/test/Sema/return.c Thu Dec 10 16:57:48 2009
@@ -222,3 +222,7 @@
 void test33() {
   if (j) while (1) { }
 }
+
+int test34() {
+  asm("nop");
+}





More information about the cfe-commits mailing list