aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-02-08 18:01:27 +0000
committerSteve Naroff <snaroff@apple.com>2008-02-08 18:01:27 +0000
commit362809751711f7dc4ab01653ec7964a2e95f999b (patch)
treee9ef71459e9cfdd65587712dd75e9931b1453e3e
parent675a9ba538da9fec1e0db0c285076fe022f28d75 (diff)
Use getLogicalLineNumber() in FuzzyParseMicrosoftAsmStatement(), it's more general and simplifies the code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46885 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Parse/ParseStmt.cpp22
-rw-r--r--test/Sema/ms-fuzzy-asm.c3
2 files changed, 8 insertions, 17 deletions
diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp
index 4be3f1e40a..f8ae4a0558 100644
--- a/Parse/ParseStmt.cpp
+++ b/Parse/ParseStmt.cpp
@@ -922,21 +922,13 @@ Parser::StmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
// 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;
}
diff --git a/test/Sema/ms-fuzzy-asm.c b/test/Sema/ms-fuzzy-asm.c
index 7c24985b6c..5e387f3808 100644
--- a/test/Sema/ms-fuzzy-asm.c
+++ b/test/Sema/ms-fuzzy-asm.c
@@ -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 }