aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/APIntTest.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-09-27 09:05:08 -0700
committerGitHub <noreply@github.com>2025-09-27 09:05:08 -0700
commit3163fcfa453dce61aa06da05272a660b18407623 (patch)
tree8e58995be22d2cfeaab568989413529a724afff5 /llvm/unittests/ADT/APIntTest.cpp
parent54beb58ae6a6e93a9da2e1cf219e2f37df535084 (diff)
downloadllvm-3163fcfa453dce61aa06da05272a660b18407623.zip
llvm-3163fcfa453dce61aa06da05272a660b18407623.tar.gz
llvm-3163fcfa453dce61aa06da05272a660b18407623.tar.bz2
[ADT] Add [[nodiscard]] to set/map classes (NFC) (#160978)
This patch adds [[nodiscard]] to user-facing functions in set/map classes if they are: - const and return non-void values (e.g., size()), or - non-const and have no side effects (e.g., find()).
Diffstat (limited to 'llvm/unittests/ADT/APIntTest.cpp')
-rw-r--r--llvm/unittests/ADT/APIntTest.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp
index 116693c..ca9f9f1 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -3718,8 +3718,9 @@ TEST(APIntTest, ScaleBitMask) {
TEST(APIntTest, DenseMap) {
DenseMap<APInt, int> Map;
APInt ZeroWidthInt(0, 0, false);
- Map.insert({ZeroWidthInt, 0});
- Map.find(ZeroWidthInt);
+ Map.insert({ZeroWidthInt, 123});
+ auto It = Map.find(ZeroWidthInt);
+ EXPECT_EQ(It->second, 123);
}
TEST(APIntTest, TryExt) {