summaryrefslogtreecommitdiffstats
path: root/clang/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/Parse/ParseStmt.cpp')
-rw-r--r--clang/Parse/ParseStmt.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/clang/Parse/ParseStmt.cpp b/clang/Parse/ParseStmt.cpp
index 7da47e84f2b..4be3f1e40a9 100644
--- a/clang/Parse/ParseStmt.cpp
+++ b/clang/Parse/ParseStmt.cpp
@@ -921,11 +921,22 @@ Parser::StmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
// From the MS website: If used without braces, the __asm keyword means
// that the rest of the line is an assembly-language statement.
SourceManager &SrcMgr = PP.getSourceManager();
- unsigned lineNo = SrcMgr.getLineNumber(Tok.getLocation());
- do {
- ConsumeAnyToken();
- } while ((SrcMgr.getLineNumber(Tok.getLocation()) == lineNo) &&
- Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof));
+ 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));
+ }
}
return false;
}
OpenPOWER on IntegriCloud