Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions interpreter/cling/lib/Interpreter/CIFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "clang/Driver/Job.h"
#include "clang/Driver/Tool.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/MultiplexConsumer.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/Frontend/VerifyDiagnosticConsumer.h"
#include "clang/Serialization/SerializationDiagnostic.h"
Expand Down Expand Up @@ -966,18 +967,21 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
// Set up the ASTContext
CI->createASTContext();

std::vector<std::unique_ptr<ASTConsumer>> Consumers;

if (OnlyLex) {
assert(!customConsumer && "Can't specify a custom consumer when in "
"OnlyLex mode");
class IgnoreConsumer: public clang::ASTConsumer {};
CI->setASTConsumer(
std::unique_ptr<clang::ASTConsumer>(new IgnoreConsumer()));
} else {
assert(customConsumer && "Need to specify a custom consumer"
" when not in OnlyLex mode");
CI->setASTConsumer(std::move(customConsumer));
Consumers.push_back(std::move(customConsumer));
}

std::unique_ptr<clang::MultiplexConsumer> multiConsumer(
new clang::MultiplexConsumer(std::move(Consumers)));
CI->setASTConsumer(std::move(multiConsumer));

// Set up Sema
CodeCompleteConsumer* CCC = 0;
CI->createSema(TU_Complete, CCC);
Expand Down