forked from qt-creator/qt-creator
ClangPchManager: Allow errors in pch-s
There are cases when we can't avoid errors when we put all system includes together. This might lead to not having any pch-s which makes the indexing useless (too slow). Change-Id: Icdbfdf916bbd0ed9b6cd18f9c976d3d4efb0e18f Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <clang/Tooling/Tooling.h>
|
||||
|
||||
#include <clang/Basic/DiagnosticOptions.h>
|
||||
#include <clang/Frontend/CompilerInstance.h>
|
||||
#include <clang/Frontend/FrontendActions.h>
|
||||
#include <clang/Lex/PreprocessorOptions.h>
|
||||
@@ -44,6 +45,9 @@ public:
|
||||
bool BeginInvocation(clang::CompilerInstance &compilerInstance) override
|
||||
{
|
||||
compilerInstance.getPreprocessorOpts().DisablePCHValidation = true;
|
||||
compilerInstance.getPreprocessorOpts().AllowPCHWithCompilerErrors = true;
|
||||
compilerInstance.getLangOpts().DelayedTemplateParsing = true;
|
||||
compilerInstance.getDiagnosticOpts().ErrorLimit = 0;
|
||||
std::unique_ptr<llvm::MemoryBuffer> Input = llvm::MemoryBuffer::getMemBuffer(m_fileContent);
|
||||
compilerInstance.getPreprocessorOpts().addRemappedFile(m_filePath, Input.release());
|
||||
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <clang/Frontend/CompilerInstance.h>
|
||||
#include <clang/Frontend/FrontendActions.h>
|
||||
#include <clang/Lex/PreprocessorOptions.h>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
@@ -100,6 +101,7 @@ newFrontendActionFactory(Factory *consumerFactory,
|
||||
bool BeginInvocation(clang::CompilerInstance &compilerInstance) override
|
||||
{
|
||||
compilerInstance.getLangOpts().DelayedTemplateParsing = false;
|
||||
compilerInstance.getPreprocessorOpts().AllowPCHWithCompilerErrors = true;
|
||||
|
||||
return clang::ASTFrontendAction::BeginInvocation(compilerInstance);
|
||||
}
|
||||
|
Reference in New Issue
Block a user