Skip to content

Commit d0cb69b

Browse files
committed
[FOLD] cleanups
1 parent 49df7fd commit d0cb69b

File tree

7 files changed

+19
-35
lines changed

7 files changed

+19
-35
lines changed

clang/lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,8 +2998,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
29982998
<< TokenName << TagName << getLangOpts().CPlusPlus
29992999
<< FixItHint::CreateInsertion(Tok.getLocation(), FixitTagName);
30003000

3001-
if (Actions.LookupParsedName(R, getCurScope(), SS,
3002-
/*ObjectType=*/QualType())) {
3001+
if (Actions.LookupName(R, getCurScope())) {
30033002
for (LookupResult::iterator I = R.begin(), IEnd = R.end();
30043003
I != IEnd; ++I)
30053004
Diag((*I)->getLocation(), diag::note_decl_hiding_tag_type)

clang/lib/Sema/HLSLExternalSemaSource.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,15 @@ struct BuiltinTypeDeclBuilder {
126126

127127
static DeclRefExpr *lookupBuiltinFunction(ASTContext &AST, Sema &S,
128128
StringRef Name) {
129-
CXXScopeSpec SS;
130129
IdentifierInfo &II = AST.Idents.get(Name, tok::TokenKind::identifier);
131130
DeclarationNameInfo NameInfo =
132131
DeclarationNameInfo(DeclarationName(&II), SourceLocation());
133132
LookupResult R(S, NameInfo, Sema::LookupOrdinaryName);
134-
S.LookupParsedName(R, S.getCurScope(), &SS,
135-
/*ObjectType=*/QualType(),
136-
/*AllowBuiltinCreation*/ false);
133+
// AllowBuiltinCreation is false but LookupDirect will create
134+
// the builtin when searching the global scope anyways...
135+
S.LookupName(R, S.getCurScope());
136+
// FIXME: If the builtin function was user-declared in global scope,
137+
// this assert *will* fail. Should this call LookupBuiltin instead?
137138
assert(R.isSingleResult() &&
138139
"Since this is a builtin it should always resolve!");
139140
auto *VD = cast<ValueDecl>(R.getFoundDecl());

clang/lib/Sema/SemaAttr.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,10 +837,7 @@ void Sema::ActOnPragmaUnused(const Token &IdTok, Scope *curScope,
837837

838838
IdentifierInfo *Name = IdTok.getIdentifierInfo();
839839
LookupResult Lookup(*this, Name, IdTok.getLocation(), LookupOrdinaryName);
840-
LookupParsedName(Lookup, curScope,
841-
/*SS=*/nullptr,
842-
/*ObjectType=*/QualType(),
843-
/*AllowBuiltinCreation*/ true);
840+
LookupName(Lookup, curScope, /*AllowBuiltinCreation=*/true);
844841

845842
if (Lookup.empty()) {
846843
Diag(PragmaLoc, diag::warn_pragma_unused_undeclared_var)

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ Sema::NameClassification Sema::ClassifyName(Scope *S, CXXScopeSpec &SS,
893893

894894
LookupResult Result(*this, Name, NameLoc, LookupOrdinaryName);
895895
LookupParsedName(Result, S, &SS, /*ObjectType=*/QualType(),
896-
/*AllowBuiltinCreation*/ !CurMethod);
896+
/*AllowBuiltinCreation=*/!CurMethod);
897897

898898
if (SS.isInvalid())
899899
return NameClassification::Error();

clang/lib/Sema/SemaExpr.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2746,8 +2746,8 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
27462746
if (isBoundsAttrContext() && !getLangOpts().CPlusPlus && S->isClassScope()) {
27472747
// See if this is reference to a field of struct.
27482748
LookupResult R(*this, NameInfo, LookupMemberName);
2749-
// LookupParsedName handles a name lookup from within anonymous struct.
2750-
if (LookupParsedName(R, S, &SS)) {
2749+
// LookupName handles a name lookup from within anonymous struct.
2750+
if (LookupName(R, S)) {
27512751
if (auto *VD = dyn_cast<ValueDecl>(R.getFoundDecl())) {
27522752
QualType type = VD->getType().getNonReferenceType();
27532753
// This will eventually be translated into MemberExpr upon
@@ -2768,11 +2768,9 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
27682768
// lookup to determine that it was a template name in the first place. If
27692769
// this becomes a performance hit, we can work harder to preserve those
27702770
// results until we get here but it's likely not worth it.
2771-
bool MemberOfUnknownSpecialization;
27722771
AssumedTemplateKind AssumedTemplate;
27732772
if (LookupTemplateName(R, S, SS, /*ObjectType=*/QualType(),
2774-
/*EnteringContext=*/false,
2775-
MemberOfUnknownSpecialization, TemplateKWLoc,
2773+
/*EnteringContext=*/false, TemplateKWLoc,
27762774
&AssumedTemplate))
27772775
return ExprError();
27782776

clang/lib/Sema/SemaExprMember.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -693,13 +693,10 @@ static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
693693
// LookupTemplateName/LookupParsedName don't expect these both to exist
694694
// simultaneously.
695695
QualType ObjectType = SS.isSet() ? QualType() : RTy;
696-
if (HasTemplateArgs || TemplateKWLoc.isValid()) {
697-
bool MOUS;
696+
if (HasTemplateArgs || TemplateKWLoc.isValid())
698697
return SemaRef.LookupTemplateName(R,
699698
/*S=*/nullptr, SS, ObjectType,
700-
/*EnteringContext=*/false, MOUS,
701-
TemplateKWLoc);
702-
}
699+
/*EnteringContext=*/false, TemplateKWLoc);
703700

704701
SemaRef.LookupParsedName(R, /*S=*/nullptr, &SS, ObjectType);
705702

@@ -971,16 +968,10 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
971968
bool SuppressQualifierCheck,
972969
ActOnMemberAccessExtraArgs *ExtraArgs) {
973970
assert(!SS.isInvalid() && "nested-name-specifier cannot be invalid");
974-
if (R.wasNotFoundInCurrentInstantiation() ||
975-
#if 0
976-
(SS.isValid() && !computeDeclContext(SS, false))) {
977-
#else
978-
false) {
979-
#endif
971+
if (R.wasNotFoundInCurrentInstantiation())
980972
return ActOnDependentMemberExpr(BaseExpr, BaseExprType, IsArrow, OpLoc, SS,
981973
TemplateKWLoc, FirstQualifierInScope,
982974
R.getLookupNameInfo(), TemplateArgs);
983-
}
984975

985976
QualType BaseType = BaseExprType;
986977
if (IsArrow) {
@@ -989,6 +980,11 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
989980
}
990981
R.setBaseObjectType(BaseType);
991982

983+
assert((SS.isEmpty()
984+
? !BaseType->isDependentType() || computeDeclContext(BaseType)
985+
: !isDependentScopeSpecifier(SS) || computeDeclContext(SS)) &&
986+
"dependent lookup context that isn't the current instantiation?");
987+
992988
// C++1z [expr.ref]p2:
993989
// For the first option (dot) the first expression shall be a glvalue [...]
994990
if (!IsArrow && BaseExpr && BaseExpr->isPRValue()) {
@@ -1288,10 +1284,6 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
12881284

12891285
QualType BaseType = BaseExpr.get()->getType();
12901286

1291-
#if 0
1292-
assert(!BaseType->isDependentType());
1293-
#endif
1294-
12951287
DeclarationName MemberName = R.getLookupName();
12961288
SourceLocation MemberLoc = R.getNameLoc();
12971289

clang/lib/Sema/SemaOverload.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5803,10 +5803,7 @@ static ImplicitConversionSequence TryObjectArgumentInitialization(
58035803
return ICS;
58045804
}
58055805

5806-
// FIXME: Should this check getAsRecordDecl instead?
5807-
#if 0
58085806
assert(FromType->isRecordType());
5809-
#endif
58105807

58115808
QualType ClassType = S.Context.getTypeDeclType(ActingContext);
58125809
// C++98 [class.dtor]p2:

0 commit comments

Comments
 (0)