From c9875bfa6ffecc8d8316820e2970cf7354f610d2 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Thu, 10 Dec 2009 22:57:48 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91073 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 5 +++++ test/Sema/return.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index c7a47c98c9..fa0d3cef65 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1253,6 +1253,11 @@ Sema::ControlFlowKind Sema::CheckFallThrough(Stmt *Root) { HasFakeEdge = true; continue; } + if (isa(S)) { + HasFakeEdge = true; + HasLiveReturn = true; + continue; + } bool NoReturnEdge = false; if (CallExpr *C = dyn_cast(S)) { Expr *CEE = C->getCallee()->IgnoreParenCasts(); diff --git a/test/Sema/return.c b/test/Sema/return.c index ad75cf1a0b..2e8120a754 100644 --- a/test/Sema/return.c +++ b/test/Sema/return.c @@ -222,3 +222,7 @@ void test32() { void test33() { if (j) while (1) { } } + +int test34() { + asm("nop"); +}