summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2014-05-26 06:22:03 +0000
committerCraig Topper <craig.topper@gmail.com>2014-05-26 06:22:03 +0000
commit6b8c5857eb9d309f9adb9149d9f383a29a9b68e7 (patch)
tree56e8b6db6892b13eea6e33509cb7751501b94409 /lib/Sema/SemaTemplate.cpp
parentb0449def46f3e7efc8dd134ac68ce71399ba6573 (diff)
[C++11] Use 'nullptr'. Sema edition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r--lib/Sema/SemaTemplate.cpp132
1 files changed, 68 insertions, 64 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index af80f1a5f6..272c811783 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -52,8 +52,8 @@ static NamedDecl *isAcceptableTemplateName(ASTContext &Context,
if (isa<TemplateDecl>(D)) {
if (!AllowFunctionTemplates && isa<FunctionTemplateDecl>(D))
- return 0;
-
+ return nullptr;
+
return Orig;
}
@@ -79,10 +79,10 @@ static NamedDecl *isAcceptableTemplateName(ASTContext &Context,
return Spec->getSpecializedTemplate();
}
- return 0;
+ return nullptr;
}
- return 0;
+ return nullptr;
}
void Sema::FilterAcceptableTemplateNames(LookupResult &R,
@@ -250,7 +250,7 @@ void Sema::LookupTemplateName(LookupResult &Found,
bool &MemberOfUnknownSpecialization) {
// Determine where to perform name lookup
MemberOfUnknownSpecialization = false;
- DeclContext *LookupCtx = 0;
+ DeclContext *LookupCtx = nullptr;
bool isDependent = false;
if (!ObjectType.isNull()) {
// This nested-name-specifier occurs in a member access expression, e.g.,
@@ -419,10 +419,10 @@ Sema::ActOnDependentIdExpression(const CXXScopeSpec &SS,
// Since the 'this' expression is synthesized, we don't need to
// perform the double-lookup check.
- NamedDecl *FirstQualifierInScope = 0;
+ NamedDecl *FirstQualifierInScope = nullptr;
return Owned(CXXDependentScopeMemberExpr::Create(Context,
- /*This*/ 0, ThisType,
+ /*This*/ nullptr, ThisType,
/*IsArrow*/ true,
/*Op*/ SourceLocation(),
SS.getWithLocInContext(Context),
@@ -475,7 +475,7 @@ TemplateDecl *Sema::AdjustDeclIfTemplate(Decl *&D) {
D = Temp->getTemplatedDecl();
return Temp;
}
- return 0;
+ return nullptr;
}
ParsedTemplateArgument ParsedTemplateArgument::getTemplatePackExpansion(
@@ -716,7 +716,7 @@ Decl *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
// template-parameter that is not a template parameter pack.
if (Default && IsParameterPack) {
Diag(EqualLoc, diag::err_template_param_pack_default_arg);
- Default = 0;
+ Default = nullptr;
}
// Check the well-formedness of the default template argument, if provided.
@@ -907,7 +907,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
if (Previous.isAmbiguous())
return true;
- NamedDecl *PrevDecl = 0;
+ NamedDecl *PrevDecl = nullptr;
if (Previous.begin() != Previous.end())
PrevDecl = (*Previous.begin())->getUnderlyingDecl();
@@ -950,7 +950,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
// Declarations in outer scopes don't matter. However, the outermost
// context we computed is the semantic context for our new
// declaration.
- PrevDecl = PrevClassTemplate = 0;
+ PrevDecl = PrevClassTemplate = nullptr;
SemanticContext = OutermostContext;
// Check that the chosen semantic context doesn't already contain a
@@ -971,7 +971,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
}
} else if (PrevDecl &&
!isDeclInScope(PrevDecl, SemanticContext, S, SS.isValid()))
- PrevDecl = PrevClassTemplate = 0;
+ PrevDecl = PrevClassTemplate = nullptr;
if (PrevClassTemplate) {
// Ensure that the template parameter lists are compatible. Skip this check
@@ -1013,7 +1013,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
// Maybe we will complain about the shadowed template parameter.
DiagnoseTemplateParameterShadow(NameLoc, PrevDecl);
// Just pretend that we didn't see the previous declaration.
- PrevDecl = 0;
+ PrevDecl = nullptr;
} else if (PrevDecl) {
// C++ [temp]p5:
// A class template shall not have the same name as any other
@@ -1032,7 +1032,8 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
if (!(TUK == TUK_Friend && CurContext->isDependentContext()) &&
CheckTemplateParameterList(
TemplateParams,
- PrevClassTemplate ? PrevClassTemplate->getTemplateParameters() : 0,
+ PrevClassTemplate ? PrevClassTemplate->getTemplateParameters()
+ : nullptr,
(SS.isSet() && SemanticContext && SemanticContext->isRecord() &&
SemanticContext->isDependentContext())
? TPC_ClassTemplateMember
@@ -1054,7 +1055,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
CXXRecordDecl *NewClass =
CXXRecordDecl::Create(Context, Kind, SemanticContext, KWLoc, NameLoc, Name,
PrevClassTemplate?
- PrevClassTemplate->getTemplatedDecl() : 0,
+ PrevClassTemplate->getTemplatedDecl() : nullptr,
/*DelayTypeCreation=*/true);
SetNestedNameSpecifier(NewClass, SS);
if (NumOuterTemplateParamLists > 0)
@@ -1301,7 +1302,7 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
// Merge default arguments for template type parameters.
TemplateTypeParmDecl *OldTypeParm
- = OldParams? cast<TemplateTypeParmDecl>(*OldParam) : 0;
+ = OldParams? cast<TemplateTypeParmDecl>(*OldParam) : nullptr;
if (NewTypeParm->isParameterPack()) {
assert(!NewTypeParm->hasDefaultArgument() &&
@@ -1346,7 +1347,7 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
// Merge default arguments for non-type template parameters
NonTypeTemplateParmDecl *OldNonTypeParm
- = OldParams? cast<NonTypeTemplateParmDecl>(*OldParam) : 0;
+ = OldParams? cast<NonTypeTemplateParmDecl>(*OldParam) : nullptr;
if (NewNonTypeParm->isParameterPack()) {
assert(!NewNonTypeParm->hasDefaultArgument() &&
"Parameter packs can't have a default argument!");
@@ -1393,7 +1394,7 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
// Merge default arguments for template template parameters
TemplateTemplateParmDecl *OldTemplateParm
- = OldParams? cast<TemplateTemplateParmDecl>(*OldParam) : 0;
+ = OldParams? cast<TemplateTemplateParmDecl>(*OldParam) : nullptr;
if (NewTemplateParm->isParameterPack()) {
assert(!NewTemplateParm->hasDefaultArgument() &&
"Parameter packs can't have a default argument!");
@@ -1766,7 +1767,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
// For a dependent type, the set of template parameters that we
// expect to see.
- TemplateParameterList *ExpectedTemplateParams = 0;
+ TemplateParameterList *ExpectedTemplateParams = nullptr;
// C++0x [temp.expl.spec]p15:
// A member or a member template may be nested within many enclosing
@@ -1825,7 +1826,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
if (ParamLists[ParamIdx]->size() == 0) {
if (CheckExplicitSpecialization(ParamLists[ParamIdx]->getSourceRange(),
false))
- return 0;
+ return nullptr;
} else
SawNonEmptyTemplateParameterList = true;
}
@@ -1846,7 +1847,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
ParamLists[ParamIdx]->getRAngleLoc())
<< getRangeOfTypeInNestedNameSpecifier(Context, T, SS);
Invalid = true;
- return 0;
+ return nullptr;
}
// Consume this template header.
@@ -1857,7 +1858,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
if (!IsFriend)
if (DiagnoseMissingExplicitSpecialization(
getRangeOfTypeInNestedNameSpecifier(Context, T, SS)))
- return 0;
+ return nullptr;
continue;
}
@@ -1870,7 +1871,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
if (IsFriend && T->isDependentType()) {
if (ParamIdx < ParamLists.size() &&
DependsOnTemplateParameters(T, ParamLists[ParamIdx]))
- ExpectedTemplateParams = 0;
+ ExpectedTemplateParams = nullptr;
else
continue;
}
@@ -1882,9 +1883,9 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
ExpectedTemplateParams,
true, TPL_TemplateMatch))
Invalid = true;
-
+
if (!Invalid &&
- CheckTemplateParameterList(ParamLists[ParamIdx], 0,
+ CheckTemplateParameterList(ParamLists[ParamIdx], nullptr,
TPC_ClassTemplateMember))
Invalid = true;
@@ -1913,11 +1914,11 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
// Fabricate an empty template parameter list for the invented header.
return TemplateParameterList::Create(Context, SourceLocation(),
- SourceLocation(), 0, 0,
+ SourceLocation(), nullptr, 0,
SourceLocation());
}
- return 0;
+ return nullptr;
}
// If there were too many template parameter lists, complain about that now.
@@ -1962,7 +1963,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
if (ParamLists.back()->size() == 0 &&
CheckExplicitSpecialization(ParamLists[ParamIdx]->getSourceRange(),
false))
- return 0;
+ return nullptr;
// Return the last template parameter list, which corresponds to the
// entity being declared.
@@ -2122,7 +2123,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
= dyn_cast<ClassTemplateDecl>(Template)) {
// Find the class template specialization declaration that
// corresponds to these arguments.
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
ClassTemplateSpecializationDecl *Decl
= ClassTemplate->findSpecialization(Converted.data(), Converted.size(),
InsertPos);
@@ -2137,7 +2138,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
ClassTemplate->getLocation(),
ClassTemplate,
Converted.data(),
- Converted.size(), 0);
+ Converted.size(), nullptr);
ClassTemplate->AddSpecialization(Decl, InsertPos);
if (ClassTemplate->isOutOfLine())
Decl->setLexicalDeclContext(ClassTemplate->getLexicalDeclContext());
@@ -2500,8 +2501,8 @@ DeclResult Sema::ActOnVarTemplateSpecialization(
}
}
- void *InsertPos = 0;
- VarTemplateSpecializationDecl *PrevDecl = 0;
+ void *InsertPos = nullptr;
+ VarTemplateSpecializationDecl *PrevDecl = nullptr;
if (IsPartialSpecialization)
// FIXME: Template parameter list matters too
@@ -2511,7 +2512,7 @@ DeclResult Sema::ActOnVarTemplateSpecialization(
PrevDecl = VarTemplate->findSpecialization(Converted.data(),
Converted.size(), InsertPos);
- VarTemplateSpecializationDecl *Specialization = 0;
+ VarTemplateSpecializationDecl *Specialization = nullptr;
// Check whether we can declare a variable template specialization in
// the current scope.
@@ -2527,7 +2528,7 @@ DeclResult Sema::ActOnVarTemplateSpecialization(
// the list of outer template parameters to reflect our new declaration.
Specialization = PrevDecl;
Specialization->setLocation(TemplateNameLoc);
- PrevDecl = 0;
+ PrevDecl = nullptr;
} else if (IsPartialSpecialization) {
// Create a new class template partial specialization declaration node.
VarTemplatePartialSpecializationDecl *PrevPartial =
@@ -2672,7 +2673,7 @@ Sema::CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc,
// Find the variable template specialization declaration that
// corresponds to these arguments.
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
if (VarTemplateSpecializationDecl *Spec = Template->findSpecialization(
Converted.data(), Converted.size(), InsertPos))
// If we already have a variable template specialization, return it.
@@ -2825,7 +2826,7 @@ Sema::CheckVarTemplateId(const CXXScopeSpec &SS,
// Build an ordinary singleton decl ref.
return BuildDeclarationNameExpr(SS, NameInfo, Var,
- /*FoundD=*/0, TemplateArgs);
+ /*FoundD=*/nullptr, TemplateArgs);
}
ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
@@ -2887,7 +2888,7 @@ Sema::BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS,
bool MemberOfUnknownSpecialization;
LookupResult R(*this, NameInfo, LookupOrdinaryName);
- LookupTemplateName(R, (Scope*) 0, SS, QualType(), /*Entering*/ false,
+ LookupTemplateName(R, (Scope*)nullptr, SS, QualType(), /*Entering*/ false,
MemberOfUnknownSpecialization);
if (R.isAmbiguous())
@@ -2931,7 +2932,7 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S,
diag::ext_template_outside_of_template)
<< FixItHint::CreateRemoval(TemplateKWLoc);
- DeclContext *LookupCtx = 0;
+ DeclContext *LookupCtx = nullptr;
if (SS.isSet())
LookupCtx = computeDeclContext(SS, EnteringContext);
if (!LookupCtx && ObjectType)
@@ -3133,7 +3134,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef,
Template, Converted,
SourceRange(TemplateLoc, RAngleLoc));
if (Inst.isInvalid())
- return 0;
+ return nullptr;
TemplateArgumentList TemplateArgs(TemplateArgumentList::OnStack,
Converted.data(), Converted.size());
@@ -3454,7 +3455,8 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param,
ExprResult E = Owned(DependentScopeDeclRefExpr::Create(Context,
SS.getWithLocInContext(Context),
TemplateKWLoc,
- NameInfo, 0));
+ NameInfo,
+ nullptr));
// If we parsed the template argument as a pack expansion, create a
// pack expansion expression.
@@ -4630,7 +4632,7 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
// template-parameter shall be one of: [...]
//
// -- a pointer to member expressed as described in 5.3.1.
- DeclRefExpr *DRE = 0;
+ DeclRefExpr *DRE = nullptr;
// In C++98/03 mode, give an extension warning on any extra parentheses.
// See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#773
@@ -4657,7 +4659,7 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
if (UnOp->getOpcode() == UO_AddrOf) {
DRE = dyn_cast<DeclRefExpr>(UnOp->getSubExpr());
if (DRE && !DRE->getQualifier())
- DRE = 0;
+ DRE = nullptr;
}
}
// A constant of pointer-to-member type.
@@ -4676,7 +4678,7 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
}
}
- DRE = 0;
+ DRE = nullptr;
}
if (!DRE)
@@ -5161,7 +5163,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
QualType ClassType
= Context.getTypeDeclType(cast<RecordDecl>(VD->getDeclContext()));
NestedNameSpecifier *Qualifier
- = NestedNameSpecifier::Create(Context, 0, false,
+ = NestedNameSpecifier::Create(Context, nullptr, false,
ClassType.getTypePtr());
CXXScopeSpec SS;
SS.MakeTrivial(Context, Qualifier, Loc);
@@ -5287,7 +5289,8 @@ Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg,
if (OrigT->isEnumeralType()) {
// FIXME: This is a hack. We need a better way to handle substituted
// non-type template parameters.
- E = CStyleCastExpr::Create(Context, OrigT, VK_RValue, CK_IntegralCast, E, 0,
+ E = CStyleCastExpr::Create(Context, OrigT, VK_RValue, CK_IntegralCast, E,
+ nullptr,
Context.getTrivialTypeSourceInfo(OrigT, Loc),
Loc, Loc);
}
@@ -6040,8 +6043,8 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
}
}
- void *InsertPos = 0;
- ClassTemplateSpecializationDecl *PrevDecl = 0;
+ void *InsertPos = nullptr;
+ ClassTemplateSpecializationDecl *PrevDecl = nullptr;
if (isPartialSpecialization)
// FIXME: Template parameter list matters, too
@@ -6054,7 +6057,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
= ClassTemplate->findSpecialization(Converted.data(),
Converted.size(), InsertPos);
- ClassTemplateSpecializationDecl *Specialization = 0;
+ ClassTemplateSpecializationDecl *Specialization = nullptr;
// Check whether we can declare a class template specialization in
// the current scope.
@@ -6291,7 +6294,7 @@ Decl *Sema::ActOnTemplateDeclarator(Scope *S,
Decl *Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
MultiTemplateParamsArg TemplateParameterLists,
Declarator &D) {
- assert(getCurFunctionDecl() == 0 && "Function parsing confused");
+ assert(getCurFunctionDecl() == nullptr && "Function parsing confused");
DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo();
if (FTI.hasPrototype) {
@@ -6628,7 +6631,7 @@ bool Sema::CheckFunctionTemplateSpecialization(
// specializing this template.
// FIXME: It is somewhat wasteful to build
TemplateDeductionInfo Info(FailedCandidates.getLocation());
- FunctionDecl *Specialization = 0;
+ FunctionDecl *Specialization = nullptr;
if (TemplateDeductionResult TDK = DeduceTemplateArguments(
cast<FunctionTemplateDecl>(FunTmpl->getFirstDecl()),
ExplicitTemplateArgs, FT, Specialization, Info)) {
@@ -6652,7 +6655,7 @@ bool Sema::CheckFunctionTemplateSpecialization(
FD->getLocation(),
PDiag(diag::err_function_template_spec_no_match) << FD->getDeclName(),
PDiag(diag::err_function_template_spec_ambiguous)
- << FD->getDeclName() << (ExplicitTemplateArgs != 0),
+ << FD->getDeclName() << (ExplicitTemplateArgs != nullptr),
PDiag(diag::note_function_template_spec_matched));
if (Result == Candidates.end())
@@ -6721,7 +6724,7 @@ bool Sema::CheckFunctionTemplateSpecialization(
const TemplateArgumentList* TemplArgs = new (Context)
TemplateArgumentList(Specialization->getTemplateSpecializationArgs());
FD->setFunctionTemplateSpecialization(Specialization->getPrimaryTemplate(),
- TemplArgs, /*InsertPos=*/0,
+ TemplArgs, /*InsertPos=*/nullptr,
SpecInfo->getTemplateSpecializationKind(),
ExplicitTemplateArgs);
@@ -6751,9 +6754,9 @@ Sema::CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous) {
assert(!isa<TemplateDecl>(Member) && "Only for non-template members");
// Try to find the member we are instantiating.
- NamedDecl *Instantiation = 0;
- NamedDecl *InstantiatedFrom = 0;
- MemberSpecializationInfo *MSInfo = 0;
+ NamedDecl *Instantiation = nullptr;
+ NamedDecl *InstantiatedFrom = nullptr;
+ MemberSpecializationInfo *MSInfo = nullptr;
if (Previous.empty()) {
// Nowhere to look anyway.
@@ -7060,7 +7063,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
// Find the class template specialization declaration that
// corresponds to these arguments.
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
ClassTemplateSpecializationDecl *PrevDecl
= ClassTemplate->findSpecialization(Converted.data(),
Converted.size(), InsertPos);
@@ -7077,7 +7080,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
SS.isSet()))
return true;
- ClassTemplateSpecializationDecl *Specialization = 0;
+ ClassTemplateSpecializationDecl *Specialization = nullptr;
bool HasNoEffect = false;
if (PrevDecl) {
@@ -7099,7 +7102,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
// (Other source locations will be updated later.)
Specialization = PrevDecl;
Specialization->setLocation(TemplateNameLoc);
- PrevDecl = 0;
+ PrevDecl = nullptr;
}
}
@@ -7516,7 +7519,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
}
// FIXME: Create an ExplicitInstantiation node?
- return (Decl*) 0;
+ return (Decl*) nullptr;
}
// If the declarator is a template-id, translate the parser's template
@@ -7556,10 +7559,11 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
continue;
TemplateDeductionInfo Info(FailedCandidates.getLocation());
- FunctionDecl *Specialization = 0;
+ FunctionDecl *Specialization = nullptr;
if (TemplateDeductionResult TDK
= DeduceTemplateArguments(FunTmpl,
- (HasExplicitTemplateArgs ? &TemplateArgs : 0),
+ (HasExplicitTemplateArgs ? &TemplateArgs
+ : nullptr),
R, Specialization, Info)) {
// Keep track of almost-matches.
FailedCandidates.addCandidate()
@@ -7612,7 +7616,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
// FIXME: We may still want to build some representation of this
// explicit specialization.
if (HasNoEffect)
- return (Decl*) 0;
+ return (Decl*) nullptr;
}
Specialization->setTemplateSpecializationKind(TSK, D.getIdentifierLoc());
@@ -7649,7 +7653,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
D.getCXXScopeSpec().isSet());
// FIXME: Create some kind of ExplicitInstantiationDecl here.
- return (Decl*) 0;
+ return (Decl*) nullptr;
}
TypeResult
@@ -7861,7 +7865,7 @@ Sema::CheckTypenameType(ElaboratedTypeKeyword Keyword,
LookupResult Result(*this, Name, IILoc, LookupOrdinaryName);
LookupQualifiedName(Result, Ctx);
unsigned DiagID = 0;
- Decl *Referenced = 0;
+ Decl *Referenced = nullptr;
switch (Result.getResultKind()) {
case LookupResult::NotFound: {
// If we're looking up 'type' within a template named 'enable_if', produce