sammccall updated this revision to Diff 399624.
sammccall added a comment.
add fixme
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116925/new/
https://reviews.llvm.org/D116925
Files:
clang-tools-extra/clangd/Diagnostics.cpp
clang-tools-extra/clangd/ParsedAST.cpp
clang-tools-extra/clangd/Preamble.cpp
Index: clang-tools-extra/clangd/Preamble.cpp
===================================================================
--- clang-tools-extra/clangd/Preamble.cpp
+++ clang-tools-extra/clangd/Preamble.cpp
@@ -350,7 +350,8 @@
PreambleDiagnostics.setLevelAdjuster([&](DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic &Info) {
if (Cfg.Diagnostics.SuppressAll ||
- isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress))
+ isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress,
+ *CI.getLangOpts()))
return DiagnosticsEngine::Ignored;
switch (Info.getID()) {
case diag::warn_no_newline_eof:
Index: clang-tools-extra/clangd/ParsedAST.cpp
===================================================================
--- clang-tools-extra/clangd/ParsedAST.cpp
+++ clang-tools-extra/clangd/ParsedAST.cpp
@@ -445,7 +445,8 @@
ASTDiags.setLevelAdjuster([&](DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic &Info) {
if (Cfg.Diagnostics.SuppressAll ||
- isBuiltinDiagnosticSuppressed(Info.getID(),
Cfg.Diagnostics.Suppress))
+ isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress,
+ Clang->getLangOpts()))
return DiagnosticsEngine::Ignored;
auto It = OverriddenSeverity.find(Info.getID());
Index: clang-tools-extra/clangd/Diagnostics.cpp
===================================================================
--- clang-tools-extra/clangd/Diagnostics.cpp
+++ clang-tools-extra/clangd/Diagnostics.cpp
@@ -879,7 +879,14 @@
}
bool isBuiltinDiagnosticSuppressed(unsigned ID,
- const llvm::StringSet<> &Suppress) {
+ const llvm::StringSet<> &Suppress,
+ const LangOptions &LangOpts) {
+ // Don't complain about header-only stuff in mainfiles if it's a header.
+ // FIXME: would be cleaner to suppress in clang, once we decide whether the
+ // behavior should be to silently-ignore or respect the pragma.
+ if (ID == diag::pp_pragma_sysheader_in_main_file && LangOpts.IsHeaderFile)
+ return true;
+
if (const char *CodePtr = getDiagnosticCode(ID)) {
if (Suppress.contains(normalizeSuppressedCode(CodePtr)))
return true;
Index: clang-tools-extra/clangd/Preamble.cpp
===================================================================
--- clang-tools-extra/clangd/Preamble.cpp
+++ clang-tools-extra/clangd/Preamble.cpp
@@ -350,7 +350,8 @@
PreambleDiagnostics.setLevelAdjuster([&](DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic &Info) {
if (Cfg.Diagnostics.SuppressAll ||
- isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress))
+ isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress,
+ *CI.getLangOpts()))
return DiagnosticsEngine::Ignored;
switch (Info.getID()) {
case diag::warn_no_newline_eof:
Index: clang-tools-extra/clangd/ParsedAST.cpp
===================================================================
--- clang-tools-extra/clangd/ParsedAST.cpp
+++ clang-tools-extra/clangd/ParsedAST.cpp
@@ -445,7 +445,8 @@
ASTDiags.setLevelAdjuster([&](DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic &Info) {
if (Cfg.Diagnostics.SuppressAll ||
- isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress))
+ isBuiltinDiagnosticSuppressed(Info.getID(), Cfg.Diagnostics.Suppress,
+ Clang->getLangOpts()))
return DiagnosticsEngine::Ignored;
auto It = OverriddenSeverity.find(Info.getID());
Index: clang-tools-extra/clangd/Diagnostics.cpp
===================================================================
--- clang-tools-extra/clangd/Diagnostics.cpp
+++ clang-tools-extra/clangd/Diagnostics.cpp
@@ -879,7 +879,14 @@
}
bool isBuiltinDiagnosticSuppressed(unsigned ID,
- const llvm::StringSet<> &Suppress) {
+ const llvm::StringSet<> &Suppress,
+ const LangOptions &LangOpts) {
+ // Don't complain about header-only stuff in mainfiles if it's a header.
+ // FIXME: would be cleaner to suppress in clang, once we decide whether the
+ // behavior should be to silently-ignore or respect the pragma.
+ if (ID == diag::pp_pragma_sysheader_in_main_file && LangOpts.IsHeaderFile)
+ return true;
+
if (const char *CodePtr = getDiagnosticCode(ID)) {
if (Suppress.contains(normalizeSuppressedCode(CodePtr)))
return true;
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits