[clang] [Fix] Speedup -Wunsafe-buffer-usage when using clang modules. (PR #127161)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 16 18:42:38 PST 2025
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 dc79c66f2c6cc2773e38735660d8e0aaedf9702c ec6461f8a44058f588a23cf0c7cd29c528bf4b8e --extensions cpp -- clang/lib/Sema/AnalysisBasedWarnings.cpp clang/test/Modules/safe_buffers_optout.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index ecc7e893c2..fd46d97fec 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -2546,11 +2546,11 @@ static void flushDiagnostics(Sema &S, const sema::FunctionScopeInfo *fscope) {
class CallableVisitor : public DynamicRecursiveASTVisitor {
private:
llvm::function_ref<void(const Decl *)> Callback;
- const Module* const TUModule;
+ const Module *const TUModule;
public:
CallableVisitor(llvm::function_ref<void(const Decl *)> Callback,
- const Module* const TUModule)
+ const Module *const TUModule)
: Callback(Callback), TUModule(TUModule) {
ShouldVisitTemplateInstantiations = true;
ShouldVisitImplicitCode = false;
@@ -2646,7 +2646,8 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings(
SourceLocation()) ||
(!Diags.isIgnored(diag::warn_unsafe_buffer_libc_call, SourceLocation()) &&
S.getLangOpts().CPlusPlus /* only warn about libc calls in C++ */)) {
- CallableVisitor(CallAnalyzers, TU->getOwningModule()).TraverseTranslationUnitDecl(TU);
+ CallableVisitor(CallAnalyzers, TU->getOwningModule())
+ .TraverseTranslationUnitDecl(TU);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/127161
More information about the cfe-commits
mailing list