]> granicus.if.org Git - clang/commitdiff
Avoid warnings for functions that return a value using MS-style inline
authorMike Stump <mrs@apple.com>
Mon, 4 Jan 2010 23:01:10 +0000 (23:01 +0000)
committerMike Stump <mrs@apple.com>
Mon, 4 Jan 2010 23:01:10 +0000 (23:01 +0000)
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

lib/Sema/SemaDecl.cpp
test/Sema/ms-fuzzy-asm.c

index 30f90400007d6731a5c0f79539b37f81ac6e0160..a15c5fea213a64fb1676bad3ecedf157ff712aa2 100644 (file)
@@ -1345,6 +1345,14 @@ Sema::ControlFlowKind Sema::CheckFallThrough(Stmt *Root) {
       HasFakeEdge = true;
       continue;
     }
+    if (const AsmStmt *AS = dyn_cast<AsmStmt>(S)) {
+      if (AS->isMSAsm()) {
+        HasFakeEdge = true;
+        HasLiveReturn = true;
+        continue;
+      }
+    }
+
     bool NoReturnEdge = false;
     if (CallExpr *C = dyn_cast<CallExpr>(S)) {
       Expr *CEE = C->getCallee()->IgnoreParenCasts();
index 9ace6569348e96f37ba4b3d717cea68c7bd8ef0d..250e3222564d8f6c9f8c57fb596a625d52b73dc8 100644 (file)
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 %s -verify -fms-extensions
-// XFAIL: *
 
 #define M __asm int 0x2c
 #define M2 int