Skip to content

Commit 47259b7

Browse files
committed
Remove name param from LookupConstructors
This parameter required the unscoped type name, but CppInterOp provides no way of getting that. After speaking with Vassil on Discord, he suggested this additional check may not actually be needed.
1 parent 5c1e27a commit 47259b7

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

include/clang/Interpreter/CppInterOp.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,12 @@ namespace Cpp {
418418

419419
/// Sets a list of all the constructor for a scope/class that is
420420
/// supplied as a parameter.
421-
///\param[in] name - This string is used as a constraint, that clients can use
422-
/// to ensure the constructors match the name that they provide
423421
///\param[in] parent - Pointer to the scope/class for which the constructors
424422
/// are being looked up
425423
/// to be retrieved
426424
///\param[out] funcs - vector of handles to all constructors found under the
427425
/// given scope
428-
CPPINTEROP_API void LookupConstructors(const std::string& name,
429-
TCppScope_t parent,
426+
CPPINTEROP_API void LookupConstructors(TCppScope_t parent,
430427
std::vector<TCppFunction_t>& funcs);
431428

432429
/// Sets a list of all the Templated Methods that are in the Class that is

lib/Interpreter/CppInterOp.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,19 +1043,15 @@ namespace Cpp {
10431043
}
10441044

10451045
// Looks up all constructors in the current DeclContext
1046-
void LookupConstructors(const std::string& name, TCppScope_t parent,
1046+
void LookupConstructors(TCppScope_t parent,
10471047
std::vector<TCppFunction_t>& funcs) {
10481048
auto* D = (Decl*)parent;
10491049

10501050
if (auto* CXXRD = llvm::dyn_cast_or_null<CXXRecordDecl>(D)) {
10511051
getSema().ForceDeclarationOfImplicitMembers(CXXRD);
10521052
DeclContextLookupResult Result = getSema().LookupConstructors(CXXRD);
1053-
// Obtaining all constructors when we intend to lookup a method under a
1054-
// scope can lead to crashes. We avoid that by accumulating constructors
1055-
// only if the Decl matches the lookup name.
10561053
for (auto* i : Result)
1057-
if (GetName(i) == name)
1058-
funcs.push_back(i);
1054+
funcs.push_back(i);
10591055
}
10601056
}
10611057

0 commit comments

Comments
 (0)