[clang] [llvm] [analyzer][NFC] Remove "V2" from ArrayBoundCheckerV2.cpp (PR #126094)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 7 03:52:40 PST 2025
https://github.com/NagyDonat updated https://github.com/llvm/llvm-project/pull/126094
>From 7440c102ba71485c2982aa160c961c163a3da5be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Don=C3=A1t=20Nagy?= <donat.nagy at ericsson.com>
Date: Thu, 6 Feb 2025 18:26:56 +0100
Subject: [PATCH 1/3] [analyzer][NFC] Remove "V2" from ArrayBoundCheckerV2.cpp
Previously commit 6e17ed9b04e5523cc910bf171c3122dcc64b86db
deleted the obsolete checker `alpha.security.ArrayBound` which was
implemented in `ArrayBoundChecker.cpp` and renamed the checker
`alpha.security.ArrayBoundV2` to `security.ArrayBound`.
This commit concludes that consolidation by renaming the source file
`ArrayBoundCheckerV2.cpp` to `ArrayBoundChecker.cpp` (which was "freed
up" by the previous commit).
---
.../{ArrayBoundCheckerV2.cpp => ArrayBoundChecker.cpp} | 8 +-------
clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt | 2 +-
.../secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn | 2 +-
3 files changed, 3 insertions(+), 9 deletions(-)
rename clang/lib/StaticAnalyzer/Checkers/{ArrayBoundCheckerV2.cpp => ArrayBoundChecker.cpp} (98%)
diff --git a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
similarity index 98%
rename from clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
rename to clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
index 6f8d6dbd573f403..4c582f7bcf8c5c4 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
@@ -1,4 +1,4 @@
-//== ArrayBoundCheckerV2.cpp ------------------------------------*- C++ -*--==//
+//== ArrayBoundChecker.cpp --------------------------------------*- C++ -*--==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -11,12 +11,6 @@
//
//===----------------------------------------------------------------------===//
-// NOTE: The name of this file ends with "V2" because previously
-// "ArrayBoundChecker.cpp" contained the implementation of another (older and
-// simpler) checker that was called `alpha.security.ArrayBound`.
-// TODO: Rename this file to "ArrayBoundChecker.cpp" when it won't be confused
-// with that older file.
-
#include "clang/AST/CharUnits.h"
#include "clang/AST/ParentMapContext.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
diff --git a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
index ccff5d0ac3b9649..591004344098781 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
+++ b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
@@ -7,7 +7,7 @@ set(LLVM_LINK_COMPONENTS
add_clang_library(clangStaticAnalyzerCheckers
AnalysisOrderChecker.cpp
AnalyzerStatsChecker.cpp
- ArrayBoundCheckerV2.cpp
+ ArrayBoundChecker.cpp
BasicObjCFoundationChecks.cpp
BitwiseShiftChecker.cpp
BlockInCriticalSectionChecker.cpp
diff --git a/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn b/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
index c1bba99be3ba5c3..d9c32575366399b 100644
--- a/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Checkers/BUILD.gn
@@ -16,7 +16,7 @@ static_library("Checkers") {
sources = [
"AnalysisOrderChecker.cpp",
"AnalyzerStatsChecker.cpp",
- "ArrayBoundCheckerV2.cpp",
+ "ArrayBoundChecker.cpp",
"BasicObjCFoundationChecks.cpp",
"BitwiseShiftChecker.cpp",
"BlockInCriticalSectionChecker.cpp",
>From 860f9ab089a9f634069ccb799ff01ed6c4ba7d7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Don=C3=A1t=20Nagy?= <donat.nagy at ericsson.com>
Date: Fri, 7 Feb 2025 10:32:26 +0100
Subject: [PATCH 2/3] Remove '*- C++ -*' from the file header
Co-authored-by: Balazs Benics <benicsbalazs at gmail.com>
---
clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
index 4c582f7bcf8c5c4..1e842db118cfa48 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
@@ -1,4 +1,4 @@
-//== ArrayBoundChecker.cpp --------------------------------------*- C++ -*--==//
+//== ArrayBoundChecker.cpp -------------------------------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
>From 1c7ae15f77f3b2727db47d26fe68e9db8343369d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Don=C3=A1t=20Nagy?= <donat.nagy at ericsson.com>
Date: Fri, 7 Feb 2025 12:52:13 +0100
Subject: [PATCH 3/3] Satisfy git-clang-format in renamed file
---
clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
index 1e842db118cfa48..109faacf1726ab4 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
@@ -291,7 +291,8 @@ static std::pair<ProgramStateRef, ProgramStateRef>
compareValueToThreshold(ProgramStateRef State, NonLoc Value, NonLoc Threshold,
SValBuilder &SVB, bool CheckEquality = false) {
if (auto ConcreteThreshold = Threshold.getAs<nonloc::ConcreteInt>()) {
- std::tie(Value, Threshold) = getSimplifiedOffsets(Value, *ConcreteThreshold, SVB);
+ std::tie(Value, Threshold) =
+ getSimplifiedOffsets(Value, *ConcreteThreshold, SVB);
}
// We want to perform a _mathematical_ comparison between the numbers `Value`
More information about the cfe-commits
mailing list