forked from OSchip/llvm-project
[NFC] Mark the parameter const for isSame* methods in ASTContext
This commit is contained in:
parent
3e98ce45b6
commit
8cc23bde26
|
@ -2616,23 +2616,32 @@ public:
|
|||
/// template name uses the shortest form of the dependent
|
||||
/// nested-name-specifier, which itself contains all canonical
|
||||
/// types, values, and templates.
|
||||
TemplateName getCanonicalTemplateName(TemplateName Name) const;
|
||||
TemplateName getCanonicalTemplateName(const TemplateName &Name) const;
|
||||
|
||||
/// Determine whether the given template names refer to the same
|
||||
/// template.
|
||||
bool hasSameTemplateName(TemplateName X, TemplateName Y);
|
||||
bool hasSameTemplateName(const TemplateName &X, const TemplateName &Y) const;
|
||||
|
||||
/// Determine whether the two declarations refer to the same entity.
|
||||
bool isSameEntity(NamedDecl *X, NamedDecl *Y);
|
||||
///
|
||||
/// FIXME: isSameEntity is not const due to its implementation calls
|
||||
/// hasSameFunctionTypeIgnoringExceptionSpec which may alter this.
|
||||
bool isSameEntity(const NamedDecl *X, const NamedDecl *Y);
|
||||
|
||||
/// Determine whether two template parameter lists are similar enough
|
||||
/// that they may be used in declarations of the same template.
|
||||
bool isSameTemplateParameterList(TemplateParameterList *X,
|
||||
TemplateParameterList *Y);
|
||||
///
|
||||
/// FIXME: isSameTemplateParameterList is not const since it calls
|
||||
/// isSameTemplateParameter.
|
||||
bool isSameTemplateParameterList(const TemplateParameterList *X,
|
||||
const TemplateParameterList *Y);
|
||||
|
||||
/// Determine whether two template parameters are similar enough
|
||||
/// that they may be used in declarations of the same template.
|
||||
bool isSameTemplateParameter(NamedDecl *X, NamedDecl *Y);
|
||||
///
|
||||
/// FIXME: isSameTemplateParameterList is not const since it calls
|
||||
/// isSameEntity.
|
||||
bool isSameTemplateParameter(const NamedDecl *X, const NamedDecl *Y);
|
||||
|
||||
/// Retrieve the "canonical" template argument.
|
||||
///
|
||||
|
|
|
@ -6099,7 +6099,8 @@ ASTContext::getNameForTemplate(TemplateName Name,
|
|||
llvm_unreachable("bad template name kind!");
|
||||
}
|
||||
|
||||
TemplateName ASTContext::getCanonicalTemplateName(TemplateName Name) const {
|
||||
TemplateName
|
||||
ASTContext::getCanonicalTemplateName(const TemplateName &Name) const {
|
||||
switch (Name.getKind()) {
|
||||
case TemplateName::QualifiedTemplate:
|
||||
case TemplateName::Template: {
|
||||
|
@ -6141,13 +6142,14 @@ TemplateName ASTContext::getCanonicalTemplateName(TemplateName Name) const {
|
|||
llvm_unreachable("bad template name!");
|
||||
}
|
||||
|
||||
bool ASTContext::hasSameTemplateName(TemplateName X, TemplateName Y) {
|
||||
X = getCanonicalTemplateName(X);
|
||||
Y = getCanonicalTemplateName(Y);
|
||||
return X.getAsVoidPointer() == Y.getAsVoidPointer();
|
||||
bool ASTContext::hasSameTemplateName(const TemplateName &X,
|
||||
const TemplateName &Y) const {
|
||||
return getCanonicalTemplateName(X).getAsVoidPointer() ==
|
||||
getCanonicalTemplateName(Y).getAsVoidPointer();
|
||||
}
|
||||
|
||||
bool ASTContext::isSameTemplateParameter(NamedDecl *X, NamedDecl *Y) {
|
||||
bool ASTContext::isSameTemplateParameter(const NamedDecl *X,
|
||||
const NamedDecl *Y) {
|
||||
if (X->getKind() != Y->getKind())
|
||||
return false;
|
||||
|
||||
|
@ -6198,8 +6200,8 @@ bool ASTContext::isSameTemplateParameter(NamedDecl *X, NamedDecl *Y) {
|
|||
TY->getTemplateParameters());
|
||||
}
|
||||
|
||||
bool ASTContext::isSameTemplateParameterList(TemplateParameterList *X,
|
||||
TemplateParameterList *Y) {
|
||||
bool ASTContext::isSameTemplateParameterList(const TemplateParameterList *X,
|
||||
const TemplateParameterList *Y) {
|
||||
if (X->size() != Y->size())
|
||||
return false;
|
||||
|
||||
|
@ -6302,7 +6304,7 @@ static bool hasSameOverloadableAttrs(const FunctionDecl *A,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ASTContext::isSameEntity(NamedDecl *X, NamedDecl *Y) {
|
||||
bool ASTContext::isSameEntity(const NamedDecl *X, const NamedDecl *Y) {
|
||||
if (X == Y)
|
||||
return true;
|
||||
|
||||
|
@ -6409,6 +6411,8 @@ bool ASTContext::isSameEntity(NamedDecl *X, NamedDecl *Y) {
|
|||
if (getLangOpts().CPlusPlus17 && XFPT && YFPT &&
|
||||
(isUnresolvedExceptionSpec(XFPT->getExceptionSpecType()) ||
|
||||
isUnresolvedExceptionSpec(YFPT->getExceptionSpecType())) &&
|
||||
// FIXME: We could make isSameEntity const after we make
|
||||
// hasSameFunctionTypeIgnoringExceptionSpec const.
|
||||
hasSameFunctionTypeIgnoringExceptionSpec(XT, YT))
|
||||
return true;
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue