From cc84b351940f2aa9177d0cb83e827be06f219d8f Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 13 Jun 2018 09:48:32 +0200 Subject: [libclang] Allow skipping warnings from all included files ------------------------------------------------------------------ * https://reviews.llvm.org/D48116 ------------------------------------------------------------------ Depending on the included files and the used warning flags, e.g. - Weverything, a huge number of warnings can be reported for included files. As processing that many diagnostics comes with a performance impact and not all clients are interested in those diagnostics, add a flag to skip them. Change-Id: Ia738a9382b43d210046bff68b3be8cb9dd89206f Reviewed-by: Ivan Donchevskii --- tools/c-index-test/c-index-test.c | 2 ++ tools/libclang/CIndex.cpp | 3 +++ 2 files changed, 5 insertions(+) (limited to 'tools') diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 45348a21c4..71d73f580a 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -84,6 +84,8 @@ static unsigned getDefaultParsingOptions() { options |= CXTranslationUnit_KeepGoing; if (getenv("CINDEXTEST_LIMIT_SKIP_FUNCTION_BODIES_TO_PREAMBLE")) options |= CXTranslationUnit_LimitSkipFunctionBodiesToPreamble; + if (getenv("CINDEXTEST_IGNORE_NONERRORS_FROM_INCLUDED_FILES")) + options |= CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles; return options; } diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index c44c72e2ed..0affc17117 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -3393,6 +3393,9 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename, if (options & CXTranslationUnit_KeepGoing) Diags->setSuppressAfterFatalError(false); + if (options & CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles) + Diags->setSuppressNonErrorsFromIncludedFiles(true); + // Recover resources if we crash before exiting this function. llvm::CrashRecoveryContextCleanupRegistrar > -- cgit v1.2.3