Skip to content

Commit d488921

Browse files
committed
[clang][ssaf][NFC] Refactor implicit ctor decl search in a test
1 parent ffc5104 commit d488921

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

clang/unittests/Analysis/Scalable/ASTEntityMappingTest.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "clang/Analysis/Scalable/ASTEntityMapping.h"
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/AST/Decl.h"
12+
#include "clang/AST/DeclCXX.h"
1213
#include "clang/ASTMatchers/ASTMatchFinder.h"
1314
#include "clang/ASTMatchers/ASTMatchers.h"
1415
#include "clang/Tooling/Tooling.h"
@@ -107,13 +108,16 @@ TEST(ASTEntityMappingTest, ImplicitDecl) {
107108
ASSERT_NE(RD, nullptr);
108109

109110
// Find the implicitly-declared copy constructor
111+
const CXXConstructorDecl * ImplCtor = nullptr;
110112
for (const auto *Ctor : RD->ctors()) {
111113
if (Ctor->isCopyConstructor() && Ctor->isImplicit()) {
112-
auto EntityName = getLocalEntityNameForDecl(Ctor);
113-
EXPECT_FALSE(EntityName.has_value());
114-
return;
114+
ImplCtor = Ctor;
115+
break;
115116
}
116117
}
118+
119+
auto EntityName = getLocalEntityNameForDecl(ImplCtor);
120+
EXPECT_FALSE(EntityName.has_value());
117121
}
118122

119123
TEST(ASTEntityMappingTest, BuiltinFunction) {

0 commit comments

Comments
 (0)