Skip to content

Commit be7f3f0

Browse files
committed
[FOLD] cleanup
1 parent f428012 commit be7f3f0

File tree

1 file changed

+7
-56
lines changed

1 file changed

+7
-56
lines changed

clang/lib/Sema/SemaExprMember.cpp

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -675,16 +675,6 @@ static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
675675
CXXScopeSpec &SS, bool HasTemplateArgs,
676676
SourceLocation TemplateKWLoc,
677677
TypoExpr *&TE) {
678-
#if 0
679-
DeclContext *DC = SemaRef.computeDeclContext(RTy);
680-
// If the object expression is dependent and isn't the current instantiation,
681-
// lookup will not find anything and we must defer until instantiation.
682-
if (!DC) {
683-
R.setNotFoundInCurrentInstantiation();
684-
return false;
685-
}
686-
#endif
687-
688678
// FIXME: Should this use Name.isDependentName()?
689679
if (DeclarationName Name = R.getLookupName();
690680
Name.getNameKind() == DeclarationName::CXXConversionFunctionName &&
@@ -712,49 +702,18 @@ static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
712702
MOUS,
713703
TemplateKWLoc);
714704
}
715-
#if 1
716-
SemaRef.LookupParsedName(R, /*S=*/nullptr, &SS, ObjectType);
717-
#else
718-
if (SS.isSet()) {
719-
// If the member name was a qualified-id, look into the
720-
// nested-name-specifier.
721-
DC = SemaRef.computeDeclContext(SS, false);
722-
// We tried to look into a dependent context that is not the current
723-
// instantiation. Defer lookup until instantiation.
724-
if (!DC) {
725-
R.setNotFoundInCurrentInstantiation();
726-
return false;
727-
}
728-
729-
if (SemaRef.RequireCompleteDeclContext(SS, DC)) {
730-
SemaRef.Diag(SS.getRange().getEnd(), diag::err_typecheck_incomplete_tag)
731-
<< SS.getRange() << DC;
732-
return true;
733-
}
734-
735-
assert(DC && "Cannot handle non-computable dependent contexts in lookup");
736-
737-
if (!isa<TypeDecl>(DC)) {
738-
SemaRef.Diag(R.getNameLoc(), diag::err_qualified_member_nonclass)
739-
<< DC << SS.getRange();
740-
return true;
741-
}
742-
}
743705

744-
// The record definition is complete, now look up the member.
745-
SemaRef.LookupQualifiedName(R, DC, SS);
746-
#endif
706+
SemaRef.LookupParsedName(R, /*S=*/nullptr, &SS, ObjectType);
747707

748708
if (!R.empty() || R.wasNotFoundInCurrentInstantiation())
749709
return false;
750710

751711
DeclarationName Typo = R.getLookupName();
752712
SourceLocation TypoLoc = R.getNameLoc();
753-
#if 1
713+
// Recompute the lookup context.
754714
DeclContext *DC = SS.isSet()
755715
? SemaRef.computeDeclContext(SS)
756716
: SemaRef.computeDeclContext(RTy);
757-
#endif
758717

759718
struct QueryState {
760719
Sema &SemaRef;
@@ -1016,7 +975,11 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
1016975
ActOnMemberAccessExtraArgs *ExtraArgs) {
1017976
assert(!SS.isInvalid() && "nested-name-specifier cannot be invalid");
1018977
if (R.wasNotFoundInCurrentInstantiation() ||
978+
#if 0
1019979
(SS.isValid() && !computeDeclContext(SS, false))) {
980+
#else
981+
false) {
982+
#endif
1020983
return ActOnDependentMemberExpr(BaseExpr, BaseExprType, IsArrow, OpLoc, SS,
1021984
TemplateKWLoc, FirstQualifierInScope,
1022985
R.getLookupNameInfo(), TemplateArgs);
@@ -1060,8 +1023,6 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
10601023
// Rederive where we looked up.
10611024
DeclContext *DC = (SS.isSet() ? computeDeclContext(SS, false)
10621025
: computeDeclContext(BaseType));
1063-
// : BaseType->getAsRecordDecl());
1064-
10651026
if (ExtraArgs) {
10661027
ExprResult RetryExpr;
10671028
if (!IsArrow && BaseExpr && !BaseExpr->isTypeDependent()) {
@@ -1087,7 +1048,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
10871048
}
10881049
}
10891050

1090-
if (SS.isInvalid() || (SS.isNotEmpty() && !DC)) {
1051+
if (SS.isNotEmpty() && !DC) {
10911052
Diag(R.getNameLoc(), diag::err_undeclared_use)
10921053
<< MemberName << SS.getRange();
10931054
} else if (DC) {
@@ -1100,16 +1061,6 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
11001061
<< MemberName << BaseExprType
11011062
<< (BaseExpr ? BaseExpr->getSourceRange() : SourceRange());
11021063
}
1103-
1104-
if (DC) {
1105-
} else {
1106-
#if 0
1107-
// FIXME: Is this needed?
1108-
Diag(R.getNameLoc(), diag::err_no_member)
1109-
<< MemberName << BaseExprType
1110-
<< (BaseExpr ? BaseExpr->getSourceRange() : SourceRange());
1111-
#endif
1112-
}
11131064
return ExprError();
11141065
}
11151066

0 commit comments

Comments
 (0)