From: Argyrios Kyrtzidis Date: Tue, 27 Mar 2012 21:38:03 +0000 (+0000) Subject: [libclang] Introduce indexing option CXIndexOpt_SuppressWarnings, which X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b49a29f7e4413a7a014a2b28c5c25fe54e005cf3;p=clang [libclang] Introduce indexing option CXIndexOpt_SuppressWarnings, which disables all compiler warnings. rdar://11059556 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153539 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index d05510e281..904585f108 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -4494,7 +4494,12 @@ typedef enum { * \brief Implicit function/class template instantiations should be indexed. * If this is not set, implicit instantiations will be ignored. */ - CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4 + CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4, + + /** + * \brief Suppress all compiler warnings when parsing for indexing. + */ + CXIndexOpt_SuppressWarnings = 0x8 } CXIndexOptFlags; /** diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp index aad6e02fe9..85b638530f 100644 --- a/tools/libclang/Indexing.cpp +++ b/tools/libclang/Indexing.cpp @@ -346,6 +346,9 @@ static void clang_indexSourceFile_Impl(void *UserData) { if (!requestedToGetTU) CInvok->getPreprocessorOpts().DetailedRecord = false; + if (index_options & CXIndexOpt_SuppressWarnings) + CInvok->getDiagnosticOpts().IgnoreWarnings = true; + ASTUnit *Unit = ASTUnit::create(CInvok.getPtr(), Diags, /*CaptureDiagnostics=*/true); OwningPtr CXTU(new CXTUOwner(MakeCXTranslationUnit(Unit)));