[clang-tools-extra] r217475 - Unique_ptrify PPCallbacks ownership. Goes with clang r217474.
Craig Topper
craig.topper at gmail.com
Tue Sep 9 22:07:57 PDT 2014
Author: ctopper
Date: Wed Sep 10 00:07:57 2014
New Revision: 217475
URL: http://llvm.org/viewvc/llvm-project?rev=217475&view=rev
Log:
Unique_ptrify PPCallbacks ownership. Goes with clang r217474.
Modified:
clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp
clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp
clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp
clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp
clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp
clang-tools-extra/trunk/pp-trace/PPTrace.cpp
Modified: clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp?rev=217475&r1=217474&r2=217475&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp Wed Sep 10 00:07:57 2014
@@ -60,9 +60,9 @@ class IncludeDirectivesPPCallback : publ
public:
IncludeDirectivesPPCallback(IncludeDirectives *Self)
: Self(Self), Guard(nullptr) {}
+ virtual ~IncludeDirectivesPPCallback() {}
private:
- virtual ~IncludeDirectivesPPCallback() {}
void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
@@ -311,7 +311,8 @@ static std::pair<unsigned, bool> findDir
IncludeDirectives::IncludeDirectives(clang::CompilerInstance &CI)
: CI(CI), Sources(CI.getSourceManager()) {
// addPPCallbacks takes ownership of the callback
- CI.getPreprocessor().addPPCallbacks(new IncludeDirectivesPPCallback(this));
+ CI.getPreprocessor().addPPCallbacks(
+ llvm::make_unique<IncludeDirectivesPPCallback>(this));
}
bool IncludeDirectives::lookForInclude(const FileEntry *File,
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=217475&r1=217474&r2=217475&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp Wed Sep 10 00:07:57 2014
@@ -46,7 +46,8 @@ private:
void IncludeOrderCheck::registerPPCallbacks(CompilerInstance &Compiler) {
Compiler.getPreprocessor().addPPCallbacks(
- new IncludeOrderPPCallbacks(*this, Compiler.getSourceManager()));
+ llvm::make_unique<IncludeOrderPPCallbacks>(*this,
+ Compiler.getSourceManager()));
}
static int getPriority(StringRef Filename, bool IsAngled, bool IsMainModule) {
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=217475&r1=217474&r2=217475&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.cpp Wed Sep 10 00:07:57 2014
@@ -258,7 +258,8 @@ private:
void HeaderGuardCheck::registerPPCallbacks(CompilerInstance &Compiler) {
Compiler.getPreprocessor().addPPCallbacks(
- new HeaderGuardPPCallbacks(&Compiler.getPreprocessor(), this));
+ llvm::make_unique<HeaderGuardPPCallbacks>(&Compiler.getPreprocessor(),
+ this));
}
bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {
Modified: clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp?rev=217475&r1=217474&r2=217475&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp (original)
+++ clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp Wed Sep 10 00:07:57 2014
@@ -877,7 +877,8 @@ public:
HeadersInThisCompile.clear();
assert((HeaderStack.size() == 0) && "Header stack should be empty.");
pushHeaderHandle(addHeader(rootHeaderFile));
- PP.addPPCallbacks(new PreprocessorCallbacks(*this, PP, rootHeaderFile));
+ PP.addPPCallbacks(llvm::make_unique<PreprocessorCallbacks>(*this, PP,
+ rootHeaderFile));
}
// Handle exiting a preprocessing session.
void handlePreprocessorExit() { HeaderStack.clear(); }
Modified: clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp?rev=217475&r1=217474&r2=217475&view=diff
==============================================================================
--- clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp (original)
+++ clang-tools-extra/trunk/module-map-checker/ModuleMapChecker.cpp Wed Sep 10 00:07:57 2014
@@ -169,7 +169,7 @@ class ModuleMapCheckerConsumer : public
public:
ModuleMapCheckerConsumer(ModuleMapChecker &Checker, Preprocessor &PP) {
// PP takes ownership.
- PP.addPPCallbacks(new ModuleMapCheckerCallbacks(Checker));
+ PP.addPPCallbacks(llvm::make_unique<ModuleMapCheckerCallbacks>(Checker));
}
};
Modified: clang-tools-extra/trunk/pp-trace/PPTrace.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPTrace.cpp?rev=217475&r1=217474&r2=217475&view=diff
==============================================================================
--- clang-tools-extra/trunk/pp-trace/PPTrace.cpp (original)
+++ clang-tools-extra/trunk/pp-trace/PPTrace.cpp Wed Sep 10 00:07:57 2014
@@ -109,7 +109,8 @@ public:
PPTraceConsumer(SmallSet<std::string, 4> &Ignore,
std::vector<CallbackCall> &CallbackCalls, Preprocessor &PP) {
// PP takes ownership.
- PP.addPPCallbacks(new PPCallbacksTracker(Ignore, CallbackCalls, PP));
+ PP.addPPCallbacks(llvm::make_unique<PPCallbacksTracker>(Ignore,
+ CallbackCalls, PP));
}
};
More information about the cfe-commits
mailing list