Index: clang/include/clang/Lex/Pragma.h =================================================================== --- clang/include/clang/Lex/Pragma.h +++ clang/include/clang/Lex/Pragma.h @@ -14,6 +14,7 @@ #define LLVM_CLANG_LEX_PRAGMA_H #include "clang/Basic/LLVM.h" +#include "clang/Basic/SourceLocation.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include @@ -65,6 +66,7 @@ StringRef getName() const { return Name; } virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &FirstToken) = 0; /// getIfNamespace - If this is a namespace, return it. This is equivalent to @@ -79,7 +81,7 @@ explicit EmptyPragmaHandler(StringRef Name = StringRef()); void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; /// PragmaNamespace - This PragmaHandler subdivides the namespace of pragmas, @@ -112,7 +114,7 @@ bool IsEmpty() const { return Handlers.empty(); } void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override; + SourceLocation IntroducerLoc, Token &Tok) override; PragmaNamespace *getIfNamespace() override { return this; } }; Index: clang/lib/Frontend/PrintPreprocessedOutput.cpp =================================================================== --- clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -665,7 +665,7 @@ : Prefix(prefix), Callbacks(callbacks), ShouldExpandTokens(RequireTokenExpansion) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &PragmaTok) override { + SourceLocation IntroducerLoc, Token &PragmaTok) override { // Figure out what line we went to and insert the appropriate number of // newline characters. Callbacks->startNewLineIfNeeded(); Index: clang/lib/Lex/Pragma.cpp =================================================================== --- clang/lib/Lex/Pragma.cpp +++ clang/lib/Lex/Pragma.cpp @@ -64,6 +64,7 @@ void EmptyPragmaHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &FirstToken) {} //===----------------------------------------------------------------------===// @@ -99,7 +100,7 @@ void PragmaNamespace::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) { + SourceLocation IntroducerLoc, Token &Tok) { // Read the 'namespace' that the directive is in, e.g. STDC. Do not macro // expand it, the user can have a STDC #define, that should not affect this. PP.LexUnexpandedToken(Tok); @@ -115,7 +116,7 @@ } // Otherwise, pass it down. - Handler->HandlePragma(PP, Introducer, Tok); + Handler->HandlePragma(PP, Introducer, IntroducerLoc, Tok); } //===----------------------------------------------------------------------===// @@ -136,7 +137,7 @@ // Invoke the first level of pragma handlers which reads the namespace id. Token Tok; - PragmaHandlers->HandlePragma(*this, Introducer, Tok); + PragmaHandlers->HandlePragma(*this, Introducer, IntroducerLoc, Tok); // If the pragma handler didn't read the rest of the line, consume it now. if ((CurTokenLexer && CurTokenLexer->isParsingPreprocessorDirective()) @@ -958,7 +959,7 @@ PragmaOnceHandler() : PragmaHandler("once") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &OnceTok) override { + SourceLocation IntroducerLoc, Token &OnceTok) override { PP.CheckEndOfDirective("pragma once"); PP.HandlePragmaOnce(OnceTok); } @@ -970,7 +971,7 @@ PragmaMarkHandler() : PragmaHandler("mark") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &MarkTok) override { + SourceLocation IntroducerLoc, Token &MarkTok) override { PP.HandlePragmaMark(); } }; @@ -980,7 +981,7 @@ PragmaPoisonHandler() : PragmaHandler("poison") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &PoisonTok) override { + SourceLocation IntroducerLoc, Token &PoisonTok) override { PP.HandlePragmaPoison(); } }; @@ -991,7 +992,7 @@ PragmaSystemHeaderHandler() : PragmaHandler("system_header") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &SHToken) override { + SourceLocation IntroducerLoc, Token &SHToken) override { PP.HandlePragmaSystemHeader(SHToken); PP.CheckEndOfDirective("pragma"); } @@ -1001,7 +1002,7 @@ PragmaDependencyHandler() : PragmaHandler("dependency") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &DepToken) override { + SourceLocation IntroducerLoc, Token &DepToken) override { PP.HandlePragmaDependency(DepToken); } }; @@ -1010,7 +1011,7 @@ PragmaDebugHandler() : PragmaHandler("__debug") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &DebugToken) override { + SourceLocation IntroducerLoc, Token &DebugToken) override { Token Tok; PP.LexUnexpandedToken(Tok); if (Tok.isNot(tok::identifier)) { @@ -1149,7 +1150,7 @@ : PragmaHandler("diagnostic"), Namespace(NS) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &DiagToken) override { + SourceLocation IntroducerLoc, Token &DiagToken) override { SourceLocation DiagLoc = DiagToken.getLocation(); Token Tok; PP.LexUnexpandedToken(Tok); @@ -1228,7 +1229,7 @@ struct PragmaHdrstopHandler : public PragmaHandler { PragmaHdrstopHandler() : PragmaHandler("hdrstop") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &DepToken) override { + SourceLocation IntroducerLoc, Token &DepToken) override { PP.HandlePragmaHdrstop(DepToken); } }; @@ -1240,7 +1241,7 @@ PragmaWarningHandler() : PragmaHandler("warning") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { // Parse things like: // warning(push, 1) // warning(pop) @@ -1363,7 +1364,7 @@ PragmaExecCharsetHandler() : PragmaHandler("execution_character_set") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { // Parse things like: // execution_character_set(push, "UTF-8") // execution_character_set(pop) @@ -1425,6 +1426,7 @@ PragmaIncludeAliasHandler() : PragmaHandler("include_alias") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &IncludeAliasTok) override { PP.HandlePragmaIncludeAlias(IncludeAliasTok); } @@ -1468,7 +1470,7 @@ Namespace(Namespace) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { SourceLocation MessageLoc = Tok.getLocation(); PP.Lex(Tok); bool ExpectClosingParen = false; @@ -1524,7 +1526,7 @@ PragmaModuleImportHandler() : PragmaHandler("import") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { SourceLocation ImportLoc = Tok.getLocation(); // Read the module name. @@ -1561,7 +1563,7 @@ PragmaModuleBeginHandler() : PragmaHandler("begin") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { SourceLocation BeginLoc = Tok.getLocation(); // Read the module name. @@ -1622,7 +1624,7 @@ PragmaModuleEndHandler() : PragmaHandler("end") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { SourceLocation Loc = Tok.getLocation(); PP.LexUnexpandedToken(Tok); @@ -1642,7 +1644,7 @@ PragmaModuleBuildHandler() : PragmaHandler("build") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { PP.HandlePragmaModuleBuild(Tok); } }; @@ -1652,7 +1654,7 @@ PragmaModuleLoadHandler() : PragmaHandler("load") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { SourceLocation Loc = Tok.getLocation(); // Read the module name. @@ -1676,6 +1678,7 @@ PragmaPushMacroHandler() : PragmaHandler("push_macro") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &PushMacroTok) override { PP.HandlePragmaPushMacro(PushMacroTok); } @@ -1687,6 +1690,7 @@ PragmaPopMacroHandler() : PragmaHandler("pop_macro") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &PopMacroTok) override { PP.HandlePragmaPopMacro(PopMacroTok); } @@ -1698,7 +1702,7 @@ PragmaARCCFCodeAuditedHandler() : PragmaHandler("arc_cf_code_audited") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &NameTok) override { + SourceLocation IntroducerLoc, Token &NameTok) override { SourceLocation Loc = NameTok.getLocation(); bool IsBegin; @@ -1753,7 +1757,7 @@ PragmaAssumeNonNullHandler() : PragmaHandler("assume_nonnull") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &NameTok) override { + SourceLocation IntroducerLoc, Token &NameTok) override { SourceLocation Loc = NameTok.getLocation(); bool IsBegin; @@ -1822,7 +1826,7 @@ PragmaRegionHandler(const char *pragma) : PragmaHandler(pragma) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &NameTok) override { + SourceLocation IntroducerLoc, Token &NameTok) override { // #pragma region: endregion matches can be verified // __pragma(region): no sense, but ignored by msvc // _Pragma is not valid for MSVC, but there isn't any point Index: clang/lib/Parse/ParsePragma.cpp =================================================================== --- clang/lib/Parse/ParsePragma.cpp +++ clang/lib/Parse/ParsePragma.cpp @@ -27,32 +27,32 @@ struct PragmaAlignHandler : public PragmaHandler { explicit PragmaAlignHandler() : PragmaHandler("align") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaGCCVisibilityHandler : public PragmaHandler { explicit PragmaGCCVisibilityHandler() : PragmaHandler("visibility") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaOptionsHandler : public PragmaHandler { explicit PragmaOptionsHandler() : PragmaHandler("options") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaPackHandler : public PragmaHandler { explicit PragmaPackHandler() : PragmaHandler("pack") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaClangSectionHandler : public PragmaHandler { explicit PragmaClangSectionHandler(Sema &S) : PragmaHandler("section"), Actions(S) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; private: Sema &Actions; }; @@ -60,38 +60,38 @@ struct PragmaMSStructHandler : public PragmaHandler { explicit PragmaMSStructHandler() : PragmaHandler("ms_struct") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaUnusedHandler : public PragmaHandler { PragmaUnusedHandler() : PragmaHandler("unused") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaWeakHandler : public PragmaHandler { explicit PragmaWeakHandler() : PragmaHandler("weak") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaRedefineExtnameHandler : public PragmaHandler { explicit PragmaRedefineExtnameHandler() : PragmaHandler("redefine_extname") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaOpenCLExtensionHandler : public PragmaHandler { PragmaOpenCLExtensionHandler() : PragmaHandler("EXTENSION") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaFPContractHandler : public PragmaHandler { PragmaFPContractHandler() : PragmaHandler("FP_CONTRACT") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; // Pragma STDC implementations. @@ -101,7 +101,7 @@ PragmaSTDC_FENV_ACCESSHandler() : PragmaHandler("FENV_ACCESS") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { tok::OnOffSwitch OOS; if (PP.LexOnOffSwitch(OOS)) return; @@ -126,7 +126,7 @@ PragmaSTDC_CX_LIMITED_RANGEHandler() : PragmaHandler("CX_LIMITED_RANGE") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) override { + SourceLocation IntroducerLoc, Token &Tok) override { tok::OnOffSwitch OOS; PP.LexOnOffSwitch(OOS); } @@ -137,7 +137,7 @@ PragmaSTDC_UnknownHandler() = default; void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &UnknownTok) override { + SourceLocation IntroducerLoc, Token &UnknownTok) override { // C99 6.10.6p2, unknown forms are not allowed. PP.Diag(UnknownTok, diag::ext_stdc_pragma_ignored); } @@ -146,19 +146,19 @@ struct PragmaFPHandler : public PragmaHandler { PragmaFPHandler() : PragmaHandler("fp") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaNoOpenMPHandler : public PragmaHandler { PragmaNoOpenMPHandler() : PragmaHandler("omp") { } void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaOpenMPHandler : public PragmaHandler { PragmaOpenMPHandler() : PragmaHandler("omp") { } void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; /// PragmaCommentHandler - "\#pragma comment ...". @@ -166,7 +166,7 @@ PragmaCommentHandler(Sema &Actions) : PragmaHandler("comment"), Actions(Actions) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; private: Sema &Actions; }; @@ -175,7 +175,7 @@ PragmaDetectMismatchHandler(Sema &Actions) : PragmaHandler("detect_mismatch"), Actions(Actions) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; private: Sema &Actions; }; @@ -183,19 +183,19 @@ struct PragmaMSPointersToMembers : public PragmaHandler { explicit PragmaMSPointersToMembers() : PragmaHandler("pointers_to_members") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaMSVtorDisp : public PragmaHandler { explicit PragmaMSVtorDisp() : PragmaHandler("vtordisp") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaMSPragma : public PragmaHandler { explicit PragmaMSPragma(const char *name) : PragmaHandler(name) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; /// PragmaOptimizeHandler - "\#pragma clang optimize on/off". @@ -203,7 +203,7 @@ PragmaOptimizeHandler(Sema &S) : PragmaHandler("optimize"), Actions(S) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; private: Sema &Actions; }; @@ -211,13 +211,13 @@ struct PragmaLoopHintHandler : public PragmaHandler { PragmaLoopHintHandler() : PragmaHandler("loop") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaUnrollHintHandler : public PragmaHandler { PragmaUnrollHintHandler(const char *name) : PragmaHandler(name) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaMSRuntimeChecksHandler : public EmptyPragmaHandler { @@ -227,20 +227,20 @@ struct PragmaMSIntrinsicHandler : public PragmaHandler { PragmaMSIntrinsicHandler() : PragmaHandler("intrinsic") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaMSOptimizeHandler : public PragmaHandler { PragmaMSOptimizeHandler() : PragmaHandler("optimize") {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; }; struct PragmaForceCUDAHostDeviceHandler : public PragmaHandler { PragmaForceCUDAHostDeviceHandler(Sema &Actions) : PragmaHandler("force_cuda_host_device"), Actions(Actions) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; private: Sema &Actions; @@ -251,7 +251,7 @@ PragmaAttributeHandler(AttributeFactory &AttrFactory) : PragmaHandler("attribute"), AttributesForPragmaAttribute(AttrFactory) {} void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &FirstToken) override; + SourceLocation IntroducerLoc, Token &FirstToken) override; /// A pool of attributes that were parsed in \#pragma clang attribute. ParsedAttributes AttributesForPragmaAttribute; @@ -1573,6 +1573,7 @@ // 'pop' void PragmaGCCVisibilityHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &VisTok) { SourceLocation VisLoc = VisTok.getLocation(); @@ -1633,6 +1634,7 @@ // pack '(' ('push' | 'pop') [',' identifier] [, integer] ')' void PragmaPackHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &PackTok) { SourceLocation PackLoc = PackTok.getLocation(); @@ -1744,6 +1746,7 @@ // #pragma ms_struct off void PragmaMSStructHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &MSStructTok) { PragmaMSStructKind Kind = PMSST_OFF; @@ -1785,7 +1788,9 @@ // #pragma clang section bss="abc" data="" rodata="def" text="" void PragmaClangSectionHandler::HandlePragma(Preprocessor &PP, - PragmaIntroducerKind Introducer, Token &FirstToken) { + PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, + Token &FirstToken) { Token Tok; auto SecKind = Sema::PragmaClangSectionKind::PCSK_Invalid; @@ -1898,12 +1903,14 @@ void PragmaAlignHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &AlignTok) { ParseAlignPragma(PP, AlignTok, /*IsOptions=*/false); } void PragmaOptionsHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &OptionsTok) { ParseAlignPragma(PP, OptionsTok, /*IsOptions=*/true); } @@ -1911,6 +1918,7 @@ // #pragma unused(identifier) void PragmaUnusedHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &UnusedTok) { // FIXME: Should we be expanding macros here? My guess is no. SourceLocation UnusedLoc = UnusedTok.getLocation(); @@ -1992,6 +2000,7 @@ // #pragma weak identifier '=' identifier void PragmaWeakHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &WeakTok) { SourceLocation WeakLoc = WeakTok.getLocation(); @@ -2049,9 +2058,9 @@ } // #pragma redefine_extname identifier identifier -void PragmaRedefineExtnameHandler::HandlePragma(Preprocessor &PP, - PragmaIntroducerKind Introducer, - Token &RedefToken) { +void PragmaRedefineExtnameHandler::HandlePragma( + Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &RedefToken) { SourceLocation RedefLoc = RedefToken.getLocation(); Token Tok; @@ -2092,11 +2101,10 @@ PP.EnterTokenStream(Toks, /*DisableMacroExpansion=*/true); } - -void -PragmaFPContractHandler::HandlePragma(Preprocessor &PP, - PragmaIntroducerKind Introducer, - Token &Tok) { +void PragmaFPContractHandler::HandlePragma(Preprocessor &PP, + PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, + Token &Tok) { tok::OnOffSwitch OOS; if (PP.LexOnOffSwitch(OOS)) return; @@ -2112,10 +2120,9 @@ PP.EnterTokenStream(Toks, /*DisableMacroExpansion=*/true); } -void -PragmaOpenCLExtensionHandler::HandlePragma(Preprocessor &PP, - PragmaIntroducerKind Introducer, - Token &Tok) { +void PragmaOpenCLExtensionHandler::HandlePragma( + Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &Tok) { PP.LexUnexpandedToken(Tok); if (Tok.isNot(tok::identifier)) { PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier) << @@ -2180,10 +2187,10 @@ /// Handle '#pragma omp ...' when OpenMP is disabled. /// -void -PragmaNoOpenMPHandler::HandlePragma(Preprocessor &PP, - PragmaIntroducerKind Introducer, - Token &FirstTok) { +void PragmaNoOpenMPHandler::HandlePragma(Preprocessor &PP, + PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, + Token &FirstTok) { if (!PP.getDiagnostics().isIgnored(diag::warn_pragma_omp_ignored, FirstTok.getLocation())) { PP.Diag(FirstTok, diag::warn_pragma_omp_ignored); @@ -2195,10 +2202,10 @@ /// Handle '#pragma omp ...' when OpenMP is enabled. /// -void -PragmaOpenMPHandler::HandlePragma(Preprocessor &PP, - PragmaIntroducerKind Introducer, - Token &FirstTok) { +void PragmaOpenMPHandler::HandlePragma(Preprocessor &PP, + PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, + Token &FirstTok) { SmallVector Pragma; Token Tok; Tok.startToken(); @@ -2243,6 +2250,7 @@ // #pragma pointers_to_members '(' inheritance-model ')' void PragmaMSPointersToMembers::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &Tok) { SourceLocation PointersToMembersLoc = Tok.getLocation(); PP.Lex(Tok); @@ -2341,7 +2349,7 @@ // #pragma vtordisp '(' ')' void PragmaMSVtorDisp::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) { + SourceLocation IntroducerLoc, Token &Tok) { SourceLocation VtorDispLoc = Tok.getLocation(); PP.Lex(Tok); if (Tok.isNot(tok::l_paren)) { @@ -2428,7 +2436,7 @@ /// an annotation token. void PragmaMSPragma::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) { + SourceLocation IntroducerLoc, Token &Tok) { Token EoF, AnnotTok; EoF.startToken(); EoF.setKind(tok::eof); @@ -2467,6 +2475,7 @@ /// is emitted. See MSDN for more details. void PragmaDetectMismatchHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &Tok) { SourceLocation DetectMismatchLoc = Tok.getLocation(); PP.Lex(Tok); @@ -2523,6 +2532,7 @@ /// concatenation, embedded escape characters etc. See MSDN for more details. void PragmaCommentHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &Tok) { SourceLocation CommentLoc = Tok.getLocation(); PP.Lex(Tok); @@ -2603,8 +2613,9 @@ // #pragma clang optimize off // #pragma clang optimize on void PragmaOptimizeHandler::HandlePragma(Preprocessor &PP, - PragmaIntroducerKind Introducer, - Token &FirstToken) { + PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, + Token &FirstToken) { Token Tok; PP.Lex(Tok); if (Tok.is(tok::eod)) { @@ -2651,7 +2662,7 @@ void PragmaFPHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, - Token &Tok) { + SourceLocation IntroducerLoc, Token &Tok) { // fp Token PragmaName = Tok; SmallVector TokenList; @@ -2852,6 +2863,7 @@ /// loop the number of times indicated by the value. void PragmaLoopHintHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &Tok) { // Incoming token is "loop" from "#pragma clang loop". Token PragmaName = Tok; @@ -2945,6 +2957,7 @@ /// disables unrolling of the loop. void PragmaUnrollHintHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &Tok) { // Incoming token is "unroll" for "#pragma unroll", or "nounroll" for // "#pragma nounroll". @@ -3011,6 +3024,7 @@ /// isn't an intrinsic in clang and suggest to include intrin.h. void PragmaMSIntrinsicHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &Tok) { PP.Lex(Tok); @@ -3050,6 +3064,7 @@ // #pragma optimize("gsty", on|off) void PragmaMSOptimizeHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &Tok) { SourceLocation StartLoc = Tok.getLocation(); PP.Lex(Tok); @@ -3102,7 +3117,8 @@ } void PragmaForceCUDAHostDeviceHandler::HandlePragma( - Preprocessor &PP, PragmaIntroducerKind Introducer, Token &Tok) { + Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &Tok) { Token FirstTok = Tok; PP.Lex(Tok); @@ -3154,6 +3170,7 @@ /// of the pragma. void PragmaAttributeHandler::HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, + SourceLocation IntroducerLoc, Token &FirstToken) { Token Tok; PP.Lex(Tok);