From: Mike Stump Date: Mon, 4 Jan 2010 23:01:10 +0000 (+0000) Subject: Avoid warnings for functions that return a value using MS-style inline X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1cd95e210b1b084ee275e0dfa9dd8a7e65b577d7;p=clang Avoid warnings for functions that return a value using MS-style inline assembly code. This avoids changing the bahvior when normal asm("") statements are used. The type of code affected would be: void* t4(void) { __asm mov eax, fs:[0x10] } I hope people like this version, if not, let me know. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92531 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 30f9040000..a15c5fea21 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1345,6 +1345,14 @@ Sema::ControlFlowKind Sema::CheckFallThrough(Stmt *Root) { HasFakeEdge = true; continue; } + if (const AsmStmt *AS = dyn_cast(S)) { + if (AS->isMSAsm()) { + HasFakeEdge = true; + HasLiveReturn = true; + continue; + } + } + bool NoReturnEdge = false; if (CallExpr *C = dyn_cast(S)) { Expr *CEE = C->getCallee()->IgnoreParenCasts(); diff --git a/test/Sema/ms-fuzzy-asm.c b/test/Sema/ms-fuzzy-asm.c index 9ace656934..250e322256 100644 --- a/test/Sema/ms-fuzzy-asm.c +++ b/test/Sema/ms-fuzzy-asm.c @@ -1,5 +1,4 @@ // RUN: %clang_cc1 %s -verify -fms-extensions -// XFAIL: * #define M __asm int 0x2c #define M2 int