[flang] [lld] [mlir] [llvm] [libcxx] [clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [lld] [mlir] [llvm] [libcxx] [clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
@@ -52,10 +52,13 @@ class SimpleStreamChecker : public Checker { - CallDescription OpenFn, CloseFn; + const CallDescription OpenFn{{"fopen"}, 2}; + const CallDescription CloseFn{{"fclose"}, 1}; steakhal wrote: Here is why we can't have CallDescriptions constexpr: It's an owning type, holding a `std::vector`, and they are themselves non-constexpr, until IDK cpp20+? So, this is resolved. https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [lld] [mlir] [llvm] [libcxx] [clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [lld] [mlir] [llvm] [libcxx] [clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
@@ -52,10 +52,13 @@ class SimpleStreamChecker : public Checker { - CallDescription OpenFn, CloseFn; + const CallDescription OpenFn{{"fopen"}, 2}; + const CallDescription CloseFn{{"fclose"}, 1}; steakhal wrote: Well, it seems like `StringRef` is not constexpr for some reason - and I'm using that inside. Consequently, that's a blocker. https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
@@ -17,19 +17,18 @@ #include "MPITypes.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" +#include "llvm/ADT/StringRef.h" namespace clang { namespace ento { namespace mpi { class MPIBugReporter { public: - MPIBugReporter(const CheckerBase ) { -UnmatchedWaitBugType.reset(new BugType(, "Unmatched wait", MPIError)); -DoubleNonblockingBugType.reset( -new BugType(, "Double nonblocking", MPIError)); -MissingWaitBugType.reset(new BugType(, "Missing wait", MPIError)); - } + MPIBugReporter(const CheckerBase ) + : UnmatchedWaitBugType(, "Unmatched wait", MPIError), steakhal wrote: I considered that, but couldn't as `CB` is a ctor param. I don't have that in a field init context. https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
@@ -31,14 +31,14 @@ class InvalidatedIteratorChecker check::PreStmt, check::PreStmt> { - std::unique_ptr InvalidatedBugType; + const BugType InvalidatedBugType{this, "Iterator invalidated", + "Misuse of STL APIs"}; void verifyAccess(CheckerContext , const SVal ) const; - void reportBug(const StringRef , const SVal , - CheckerContext , ExplodedNode *ErrNode) const; -public: - InvalidatedIteratorChecker(); + void reportBug(const StringRef , const SVal , CheckerContext , steakhal wrote: Same for the `SVal`. Done. https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
@@ -52,10 +52,13 @@ class SimpleStreamChecker : public Checker { - CallDescription OpenFn, CloseFn; + const CallDescription OpenFn{{"fopen"}, 2}; + const CallDescription CloseFn{{"fclose"}, 1}; Xazax-hun wrote: Since we mostly use `CallDescription`s with compile time known inputs, it would be nice to make their ctors constexpr. This is not for this PR, just a note for the future. https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
@@ -17,19 +17,18 @@ #include "MPITypes.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" +#include "llvm/ADT/StringRef.h" namespace clang { namespace ento { namespace mpi { class MPIBugReporter { public: - MPIBugReporter(const CheckerBase ) { -UnmatchedWaitBugType.reset(new BugType(, "Unmatched wait", MPIError)); -DoubleNonblockingBugType.reset( -new BugType(, "Double nonblocking", MPIError)); -MissingWaitBugType.reset(new BugType(, "Missing wait", MPIError)); - } + MPIBugReporter(const CheckerBase ) + : UnmatchedWaitBugType(, "Unmatched wait", MPIError), Xazax-hun wrote: Move to field initializers? https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
@@ -31,14 +31,14 @@ class InvalidatedIteratorChecker check::PreStmt, check::PreStmt> { - std::unique_ptr InvalidatedBugType; + const BugType InvalidatedBugType{this, "Iterator invalidated", + "Misuse of STL APIs"}; void verifyAccess(CheckerContext , const SVal ) const; - void reportBug(const StringRef , const SVal , - CheckerContext , ExplodedNode *ErrNode) const; -public: - InvalidatedIteratorChecker(); + void reportBug(const StringRef , const SVal , CheckerContext , Xazax-hun wrote: Since we are changing this code, I guess we do not want to take `StringRef`s as const references. https://github.com/llvm/llvm-project/pull/76655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/76655 >From 0362ae2c888edc749711209174f592c5c311db76 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 31 Dec 2023 11:33:15 +0100 Subject: [PATCH 1/2] [analyzer][NFC] Cleanup BugType lazy-init patterns Cleanup most of the lazy-init `BugType` legacy. Some will be preserved, as those are slightly more complicated to refactor. Notice, that the default category for `BugType` is `LogicError`. I omitted setting this explicitly where I could. --- .../Core/BugReporter/CommonBugCategories.h| 1 + .../Checkers/ArrayBoundChecker.cpp| 7 +- .../Checkers/BasicObjCFoundationChecks.cpp| 2 +- .../Checkers/BoolAssignmentChecker.cpp| 7 +- .../Checkers/CXXDeleteChecker.cpp | 24 ++--- .../Checkers/CastSizeChecker.cpp | 6 +- .../StaticAnalyzer/Checkers/ChrootChecker.cpp | 6 +- .../Checkers/ConversionChecker.cpp| 7 +- .../Checkers/DivZeroChecker.cpp | 16 ++-- .../Checkers/DynamicTypeChecker.cpp | 10 +-- .../Checkers/EnumCastOutOfRangeChecker.cpp| 8 +- .../Checkers/ExprInspectionChecker.cpp| 8 +- .../Checkers/FixedAddressChecker.cpp | 6 +- .../Checkers/LocalizationChecker.cpp | 12 +-- .../Checkers/MacOSKeychainAPIChecker.cpp | 22 ++--- .../Checkers/MacOSXAPIChecker.cpp | 10 +-- .../Checkers/MmapWriteExecChecker.cpp | 16 ++-- .../Checkers/NSAutoreleasePoolChecker.cpp | 9 +- .../Checkers/NonNullParamChecker.cpp | 21 ++--- .../Checkers/ObjCAtSyncChecker.cpp| 17 ++-- .../Checkers/ObjCContainersChecker.cpp| 11 +-- .../Checkers/ObjCSelfInitChecker.cpp | 9 +- .../Checkers/PaddingChecker.cpp | 9 +- .../Checkers/PointerArithChecker.cpp | 12 +-- .../Checkers/PointerSubChecker.cpp| 6 +- .../Checkers/ReturnPointerRangeChecker.cpp| 10 +-- .../Checkers/ReturnUndefChecker.cpp | 15 ++-- .../Checkers/StdLibraryFunctionsChecker.cpp | 8 +- .../Checkers/TestAfterDivZeroChecker.cpp | 10 +-- .../Checkers/UndefBranchChecker.cpp | 89 +-- .../Checkers/UndefCapturedBlockVarChecker.cpp | 8 +- .../Checkers/UndefResultChecker.cpp | 8 +- .../UndefinedArraySubscriptChecker.cpp| 7 +- .../Checkers/UndefinedAssignmentChecker.cpp | 11 +-- .../Checkers/UnixAPIChecker.cpp | 32 +++ .../Checkers/VLASizeChecker.cpp | 20 ++--- .../StaticAnalyzer/Checkers/VforkChecker.cpp | 7 +- .../Core/CommonBugCategories.cpp | 1 + .../NoStateChangeFuncVisitorTest.cpp | 7 +- 39 files changed, 171 insertions(+), 324 deletions(-) diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h index 5d2c96e5bc9de3..45187433c069fd 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h @@ -13,6 +13,7 @@ namespace clang { namespace ento { namespace categories { +extern const char *const AppleAPIMisuse; extern const char *const CoreFoundationObjectiveC; extern const char *const LogicError; extern const char *const MemoryRefCount; diff --git a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp index ce126541265551..c990ad138f8905 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp @@ -25,7 +25,7 @@ using namespace ento; namespace { class ArrayBoundChecker : public Checker { - mutable std::unique_ptr BT; + const BugType BT{this, "Out-of-bound array access"}; public: void checkLocation(SVal l, bool isLoad, const Stmt* S, @@ -65,16 +65,13 @@ void ArrayBoundChecker::checkLocation(SVal l, bool isLoad, const Stmt* LoadS, if (!N) return; -if (!BT) - BT.reset(new BugType(this, "Out-of-bound array access")); - // FIXME: It would be nice to eventually make this diagnostic more clear, // e.g., by referencing the original declaration or by saying *why* this // reference is outside the range. // Generate a report for this bug. auto report = std::make_unique( -*BT, "Access out-of-bound array element (buffer overflow)", N); +BT, "Access out-of-bound array element (buffer overflow)", N); report->addRange(LoadS->getSourceRange()); C.emitReport(std::move(report)); diff --git a/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp b/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp index 5e25153a148fea..c72a97cc01e914 100644 --- a/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp +++
[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
llvmbot wrote: @llvm/pr-subscribers-clang-static-analyzer-1 Author: Balazs Benics (steakhal) Changes Cleanup most of the lazy-init `BugType` legacy. Some will be preserved, as those are slightly more complicated to refactor. Notice, that the default category for `BugType` is `LogicError`. I omitted setting this explicitly where I could. Please, actually have a look at the diff. I did this manually, and we rarely check the bug type descriptions and stuff in tests, so the testing might be shallow on this one. --- Patch is 68.96 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/76655.diff 39 Files Affected: - (modified) clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h (+1) - (modified) clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp (+2-5) - (modified) clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp (+1-1) - (modified) clang/lib/StaticAnalyzer/Checkers/BoolAssignmentChecker.cpp (+2-5) - (modified) clang/lib/StaticAnalyzer/Checkers/CXXDeleteChecker.cpp (+7-17) - (modified) clang/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp (+2-4) - (modified) clang/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp (+2-4) - (modified) clang/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp (+2-5) - (modified) clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp (+5-11) - (modified) clang/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp (+2-8) - (modified) clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp (+2-6) - (modified) clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp (+2-6) - (modified) clang/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp (+2-4) - (modified) clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp (+3-9) - (modified) clang/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp (+6-16) - (modified) clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp (+4-6) - (modified) clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp (+9-7) - (modified) clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp (+3-6) - (modified) clang/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp (+6-15) - (modified) clang/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp (+6-11) - (modified) clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp (+3-8) - (modified) clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp (+3-6) - (modified) clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp (+2-7) - (modified) clang/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp (+4-8) - (modified) clang/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp (+2-4) - (modified) clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp (+4-6) - (modified) clang/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp (+5-10) - (modified) clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp (+2-6) - (modified) clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp (+4-6) - (modified) clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp (+42-47) - (modified) clang/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp (+2-6) - (modified) clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp (+2-6) - (modified) clang/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp (+2-5) - (modified) clang/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp (+3-8) - (modified) clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp (+11-21) - (modified) clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp (+6-14) - (modified) clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp (+2-5) - (modified) clang/lib/StaticAnalyzer/Core/CommonBugCategories.cpp (+1) - (modified) clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp (+2-5) ``diff diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h index 5d2c96e5bc9de3..45187433c069fd 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h @@ -13,6 +13,7 @@ namespace clang { namespace ento { namespace categories { +extern const char *const AppleAPIMisuse; extern const char *const CoreFoundationObjectiveC; extern const char *const LogicError; extern const char *const MemoryRefCount; diff --git a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp index ce126541265551..c990ad138f8905 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp @@ -25,7 +25,7 @@ using namespace ento; namespace { class ArrayBoundChecker : public Checker { - mutable std::unique_ptr BT; + const BugType BT{this, "Out-of-bound array access"}; public: void checkLocation(SVal l, bool isLoad, const Stmt*
[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/76655 Cleanup most of the lazy-init `BugType` legacy. Some will be preserved, as those are slightly more complicated to refactor. Notice, that the default category for `BugType` is `LogicError`. I omitted setting this explicitly where I could. Please, actually have a look at the diff. I did this manually, and we rarely check the bug type descriptions and stuff in tests, so the testing might be shallow on this one. >From 0362ae2c888edc749711209174f592c5c311db76 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 31 Dec 2023 11:33:15 +0100 Subject: [PATCH] [analyzer][NFC] Cleanup BugType lazy-init patterns Cleanup most of the lazy-init `BugType` legacy. Some will be preserved, as those are slightly more complicated to refactor. Notice, that the default category for `BugType` is `LogicError`. I omitted setting this explicitly where I could. --- .../Core/BugReporter/CommonBugCategories.h| 1 + .../Checkers/ArrayBoundChecker.cpp| 7 +- .../Checkers/BasicObjCFoundationChecks.cpp| 2 +- .../Checkers/BoolAssignmentChecker.cpp| 7 +- .../Checkers/CXXDeleteChecker.cpp | 24 ++--- .../Checkers/CastSizeChecker.cpp | 6 +- .../StaticAnalyzer/Checkers/ChrootChecker.cpp | 6 +- .../Checkers/ConversionChecker.cpp| 7 +- .../Checkers/DivZeroChecker.cpp | 16 ++-- .../Checkers/DynamicTypeChecker.cpp | 10 +-- .../Checkers/EnumCastOutOfRangeChecker.cpp| 8 +- .../Checkers/ExprInspectionChecker.cpp| 8 +- .../Checkers/FixedAddressChecker.cpp | 6 +- .../Checkers/LocalizationChecker.cpp | 12 +-- .../Checkers/MacOSKeychainAPIChecker.cpp | 22 ++--- .../Checkers/MacOSXAPIChecker.cpp | 10 +-- .../Checkers/MmapWriteExecChecker.cpp | 16 ++-- .../Checkers/NSAutoreleasePoolChecker.cpp | 9 +- .../Checkers/NonNullParamChecker.cpp | 21 ++--- .../Checkers/ObjCAtSyncChecker.cpp| 17 ++-- .../Checkers/ObjCContainersChecker.cpp| 11 +-- .../Checkers/ObjCSelfInitChecker.cpp | 9 +- .../Checkers/PaddingChecker.cpp | 9 +- .../Checkers/PointerArithChecker.cpp | 12 +-- .../Checkers/PointerSubChecker.cpp| 6 +- .../Checkers/ReturnPointerRangeChecker.cpp| 10 +-- .../Checkers/ReturnUndefChecker.cpp | 15 ++-- .../Checkers/StdLibraryFunctionsChecker.cpp | 8 +- .../Checkers/TestAfterDivZeroChecker.cpp | 10 +-- .../Checkers/UndefBranchChecker.cpp | 89 +-- .../Checkers/UndefCapturedBlockVarChecker.cpp | 8 +- .../Checkers/UndefResultChecker.cpp | 8 +- .../UndefinedArraySubscriptChecker.cpp| 7 +- .../Checkers/UndefinedAssignmentChecker.cpp | 11 +-- .../Checkers/UnixAPIChecker.cpp | 32 +++ .../Checkers/VLASizeChecker.cpp | 20 ++--- .../StaticAnalyzer/Checkers/VforkChecker.cpp | 7 +- .../Core/CommonBugCategories.cpp | 1 + .../NoStateChangeFuncVisitorTest.cpp | 7 +- 39 files changed, 171 insertions(+), 324 deletions(-) diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h index 5d2c96e5bc9de3..45187433c069fd 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h @@ -13,6 +13,7 @@ namespace clang { namespace ento { namespace categories { +extern const char *const AppleAPIMisuse; extern const char *const CoreFoundationObjectiveC; extern const char *const LogicError; extern const char *const MemoryRefCount; diff --git a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp index ce126541265551..c990ad138f8905 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp @@ -25,7 +25,7 @@ using namespace ento; namespace { class ArrayBoundChecker : public Checker { - mutable std::unique_ptr BT; + const BugType BT{this, "Out-of-bound array access"}; public: void checkLocation(SVal l, bool isLoad, const Stmt* S, @@ -65,16 +65,13 @@ void ArrayBoundChecker::checkLocation(SVal l, bool isLoad, const Stmt* LoadS, if (!N) return; -if (!BT) - BT.reset(new BugType(this, "Out-of-bound array access")); - // FIXME: It would be nice to eventually make this diagnostic more clear, // e.g., by referencing the original declaration or by saying *why* this // reference is outside the range. // Generate a report for this bug. auto report = std::make_unique( -*BT, "Access out-of-bound array element (buffer overflow)", N); +BT, "Access out-of-bound array element (buffer