[cfe-commits] r46885 - in /cfe/trunk: Parse/ParseStmt.cpp test/Sema/ms-fuzzy-asm.c

Steve Naroff snaroff at apple.com
Fri Feb 8 10:01:28 PST 2008


Author: snaroff
Date: Fri Feb  8 12:01:27 2008
New Revision: 46885

URL: http://llvm.org/viewvc/llvm-project?rev=46885&view=rev
Log:

Use getLogicalLineNumber() in FuzzyParseMicrosoftAsmStatement(), it's more general and simplifies the code.


Modified:
    cfe/trunk/Parse/ParseStmt.cpp
    cfe/trunk/test/Sema/ms-fuzzy-asm.c

Modified: cfe/trunk/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseStmt.cpp?rev=46885&r1=46884&r2=46885&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/Parse/ParseStmt.cpp Fri Feb  8 12:01:27 2008
@@ -922,21 +922,13 @@
     // that the rest of the line is an assembly-language statement.
     SourceManager &SrcMgr = PP.getSourceManager();
     SourceLocation TokLoc = Tok.getLocation();
-    if (TokLoc.isFileID()) {
-      unsigned lineNo = SrcMgr.getLineNumber(TokLoc);
-      do {
-        ConsumeAnyToken();
-        TokLoc = Tok.getLocation();
-      } while (TokLoc.isFileID() && (SrcMgr.getLineNumber(TokLoc) == lineNo) && 
-               Tok.isNot(tok::r_brace) && Tok.isNot(tok::semi) && 
-               Tok.isNot(tok::eof));
-    } else { // The asm tokens come from a macro expansion.
-      do {
-        ConsumeAnyToken();
-        TokLoc = Tok.getLocation();
-      } while (TokLoc.isMacroID() && Tok.isNot(tok::r_brace) && 
-               Tok.isNot(tok::semi) && Tok.isNot(tok::eof));
-    }
+    unsigned lineNo = SrcMgr.getLogicalLineNumber(TokLoc);
+    do {
+      ConsumeAnyToken();
+      TokLoc = Tok.getLocation();
+    } while ((SrcMgr.getLogicalLineNumber(TokLoc) == lineNo) && 
+             Tok.isNot(tok::r_brace) && Tok.isNot(tok::semi) && 
+             Tok.isNot(tok::eof));
   }
   return false;
 }

Modified: cfe/trunk/test/Sema/ms-fuzzy-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ms-fuzzy-asm.c?rev=46885&r1=46884&r2=46885&view=diff

==============================================================================
--- cfe/trunk/test/Sema/ms-fuzzy-asm.c (original)
+++ cfe/trunk/test/Sema/ms-fuzzy-asm.c Fri Feb  8 12:01:27 2008
@@ -5,6 +5,5 @@
 
 void t1(void) { M }
 void t2(void) { __asm int 0x2c }
-// FIXME? We don't support fuzzy parsing line-oriented __asm's where the body is partially defined in a macro.
-void t3(void) { __asm M2 0x2c } // expected-error{{expected ';' after expression}} expected-warning{{expression result unused}}
+void t3(void) { __asm M2 0x2c } 
 





More information about the cfe-commits mailing list