DefineBuiltinMacro(Buf, "__cdecl=");
DefineBuiltinMacro(Buf, "_cdecl=");
DefineBuiltinMacro(Buf, "__ptr64=");
+ DefineBuiltinMacro(Buf, "__w64=");
DefineBuiltinMacro(Buf, "__forceinline=");
DefineBuiltinMacro(Buf, "__int8=char");
DefineBuiltinMacro(Buf, "__int16=short");
case tok::kw_typedef:
isInvalid = DS.SetStorageClassSpec(DeclSpec::SCS_typedef, Loc, PrevSpec);
break;
- case tok::kw___w64: // ignore Microsoft specifier
- break;
case tok::kw___declspec:
FuzzyParseMicrosoftDeclspec();
// Don't consume the next token, __declspec's can appear one after
#include "clang/Parse/Parser.h"
#include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/SourceManager.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Parse/Scope.h"
using namespace clang;
}
Parser::StmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
- unsigned short savedBraceCount = BraceCount;
- do {
- ConsumeAnyToken();
- } while (BraceCount > savedBraceCount && Tok.isNot(tok::eof));
+ if (Tok.is(tok::l_brace)) {
+ unsigned short savedBraceCount = BraceCount;
+ do {
+ ConsumeAnyToken();
+ } while (BraceCount > savedBraceCount && Tok.isNot(tok::eof));
+ } else {
+ // 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));
+ }
return false;
}
assert(Tok.is(tok::kw_asm) && "Not an asm stmt");
SourceLocation AsmLoc = ConsumeToken();
- if (Tok.is(tok::l_brace)) {
+ if (getLang().Microsoft && Tok.isNot(tok::l_paren)) {
msAsm = true;
return FuzzyParseMicrosoftAsmStatement();
}
// Apple Extension.
KEYWORD(__private_extern__ , EXTC90|EXTC99|NOTCPP)
-// Microsoft Extensions.
-KEYWORD(__w64 , EXTC90|EXTC99|NOTCPP)
+// Microsoft Extension.
KEYWORD(__declspec , EXTC90|EXTC99|NOTCPP)
// Alternate spelling for various tokens. There are GCC extensions in all