summaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-10-11 21:39:06 -0700
committerAmir Ayupov <aaupov@fb.com>2024-10-11 21:39:06 -0700
commit436701d88c1384d3f72c44dd152cd55e47ef2de3 (patch)
treec9825a370f1ba14e5fff19cea1279a0e7a7e9b54 /clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp
parentefa1900174cb940f3750ce9e8cb6f06e69b4f3f0 (diff)
parentdd326b122506421aba2368053103767f4c56e2ba (diff)
[𝘀𝗽𝗿] changes introduced through rebaseusers/aaupov/spr/main.boltnfc-speedup-batwritemaps
Created using spr 1.3.4 [skip ci]
Diffstat (limited to 'clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp
index d77df50f8fea..080454287f28 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp
@@ -146,12 +146,13 @@ void ForwardDeclarationNamespaceCheck::onEndOfTranslationUnit() {
}
// Check if a definition in another namespace exists.
const auto DeclName = CurDecl->getName();
- if (!DeclNameToDefinitions.contains(DeclName)) {
+ auto It = DeclNameToDefinitions.find(DeclName);
+ if (It == DeclNameToDefinitions.end()) {
continue; // No definition in this translation unit, we can skip it.
}
// Make a warning for each definition with the same name (in other
// namespaces).
- const auto &Definitions = DeclNameToDefinitions[DeclName];
+ const auto &Definitions = It->second;
for (const auto *Def : Definitions) {
diag(CurDecl->getLocation(),
"no definition found for %0, but a definition with "