Skip to content

Commit 502bcb4

Browse files
committed
[clang][modules] Remove the workaround for the lambda issue.
This code was originally introduced to fix issue llvm#110401. The issue was the same lambda problem, which has since been properly fixed by PR llvm#109167 and its follow-ups.
1 parent d39ca81 commit 502bcb4

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

clang/lib/AST/DeclCXX.cpp

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,36 +1702,7 @@ static NamedDecl* getLambdaCallOperatorHelper(const CXXRecordDecl &RD) {
17021702

17031703
assert(allLookupResultsAreTheSame(Calls) &&
17041704
"More than one lambda call operator!");
1705-
1706-
// FIXME: If we have multiple call operators, we might be in a situation
1707-
// where we merged this lambda with one from another module; in that
1708-
// case, return our method (instead of that of the other lambda).
1709-
//
1710-
// This avoids situations where, given two modules A and B, if we
1711-
// try to instantiate A's call operator in a function in B, anything
1712-
// in the call operator that relies on local decls in the surrounding
1713-
// function will crash because it tries to find A's decls, but we only
1714-
// instantiated B's:
1715-
//
1716-
// template <typename>
1717-
// void f() {
1718-
// using T = int; // We only instantiate B's version of this.
1719-
// auto L = [](T) { }; // But A's call operator would want A's here.
1720-
// }
1721-
//
1722-
// Walk the call operator’s redecl chain to find the one that belongs
1723-
// to this module.
1724-
//
1725-
// TODO: We need to fix this properly (see
1726-
// https://github.com/llvm/llvm-project/issues/90154).
1727-
Module *M = RD.getOwningModule();
1728-
for (Decl *D : Calls.front()->redecls()) {
1729-
auto *MD = cast<NamedDecl>(D);
1730-
if (MD->getOwningModule() == M)
1731-
return MD;
1732-
}
1733-
1734-
llvm_unreachable("Couldn't find our call operator!");
1705+
return Calls.front();
17351706
}
17361707

17371708
FunctionTemplateDecl* CXXRecordDecl::getDependentLambdaCallOperator() const {

0 commit comments

Comments
 (0)