Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/AST/ASTContext.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 6,613 Lines • ▼ Show 20 Lines | if (const auto *FuncX = dyn_cast<FunctionDecl>(X)) { | ||||
// not the same entity if they are constrained. | // not the same entity if they are constrained. | ||||
if ((FuncX->isMemberLikeConstrainedFriend() || | if ((FuncX->isMemberLikeConstrainedFriend() || | ||||
FuncY->isMemberLikeConstrainedFriend()) && | FuncY->isMemberLikeConstrainedFriend()) && | ||||
!FuncX->getLexicalDeclContext()->Equals( | !FuncX->getLexicalDeclContext()->Equals( | ||||
FuncY->getLexicalDeclContext())) { | FuncY->getLexicalDeclContext())) { | ||||
return false; | return false; | ||||
} | } | ||||
// The trailing require clause of instantiated function may change during | if (!isSameConstraintExpr(FuncX->getTrailingRequiresClause(), | ||||
// the semantic analysis. Trying to get the primary template function (if | FuncY->getTrailingRequiresClause())) | ||||
// exists) to compare the primary trailing require clause. | |||||
auto TryToGetPrimaryTemplatedFunction = | |||||
[](const FunctionDecl *FD) -> const FunctionDecl * { | |||||
switch (FD->getTemplatedKind()) { | |||||
case FunctionDecl::TK_DependentNonTemplate: | |||||
return FD->getInstantiatedFromDecl(); | |||||
case FunctionDecl::TK_FunctionTemplate: | |||||
return FD->getDescribedFunctionTemplate()->getTemplatedDecl(); | |||||
case FunctionDecl::TK_MemberSpecialization: | |||||
return FD->getInstantiatedFromMemberFunction(); | |||||
case FunctionDecl::TK_FunctionTemplateSpecialization: | |||||
return FD->getPrimaryTemplate()->getTemplatedDecl(); | |||||
default: | |||||
return FD; | |||||
} | |||||
}; | |||||
const FunctionDecl *PrimaryX = TryToGetPrimaryTemplatedFunction(FuncX); | |||||
const FunctionDecl *PrimaryY = TryToGetPrimaryTemplatedFunction(FuncY); | |||||
if (!isSameConstraintExpr(PrimaryX->getTrailingRequiresClause(), | |||||
PrimaryY->getTrailingRequiresClause())) | |||||
return false; | return false; | ||||
auto GetTypeAsWritten = [](const FunctionDecl *FD) { | auto GetTypeAsWritten = [](const FunctionDecl *FD) { | ||||
// Map to the first declaration that we've already merged into this one. | // Map to the first declaration that we've already merged into this one. | ||||
// The TSI of redeclarations might not match (due to calling conventions | // The TSI of redeclarations might not match (due to calling conventions | ||||
// being inherited onto the type but not the TSI), but the TSI type of | // being inherited onto the type but not the TSI), but the TSI type of | ||||
// the first declaration of the function should match across modules. | // the first declaration of the function should match across modules. | ||||
FD = FD->getCanonicalDecl(); | FD = FD->getCanonicalDecl(); | ||||
▲ Show 20 Lines • Show All 6,874 Lines • Show Last 20 Lines |