[llvm-branch-commits] [lldb] b0dc54e - [lldb][NFC] Refactor setup code for Clang diagnostics
Raphael Isemann via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jan 8 05:31:30 PST 2021
Author: Raphael Isemann
Date: 2021-01-08T14:26:04+01:00
New Revision: b0dc54e08a9b5bee8ba1e874e9c12f4c4859f4a3
URL: https://github.com/llvm/llvm-project/commit/b0dc54e08a9b5bee8ba1e874e9c12f4c4859f4a3
DIFF: https://github.com/llvm/llvm-project/commit/b0dc54e08a9b5bee8ba1e874e9c12f4c4859f4a3.diff
LOG: [lldb][NFC] Refactor setup code for Clang diagnostics
Added:
Modified:
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 9b6e6e0f01f0..c61c0105661f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -337,6 +337,20 @@ static void RemoveAllCppKeywords(IdentifierTable &idents) {
#include "clang/Basic/TokenKinds.def"
}
+/// Configures Clang diagnostics for the expression parser.
+static void SetupDefaultClangDiagnostics(CompilerInstance &compiler) {
+ // List of Clang warning groups that are not useful when parsing expressions.
+ const std::vector<const char *> groupsToIgnore = {
+ "unused-value",
+ "odr",
+ };
+ for (const char *group : groupsToIgnore) {
+ compiler.getDiagnostics().setSeverityForGroup(
+ clang::diag::Flavor::WarningOrError, group,
+ clang::diag::Severity::Ignored, SourceLocation());
+ }
+}
+
//===----------------------------------------------------------------------===//
// Implementation of ClangExpressionParser
//===----------------------------------------------------------------------===//
@@ -637,12 +651,7 @@ ClangExpressionParser::ClangExpressionParser(
m_compiler->getCodeGenOpts().setDebugInfo(codegenoptions::NoDebugInfo);
// Disable some warnings.
- m_compiler->getDiagnostics().setSeverityForGroup(
- clang::diag::Flavor::WarningOrError, "unused-value",
- clang::diag::Severity::Ignored, SourceLocation());
- m_compiler->getDiagnostics().setSeverityForGroup(
- clang::diag::Flavor::WarningOrError, "odr",
- clang::diag::Severity::Ignored, SourceLocation());
+ SetupDefaultClangDiagnostics(*m_compiler);
// Inform the target of the language options
//
More information about the llvm-branch-commits
mailing list