diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2018-06-13 09:48:32 +0200 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-06-21 09:30:56 +0000 |
commit | cc84b351940f2aa9177d0cb83e827be06f219d8f (patch) | |
tree | 3b8be0e17d167a86853cae7ab990d3c49b2e2032 /tools | |
parent | 43ac160b1aa4d98ad07f1e8dde5e445593dc8d91 (diff) |
[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 <ivan.donchevskii@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/c-index-test/c-index-test.c | 2 | ||||
-rw-r--r-- | tools/libclang/CIndex.cpp | 3 |
2 files changed, 5 insertions, 0 deletions
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<DiagnosticsEngine, llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> > |