Author: ziqingluo-90 Date: 2023-05-15T12:10:13-07:00 New Revision: 86c7e33b3fd0cc231b09b5af21ef42842f0ff97b
URL: https://github.com/llvm/llvm-project/commit/86c7e33b3fd0cc231b09b5af21ef42842f0ff97b DIFF: https://github.com/llvm/llvm-project/commit/86c7e33b3fd0cc231b09b5af21ef42842f0ff97b.diff LOG: Re-land "[-Wunsafe-buffer-usage] Remove an unnecessary const-qualifier" Re-land 7a0900fd3e2d34bc1d513a97cf8fbdc1754252d7, which includes too much clang-format changes. This re-land gets rid of the format changes. Added: Modified: clang/include/clang/Sema/AnalysisBasedWarnings.h clang/lib/Sema/AnalysisBasedWarnings.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Sema/AnalysisBasedWarnings.h b/clang/include/clang/Sema/AnalysisBasedWarnings.h index c73506894db9d..020ddd36cf73e 100644 --- a/clang/include/clang/Sema/AnalysisBasedWarnings.h +++ b/clang/include/clang/Sema/AnalysisBasedWarnings.h @@ -97,7 +97,7 @@ class AnalysisBasedWarnings { const Decl *D, QualType BlockType); // Issue warnings that require whole-translation-unit analysis. - void IssueWarnings(const TranslationUnitDecl *D); + void IssueWarnings(TranslationUnitDecl *D); Policy getDefaultPolicy() { return DefaultPolicy; } diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index 4d96f3b9ab32b..11fd39af825e7 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -2340,7 +2340,7 @@ class CallableVisitor : public RecursiveASTVisitor<CallableVisitor> { }; void clang::sema::AnalysisBasedWarnings::IssueWarnings( - const TranslationUnitDecl *TU) { + TranslationUnitDecl *TU) { if (!TU) return; // This is unexpected, give up quietly. @@ -2370,9 +2370,7 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings( // reasoning. Check if any of them is enabled at all before scanning the AST: if (!Diags.isIgnored(diag::warn_unsafe_buffer_operation, SourceLocation()) || !Diags.isIgnored(diag::warn_unsafe_buffer_variable, SourceLocation())) { - CallableVisitor(CallAnalyzers) - .TraverseTranslationUnitDecl( - std::remove_const_t<TranslationUnitDecl *>(TU)); + CallableVisitor(CallAnalyzers).TraverseTranslationUnitDecl(TU); } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits