[clang-tools-extra] r356796 - [clang-tidy] Move all checks to the new registerPPCallbacks API
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 22 11:58:12 PDT 2019
Author: alexfh
Date: Fri Mar 22 11:58:12 2019
New Revision: 356796
URL: http://llvm.org/viewvc/llvm-project?rev=356796&view=rev
Log:
[clang-tidy] Move all checks to the new registerPPCallbacks API
Modified:
clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.cpp
clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.h
clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp
clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.h
clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.cpp
clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.h
clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h
clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp
clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.h
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.cpp
clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.h
clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h
clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.h
clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp
clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.h
clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.h
clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.h
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.h
clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.h
clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp
clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h
clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h
clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h
clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
Modified: clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.cpp Fri Mar 22 11:58:12 2019
@@ -114,11 +114,10 @@ void StringFindStartswithCheck::check(co
}
void StringFindStartswithCheck::registerPPCallbacks(
- CompilerInstance &Compiler) {
- IncludeInserter = llvm::make_unique<clang::tidy::utils::IncludeInserter>(
- Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle);
- Compiler.getPreprocessor().addPPCallbacks(
- IncludeInserter->CreatePPCallbacks());
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ IncludeInserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
+ IncludeStyle);
+ PP->addPPCallbacks(IncludeInserter->CreatePPCallbacks());
}
void StringFindStartswithCheck::storeOptions(
Modified: clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.h Fri Mar 22 11:58:12 2019
@@ -28,7 +28,8 @@ class StringFindStartswithCheck : public
public:
using ClangTidyCheck::ClangTidyCheck;
StringFindStartswithCheck(StringRef Name, ClangTidyContext *Context);
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp Fri Mar 22 11:58:12 2019
@@ -64,10 +64,10 @@ void LambdaFunctionNameCheck::registerMa
this);
}
-void LambdaFunctionNameCheck::registerPPCallbacks(CompilerInstance &Compiler) {
- Compiler.getPreprocessor().addPPCallbacks(
- llvm::make_unique<MacroExpansionsWithFileAndLine>(
- &SuppressMacroExpansions));
+void LambdaFunctionNameCheck::registerPPCallbacks(
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ PP->addPPCallbacks(llvm::make_unique<MacroExpansionsWithFileAndLine>(
+ &SuppressMacroExpansions));
}
void LambdaFunctionNameCheck::check(const MatchFinder::MatchResult &Result) {
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/LambdaFunctionNameCheck.h Fri Mar 22 11:58:12 2019
@@ -36,7 +36,8 @@ public:
LambdaFunctionNameCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
private:
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.cpp Fri Mar 22 11:58:12 2019
@@ -248,10 +248,9 @@ void MacroParenthesesPPCallbacks::argume
}
}
-void MacroParenthesesCheck::registerPPCallbacks(CompilerInstance &Compiler) {
- Compiler.getPreprocessor().addPPCallbacks(
- llvm::make_unique<MacroParenthesesPPCallbacks>(
- &Compiler.getPreprocessor(), this));
+void MacroParenthesesCheck::registerPPCallbacks(
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ PP->addPPCallbacks(llvm::make_unique<MacroParenthesesPPCallbacks>(PP, this));
}
} // namespace bugprone
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/MacroParenthesesCheck.h Fri Mar 22 11:58:12 2019
@@ -32,7 +32,8 @@ class MacroParenthesesCheck : public Cla
public:
MacroParenthesesCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
};
} // namespace bugprone
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp Fri Mar 22 11:58:12 2019
@@ -172,10 +172,8 @@ bool MacroRepeatedPPCallbacks::hasSideEf
}
void MacroRepeatedSideEffectsCheck::registerPPCallbacks(
- CompilerInstance &Compiler) {
- Compiler.getPreprocessor().addPPCallbacks(
- ::llvm::make_unique<MacroRepeatedPPCallbacks>(
- *this, Compiler.getPreprocessor()));
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ PP->addPPCallbacks(::llvm::make_unique<MacroRepeatedPPCallbacks>(*this, *PP));
}
} // namespace bugprone
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h Fri Mar 22 11:58:12 2019
@@ -20,7 +20,8 @@ class MacroRepeatedSideEffectsCheck : pu
public:
MacroRepeatedSideEffectsCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
};
} // namespace bugprone
Modified: clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.cpp Fri Mar 22 11:58:12 2019
@@ -41,7 +41,9 @@ public:
};
} // namespace
-void SetLongJmpCheck::registerPPCallbacks(CompilerInstance &Compiler) {
+void SetLongJmpCheck::registerPPCallbacks(const SourceManager &SM,
+ Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) {
// This checker only applies to C++, where exception handling is a superior
// solution to setjmp/longjmp calls.
if (!getLangOpts().CPlusPlus)
@@ -49,8 +51,7 @@ void SetLongJmpCheck::registerPPCallback
// Per [headers]p5, setjmp must be exposed as a macro instead of a function,
// despite the allowance in C for setjmp to also be an extern function.
- Compiler.getPreprocessor().addPPCallbacks(
- llvm::make_unique<SetJmpMacroCallbacks>(*this));
+ PP->addPPCallbacks(llvm::make_unique<SetJmpMacroCallbacks>(*this));
}
void SetLongJmpCheck::registerMatchers(MatchFinder *Finder) {
Modified: clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/SetLongJmpCheck.h Fri Mar 22 11:58:12 2019
@@ -25,7 +25,8 @@ public:
: ClangTidyCheck(Name, Context) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
};
} // namespace cert
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp Fri Mar 22 11:58:12 2019
@@ -67,14 +67,14 @@ void MacroUsageCheck::storeOptions(Clang
Options.store(Opts, "IgnoreCommandLineMacros", IgnoreCommandLineMacros);
}
-void MacroUsageCheck::registerPPCallbacks(CompilerInstance &Compiler) {
+void MacroUsageCheck::registerPPCallbacks(const SourceManager &SM,
+ Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) {
if (!getLangOpts().CPlusPlus11)
return;
- Compiler.getPreprocessor().addPPCallbacks(
- llvm::make_unique<MacroUsageCallbacks>(this, Compiler.getSourceManager(),
- AllowedRegexp, CheckCapsOnly,
- IgnoreCommandLineMacros));
+ PP->addPPCallbacks(llvm::make_unique<MacroUsageCallbacks>(
+ this, SM, AllowedRegexp, CheckCapsOnly, IgnoreCommandLineMacros));
}
void MacroUsageCheck::warnMacro(const MacroDirective *MD, StringRef MacroName) {
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/MacroUsageCheck.h Fri Mar 22 11:58:12 2019
@@ -30,7 +30,8 @@ public:
CheckCapsOnly(Options.get("CheckCapsOnly", 0)),
IgnoreCommandLineMacros(Options.get("IgnoreCommandLineMacros", 1)) {}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void warnMacro(const MacroDirective *MD, StringRef MacroName);
void warnNaming(const MacroDirective *MD, StringRef MacroName);
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp Fri Mar 22 11:58:12 2019
@@ -31,13 +31,13 @@ void ProBoundsConstantArrayIndexCheck::s
}
void ProBoundsConstantArrayIndexCheck::registerPPCallbacks(
- CompilerInstance &Compiler) {
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
if (!getLangOpts().CPlusPlus)
return;
- Inserter.reset(new utils::IncludeInserter(
- Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle));
- Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
+ Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
+ IncludeStyle);
+ PP->addPPCallbacks(Inserter->CreatePPCallbacks());
}
void ProBoundsConstantArrayIndexCheck::registerMatchers(MatchFinder *Finder) {
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h Fri Mar 22 11:58:12 2019
@@ -28,7 +28,8 @@ class ProBoundsConstantArrayIndexCheck :
public:
ProBoundsConstantArrayIndexCheck(StringRef Name, ClangTidyContext *Context);
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Modified: clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.cpp Fri Mar 22 11:58:12 2019
@@ -23,7 +23,7 @@ namespace fuchsia {
class RestrictedIncludesPPCallbacks : public PPCallbacks {
public:
explicit RestrictedIncludesPPCallbacks(RestrictSystemIncludesCheck &Check,
- SourceManager &SM)
+ const SourceManager &SM)
: Check(Check), SM(SM) {}
void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
@@ -53,7 +53,7 @@ private:
llvm::SmallDenseMap<FileID, FileIncludes> IncludeDirectives;
RestrictSystemIncludesCheck &Check;
- SourceManager &SM;
+ const SourceManager &SM;
};
void RestrictedIncludesPPCallbacks::InclusionDirective(
@@ -101,10 +101,9 @@ void RestrictedIncludesPPCallbacks::EndO
}
void RestrictSystemIncludesCheck::registerPPCallbacks(
- CompilerInstance &Compiler) {
- Compiler.getPreprocessor().addPPCallbacks(
- llvm::make_unique<RestrictedIncludesPPCallbacks>(
- *this, Compiler.getSourceManager()));
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ PP->addPPCallbacks(
+ llvm::make_unique<RestrictedIncludesPPCallbacks>(*this, SM));
}
void RestrictSystemIncludesCheck::storeOptions(
Modified: clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/fuchsia/RestrictSystemIncludesCheck.h Fri Mar 22 11:58:12 2019
@@ -29,7 +29,8 @@ public:
AllowedIncludes(Options.get("Includes", "*")),
AllowedIncludesGlobList(AllowedIncludes) {}
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
bool contains(StringRef FileName) {
return AllowedIncludesGlobList.contains(FileName);
Modified: clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.cpp Fri Mar 22 11:58:12 2019
@@ -77,10 +77,9 @@ private:
} // namespace
void AvoidUnderscoreInGoogletestNameCheck::registerPPCallbacks(
- CompilerInstance &Compiler) {
- Compiler.getPreprocessor().addPPCallbacks(
- llvm::make_unique<AvoidUnderscoreInGoogletestNameCallback>(
- &Compiler.getPreprocessor(), this));
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ PP->addPPCallbacks(
+ llvm::make_unique<AvoidUnderscoreInGoogletestNameCallback>(PP, this));
}
} // namespace readability
Modified: clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h Fri Mar 22 11:58:12 2019
@@ -22,7 +22,8 @@ class AvoidUnderscoreInGoogletestNameChe
public:
using ClangTidyCheck::ClangTidyCheck;
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
};
} // namespace readability
Modified: clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.cpp Fri Mar 22 11:58:12 2019
@@ -55,8 +55,10 @@ TodoCommentCheck::TodoCommentCheck(Strin
Handler(llvm::make_unique<TodoCommentHandler>(
*this, Context->getOptions().User)) {}
-void TodoCommentCheck::registerPPCallbacks(CompilerInstance &Compiler) {
- Compiler.getPreprocessor().addCommentHandler(Handler.get());
+void TodoCommentCheck::registerPPCallbacks(const SourceManager &SM,
+ Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) {
+ PP->addCommentHandler(Handler.get());
}
} // namespace readability
Modified: clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.h Fri Mar 22 11:58:12 2019
@@ -22,7 +22,8 @@ namespace readability {
class TodoCommentCheck : public ClangTidyCheck {
public:
TodoCommentCheck(StringRef Name, ClangTidyContext *Context);
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
private:
class TodoCommentHandler;
Modified: clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp Fri Mar 22 11:58:12 2019
@@ -20,7 +20,8 @@ namespace llvm {
namespace {
class IncludeOrderPPCallbacks : public PPCallbacks {
public:
- explicit IncludeOrderPPCallbacks(ClangTidyCheck &Check, SourceManager &SM)
+ explicit IncludeOrderPPCallbacks(ClangTidyCheck &Check,
+ const SourceManager &SM)
: LookForMainModule(true), Check(Check), SM(SM) {}
void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
@@ -45,14 +46,14 @@ private:
bool LookForMainModule;
ClangTidyCheck &Check;
- SourceManager &SM;
+ const SourceManager &SM;
};
} // namespace
-void IncludeOrderCheck::registerPPCallbacks(CompilerInstance &Compiler) {
- Compiler.getPreprocessor().addPPCallbacks(
- ::llvm::make_unique<IncludeOrderPPCallbacks>(
- *this, Compiler.getSourceManager()));
+void IncludeOrderCheck::registerPPCallbacks(const SourceManager &SM,
+ Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) {
+ PP->addPPCallbacks(::llvm::make_unique<IncludeOrderPPCallbacks>(*this, SM));
}
static int getPriority(StringRef Filename, bool IsAngled, bool IsMainModule) {
Modified: clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h Fri Mar 22 11:58:12 2019
@@ -22,7 +22,8 @@ class IncludeOrderCheck : public ClangTi
public:
IncludeOrderCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
};
} // namespace llvm
Modified: clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.cpp Fri Mar 22 11:58:12 2019
@@ -40,11 +40,11 @@ private:
};
} // namespace
-void DeprecatedHeadersCheck::registerPPCallbacks(CompilerInstance &Compiler) {
- if (this->getLangOpts().CPlusPlus) {
- Compiler.getPreprocessor().addPPCallbacks(
- ::llvm::make_unique<IncludeModernizePPCallbacks>(*this,
- this->getLangOpts()));
+void DeprecatedHeadersCheck::registerPPCallbacks(
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ if (getLangOpts().CPlusPlus) {
+ PP->addPPCallbacks(
+ ::llvm::make_unique<IncludeModernizePPCallbacks>(*this, getLangOpts()));
}
}
Modified: clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/DeprecatedHeadersCheck.h Fri Mar 22 11:58:12 2019
@@ -36,7 +36,8 @@ class DeprecatedHeadersCheck : public Cl
public:
DeprecatedHeadersCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
};
} // namespace modernize
Modified: clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp Fri Mar 22 11:58:12 2019
@@ -65,11 +65,13 @@ bool MakeSmartPtrCheck::isLanguageVersio
return LangOpts.CPlusPlus11;
}
-void MakeSmartPtrCheck::registerPPCallbacks(CompilerInstance &Compiler) {
+void MakeSmartPtrCheck::registerPPCallbacks(const SourceManager &SM,
+ Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) {
if (isLanguageVersionSupported(getLangOpts())) {
- Inserter = llvm::make_unique<utils::IncludeInserter>(
- Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle);
- Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
+ Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
+ IncludeStyle);
+ PP->addPPCallbacks(Inserter->CreatePPCallbacks());
}
}
Modified: clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h Fri Mar 22 11:58:12 2019
@@ -26,7 +26,8 @@ public:
MakeSmartPtrCheck(StringRef Name, ClangTidyContext *Context,
StringRef MakeSmartPtrFunctionName);
void registerMatchers(ast_matchers::MatchFinder *Finder) final;
- void registerPPCallbacks(clang::CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) final;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
Modified: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp Fri Mar 22 11:58:12 2019
@@ -164,14 +164,16 @@ void PassByValueCheck::registerMatchers(
this);
}
-void PassByValueCheck::registerPPCallbacks(CompilerInstance &Compiler) {
+void PassByValueCheck::registerPPCallbacks(const SourceManager &SM,
+ Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) {
// Only register the preprocessor callbacks for C++; the functionality
// currently does not provide any benefit to other languages, despite being
// benign.
if (getLangOpts().CPlusPlus) {
- Inserter.reset(new utils::IncludeInserter(
- Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle));
- Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
+ Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
+ IncludeStyle);
+ PP->addPPCallbacks(Inserter->CreatePPCallbacks());
}
}
Modified: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h Fri Mar 22 11:58:12 2019
@@ -22,7 +22,8 @@ class PassByValueCheck : public ClangTid
public:
PassByValueCheck(StringRef Name, ClangTidyContext *Context);
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
- void registerPPCallbacks(clang::CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Modified: clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp Fri Mar 22 11:58:12 2019
@@ -132,15 +132,17 @@ void ReplaceAutoPtrCheck::registerMatche
this);
}
-void ReplaceAutoPtrCheck::registerPPCallbacks(CompilerInstance &Compiler) {
+void ReplaceAutoPtrCheck::registerPPCallbacks(const SourceManager &SM,
+ Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) {
// Only register the preprocessor callbacks for C++; the functionality
// currently does not provide any benefit to other languages, despite being
// benign.
if (!getLangOpts().CPlusPlus)
return;
- Inserter.reset(new utils::IncludeInserter(
- Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle));
- Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
+ Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
+ IncludeStyle);
+ PP->addPPCallbacks(Inserter->CreatePPCallbacks());
}
void ReplaceAutoPtrCheck::check(const MatchFinder::MatchResult &Result) {
Modified: clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h Fri Mar 22 11:58:12 2019
@@ -45,7 +45,8 @@ public:
ReplaceAutoPtrCheck(StringRef Name, ClangTidyContext *Context);
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
private:
Modified: clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp Fri Mar 22 11:58:12 2019
@@ -43,11 +43,10 @@ void ReplaceRandomShuffleCheck::register
}
void ReplaceRandomShuffleCheck::registerPPCallbacks(
- CompilerInstance &Compiler) {
- IncludeInserter = llvm::make_unique<utils::IncludeInserter>(
- Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle);
- Compiler.getPreprocessor().addPPCallbacks(
- IncludeInserter->CreatePPCallbacks());
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ IncludeInserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
+ IncludeStyle);
+ PP->addPPCallbacks(IncludeInserter->CreatePPCallbacks());
}
void ReplaceRandomShuffleCheck::storeOptions(
Modified: clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.h Fri Mar 22 11:58:12 2019
@@ -24,7 +24,8 @@ namespace modernize {
class ReplaceRandomShuffleCheck : public ClangTidyCheck {
public:
ReplaceRandomShuffleCheck(StringRef Name, ClangTidyContext *Context);
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Modified: clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.cpp Fri Mar 22 11:58:12 2019
@@ -91,10 +91,11 @@ void MoveConstructorInitCheck::check(con
}
}
-void MoveConstructorInitCheck::registerPPCallbacks(CompilerInstance &Compiler) {
- Inserter.reset(new utils::IncludeInserter(
- Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle));
- Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
+void MoveConstructorInitCheck::registerPPCallbacks(
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
+ IncludeStyle);
+ PP->addPPCallbacks(Inserter->CreatePPCallbacks());
}
void MoveConstructorInitCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Modified: clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/MoveConstructorInitCheck.h Fri Mar 22 11:58:12 2019
@@ -28,7 +28,8 @@ public:
MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context);
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
- void registerPPCallbacks(clang::CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
private:
Modified: clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.cpp Fri Mar 22 11:58:12 2019
@@ -35,11 +35,10 @@ TypePromotionInMathFnCheck::TypePromotio
Options.getLocalOrGlobal("IncludeStyle", "llvm"))) {}
void TypePromotionInMathFnCheck::registerPPCallbacks(
- CompilerInstance &Compiler) {
- IncludeInserter = llvm::make_unique<utils::IncludeInserter>(
- Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle);
- Compiler.getPreprocessor().addPPCallbacks(
- IncludeInserter->CreatePPCallbacks());
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ IncludeInserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
+ IncludeStyle);
+ PP->addPPCallbacks(IncludeInserter->CreatePPCallbacks());
}
void TypePromotionInMathFnCheck::storeOptions(
Modified: clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.h Fri Mar 22 11:58:12 2019
@@ -29,7 +29,8 @@ class TypePromotionInMathFnCheck : publi
public:
TypePromotionInMathFnCheck(StringRef Name, ClangTidyContext *Context);
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp Fri Mar 22 11:58:12 2019
@@ -168,10 +168,10 @@ void UnnecessaryValueParamCheck::check(c
}
void UnnecessaryValueParamCheck::registerPPCallbacks(
- CompilerInstance &Compiler) {
- Inserter.reset(new utils::IncludeInserter(
- Compiler.getSourceManager(), Compiler.getLangOpts(), IncludeStyle));
- Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
+ IncludeStyle);
+ PP->addPPCallbacks(Inserter->CreatePPCallbacks());
}
void UnnecessaryValueParamCheck::storeOptions(
Modified: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.h Fri Mar 22 11:58:12 2019
@@ -27,7 +27,8 @@ public:
UnnecessaryValueParamCheck(StringRef Name, ClangTidyContext *Context);
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void onEndOfTranslationUnit() override;
Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.cpp Fri Mar 22 11:58:12 2019
@@ -97,10 +97,9 @@ private:
} // namespace
void RedundantPreprocessorCheck::registerPPCallbacks(
- CompilerInstance &Compiler) {
- Compiler.getPreprocessor().addPPCallbacks(
- ::llvm::make_unique<RedundantPreprocessorCallbacks>(
- *this, Compiler.getPreprocessor()));
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ PP->addPPCallbacks(
+ ::llvm::make_unique<RedundantPreprocessorCallbacks>(*this, *PP));
}
} // namespace readability
Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantPreprocessorCheck.h Fri Mar 22 11:58:12 2019
@@ -24,7 +24,8 @@ class RedundantPreprocessorCheck : publi
public:
RedundantPreprocessorCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
};
} // namespace readability
Modified: clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp Fri Mar 22 11:58:12 2019
@@ -266,10 +266,10 @@ private:
};
} // namespace
-void HeaderGuardCheck::registerPPCallbacks(CompilerInstance &Compiler) {
- Compiler.getPreprocessor().addPPCallbacks(
- llvm::make_unique<HeaderGuardPPCallbacks>(&Compiler.getPreprocessor(),
- this));
+void HeaderGuardCheck::registerPPCallbacks(const SourceManager &SM,
+ Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) {
+ PP->addPPCallbacks(llvm::make_unique<HeaderGuardPPCallbacks>(PP, this));
}
bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {
Modified: clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h Fri Mar 22 11:58:12 2019
@@ -32,7 +32,8 @@ public:
utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
HeaderFileExtensions, ',');
}
- void registerPPCallbacks(CompilerInstance &Compiler) override;
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
/// Returns ``true`` if the check should suggest inserting a trailing comment
/// on the ``#endif`` of the header guard. It will use the same name as
Modified: clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/IncludeInserter.h Fri Mar 22 11:58:12 2019
@@ -31,11 +31,11 @@ namespace utils {
///
/// class MyCheck : public ClangTidyCheck {
/// public:
-/// void registerPPCallbacks(CompilerInstance& Compiler) override {
-/// Inserter = llvm::make_unique<IncludeInserter>(&Compiler.getSourceManager(),
-/// &Compiler.getLangOpts());
-/// Compiler.getPreprocessor().addPPCallbacks(
-/// Inserter->CreatePPCallbacks());
+/// void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+/// Preprocessor *ModuleExpanderPP) override {
+/// Inserter = llvm::make_unique<IncludeInserter>(
+/// SM, getLangOpts(), utils::IncludeSorter::IS_Google);
+/// PP->addPPCallbacks(Inserter->CreatePPCallbacks());
/// }
///
/// void registerMatchers(ast_matchers::MatchFinder* Finder) override { ... }
Modified: clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h Fri Mar 22 11:58:12 2019
@@ -39,9 +39,11 @@ private:
Context.setCurrentFile(File);
Context.setASTContext(&Compiler.getASTContext());
+ Preprocessor *PP = &Compiler.getPreprocessor();
for (auto &Check : Checks) {
Check->registerMatchers(&Finder);
Check->registerPPCallbacks(Compiler);
+ Check->registerPPCallbacks(Compiler.getSourceManager(), PP, PP);
}
return Finder.newASTConsumer();
}
Modified: clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp?rev=356796&r1=356795&r2=356796&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp Fri Mar 22 11:58:12 2019
@@ -31,12 +31,11 @@ public:
IncludeInserterCheckBase(StringRef CheckName, ClangTidyContext *Context)
: ClangTidyCheck(CheckName, Context) {}
- void registerPPCallbacks(CompilerInstance &Compiler) override {
- Inserter.reset(new utils::IncludeInserter(
- Compiler.getSourceManager(),
- Compiler.getLangOpts(),
- utils::IncludeSorter::IS_Google));
- Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override {
+ Inserter = llvm::make_unique<utils::IncludeInserter>(
+ SM, getLangOpts(), utils::IncludeSorter::IS_Google);
+ PP->addPPCallbacks(Inserter->CreatePPCallbacks());
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override {
More information about the cfe-commits
mailing list