]> granicus.if.org Git - clang/commitdiff
Don't complain about falling off the end of a function with an asm
authorMike Stump <mrs@apple.com>
Thu, 10 Dec 2009 22:57:48 +0000 (22:57 +0000)
committerMike Stump <mrs@apple.com>
Thu, 10 Dec 2009 22:57:48 +0000 (22:57 +0000)
block, if the function is supposed to return a value as we don't know
exactly what the asm code does.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91073 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/Sema/return.c

index c7a47c98c9f01e860d584fc58919b84ba69484f5..fa0d3cef65867a4aa37fd6c056d0d56b0ae75768 100644 (file)
@@ -1253,6 +1253,11 @@ Sema::ControlFlowKind Sema::CheckFallThrough(Stmt *Root) {
       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();
index ad75cf1a0b6d2cce8af7bbc9ba594b922b96f092..2e8120a7542e4f60038382e53d2c0c016de783b7 100644 (file)
@@ -222,3 +222,7 @@ void test32() {
 void test33() {
   if (j) while (1) { }
 }
+
+int test34() {
+  asm("nop");
+}