[libclang] Indexing API: Capture diagnostics during indexing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145228 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Argyrios Kyrtzidis 2011-11-28 04:55:55 +00:00
Родитель 5c00fc309b
Коммит 991bf49f68
3 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -628,7 +628,8 @@ public:
/// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation.
static ASTUnit *create(CompilerInvocation *CI,
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags);
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
bool CaptureDiagnostics = false);
/// \brief Create a ASTUnit from an AST file.
///

Просмотреть файл

@ -1632,10 +1632,11 @@ StringRef ASTUnit::getMainFileName() const {
}
ASTUnit *ASTUnit::create(CompilerInvocation *CI,
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags) {
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
bool CaptureDiagnostics) {
llvm::OwningPtr<ASTUnit> AST;
AST.reset(new ASTUnit(false));
ConfigureDiags(Diags, 0, 0, *AST, /*CaptureDiagnostics=*/false);
ConfigureDiags(Diags, 0, 0, *AST, CaptureDiagnostics);
AST->Diagnostics = Diags;
AST->Invocation = CI;
AST->FileSystemOpts = CI->getFileSystemOpts();

Просмотреть файл

@ -317,7 +317,8 @@ static void clang_indexSourceFile_Impl(void *UserData) {
if (!requestedToGetTU)
CInvok->getPreprocessorOpts().DetailedRecord = false;
ASTUnit *Unit = ASTUnit::create(CInvok.getPtr(), Diags);
ASTUnit *Unit = ASTUnit::create(CInvok.getPtr(), Diags,
/*CaptureDiagnostics=*/true);
llvm::OwningPtr<CXTUOwner> CXTU(new CXTUOwner(MakeCXTranslationUnit(Unit)));
// Recover resources if we crash before exiting this method.