Bug 1180549 - Fix a startup crash when using the clang-plugin with clang>3.5; r=mystor

We were de-referencing the checker variable after having moved it into
the array, which was causing a null pointer crash.

With this fixed, the plugin can be built with more recent versions of
clang.
This commit is contained in:
Ehsan Akhgari 2015-07-05 21:05:53 -04:00
parent 2eec7a5758
commit 68bc2d67de

View File

@ -992,12 +992,13 @@ class MozCheckAction : public PluginASTAction {
public:
ASTConsumerPtr CreateASTConsumer(CompilerInstance &CI, StringRef fileName) override {
#if CLANG_VERSION_FULL >= 306
std::unique_ptr<MozChecker> checker(make_unique<MozChecker>(CI));
std::unique_ptr<MozChecker> checker(llvm::make_unique<MozChecker>(CI));
ASTConsumerPtr other(checker->getOtherConsumer());
std::vector<std::unique_ptr<ASTConsumer>> consumers;
std::vector<ASTConsumerPtr> consumers;
consumers.push_back(std::move(checker));
consumers.push_back(checker->getOtherConsumer());
return make_unique<MultiplexConsumer>(std::move(consumers));
consumers.push_back(std::move(other));
return llvm::make_unique<MultiplexConsumer>(std::move(consumers));
#else
MozChecker *checker = new MozChecker(CI);