ClangRefactoring: Move clang options to BeginInvocation

Change-Id: If4e90aa8e27b961026912bef3f0e81f972fbe0c7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2019-02-12 15:00:14 +01:00
parent 75d9b56c1a
commit 80cdc99737
2 changed files with 17 additions and 7 deletions

View File

@@ -66,9 +66,6 @@ private:
CreateASTConsumer(clang::CompilerInstance &compilerInstance, CreateASTConsumer(clang::CompilerInstance &compilerInstance,
llvm::StringRef inFile) override llvm::StringRef inFile) override
{ {
compilerInstance.getPreprocessor().SetSuppressIncludeNotFoundError(true);
compilerInstance.getLangOpts().DelayedTemplateParsing = false;
return WrapperFrontendAction::CreateASTConsumer(compilerInstance, inFile); return WrapperFrontendAction::CreateASTConsumer(compilerInstance, inFile);
} }
}; };

View File

@@ -25,6 +25,7 @@
#include "symbolscollector.h" #include "symbolscollector.h"
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/FrontendActions.h> #include <clang/Frontend/FrontendActions.h>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -96,14 +97,26 @@ newFrontendActionFactory(Factory *consumerFactory,
} }
protected: protected:
bool BeginSourceFileAction(clang::CompilerInstance &CI) override { bool BeginInvocation(clang::CompilerInstance &compilerInstance) override
if (!clang::ASTFrontendAction::BeginSourceFileAction(CI)) {
compilerInstance.getLangOpts().DelayedTemplateParsing = false;
return clang::ASTFrontendAction::BeginInvocation(compilerInstance);
}
bool BeginSourceFileAction(clang::CompilerInstance &compilerInstance) override
{
compilerInstance.getPreprocessor().SetSuppressIncludeNotFoundError(true);
if (!clang::ASTFrontendAction::BeginSourceFileAction(compilerInstance))
return false; return false;
if (m_sourceFileCallbacks) if (m_sourceFileCallbacks)
return m_sourceFileCallbacks->handleBeginSource(CI); return m_sourceFileCallbacks->handleBeginSource(compilerInstance);
return true; return true;
} }
void EndSourceFileAction() override {
void EndSourceFileAction() override
{
if (m_sourceFileCallbacks) if (m_sourceFileCallbacks)
m_sourceFileCallbacks->handleEndSource(); m_sourceFileCallbacks->handleEndSource();
clang::ASTFrontendAction::EndSourceFileAction(); clang::ASTFrontendAction::EndSourceFileAction();