[clang] [clang-tools-extra] [llvm] [clang] Introduce diagnostics suppression mappings (PR #112517)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 16 03:49:00 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 15d85769f119061fbfcae6e9de43982b534ef724 01a538fbbd93a7f26e1309c9c95d5be0c8500402 --extensions h,cpp -- clang/test/Misc/warning-suppression-mappings.cpp clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp clang/include/clang/Basic/Diagnostic.h clang/include/clang/Basic/DiagnosticOptions.h clang/include/clang/Frontend/CompilerInstance.h clang/lib/Basic/Diagnostic.cpp clang/lib/Basic/DiagnosticIDs.cpp clang/lib/Basic/Warnings.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/ASTUnit.cpp clang/lib/Frontend/CompilerInstance.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/lib/Frontend/PrecompiledPreamble.cpp clang/lib/Interpreter/CodeCompletion.cpp clang/lib/Serialization/ASTReader.cpp clang/tools/driver/cc1gen_reproducer_main.cpp clang/tools/driver/driver.cpp clang/unittests/Basic/DiagnosticTest.cpp clang/unittests/Frontend/CompilerInvocationTest.cpp llvm/include/llvm/Support/SpecialCaseList.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Basic/Warnings.cpp b/clang/lib/Basic/Warnings.cpp
index 1047980b84..c074d719a7 100644
--- a/clang/lib/Basic/Warnings.cpp
+++ b/clang/lib/Basic/Warnings.cpp
@@ -98,7 +98,7 @@ public:
if (Section == DiagToSection.end())
return false;
auto SrcEntries = Section->second->Entries.find("src");
- if(SrcEntries == Section->second->Entries.end())
+ if (SrcEntries == Section->second->Entries.end())
return false;
// Find the longest glob pattern that matches FilePath. A positive match
// implies D should be suppressed for FilePath.
@@ -119,7 +119,7 @@ public:
}
private:
- llvm::DenseMap<diag::kind, const Section*> DiagToSection;
+ llvm::DenseMap<diag::kind, const Section *> DiagToSection;
};
void parseSuppressionMappings(const llvm::MemoryBuffer &MB,
@@ -141,7 +141,7 @@ void parseSuppressionMappings(const llvm::MemoryBuffer &MB,
void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
const DiagnosticOptions &Opts,
- llvm::vfs::FileSystem& VFS,
+ llvm::vfs::FileSystem &VFS,
bool ReportDiags) {
Diags.setSuppressSystemWarnings(true); // Default to -Wno-system-headers
Diags.setIgnoreAllWarnings(Opts.IgnoreWarnings);
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 464ed8090a..5739eeca4d 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1702,7 +1702,8 @@ bool ASTUnit::LoadFromCompilerInvocation(
Invocation->getPreprocessorOpts().RetainRemappedFileBuffers = true;
Invocation->getFrontendOpts().DisableFree = false;
getDiagnostics().Reset();
- ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts(), *VFS);
+ ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts(),
+ *VFS);
std::unique_ptr<llvm::MemoryBuffer> OverrideMainBuffer;
if (PrecompilePreambleAfterNParses > 0) {
@@ -1710,7 +1711,8 @@ bool ASTUnit::LoadFromCompilerInvocation(
OverrideMainBuffer =
getMainBufferWithPrecompiledPreamble(PCHContainerOps, *Invocation, VFS);
getDiagnostics().Reset();
- ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts(), *VFS);
+ ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts(),
+ *VFS);
}
SimpleTimer ParsingTimer(WantTiming);
diff --git a/clang/unittests/Basic/DiagnosticTest.cpp b/clang/unittests/Basic/DiagnosticTest.cpp
index 1be446d864..cffe9d32a6 100644
--- a/clang/unittests/Basic/DiagnosticTest.cpp
+++ b/clang/unittests/Basic/DiagnosticTest.cpp
@@ -190,7 +190,7 @@ protected:
private:
class CaptureDiagnosticConsumer : public DiagnosticConsumer {
public:
- std::vector<StoredDiagnostic> StoredDiags;
+ std::vector<StoredDiagnostic> StoredDiags;
void HandleDiagnostic(DiagnosticsEngine::Level level,
const Diagnostic &Info) override {
``````````
</details>
https://github.com/llvm/llvm-project/pull/112517
More information about the llvm-commits
mailing list