r349904 - [Sema][NFC] Remove some unnecessary calls to getASTContext.
Bruno Ricci via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 21 06:35:24 PST 2018
Author: brunoricci
Date: Fri Dec 21 06:35:24 2018
New Revision: 349904
URL: http://llvm.org/viewvc/llvm-project?rev=349904&view=rev
Log:
[Sema][NFC] Remove some unnecessary calls to getASTContext.
The AST context is already easily available. NFC.
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=349904&r1=349903&r2=349904&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Dec 21 06:35:24 2018
@@ -5148,8 +5148,6 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
TheCall->setArg(i+1, Arg.get());
}
- ASTContext& Context = this->getASTContext();
-
// Create a new DeclRefExpr to refer to the new decl.
DeclRefExpr* NewDRE = DeclRefExpr::Create(
Context,
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=349904&r1=349903&r2=349904&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Dec 21 06:35:24 2018
@@ -5875,10 +5875,10 @@ isOutOfScopePreviousDeclaration(NamedDec
return true;
}
-static void SetNestedNameSpecifier(DeclaratorDecl *DD, Declarator &D) {
+static void SetNestedNameSpecifier(Sema &S, DeclaratorDecl *DD, Declarator &D) {
CXXScopeSpec &SS = D.getCXXScopeSpec();
if (!SS.isSet()) return;
- DD->setQualifierInfo(SS.getWithLocInContext(DD->getASTContext()));
+ DD->setQualifierInfo(SS.getWithLocInContext(S.Context));
}
bool Sema::inferObjCARCLifetime(ValueDecl *decl) {
@@ -6583,7 +6583,7 @@ NamedDecl *Sema::ActOnVariableDeclarator
NewTemplate->setInvalidDecl();
}
- SetNestedNameSpecifier(NewVD, D);
+ SetNestedNameSpecifier(*this, NewVD, D);
// If we have any template parameter lists that don't directly belong to
// the variable (matching the scope specifier), store them.
@@ -8384,7 +8384,7 @@ Sema::ActOnFunctionDeclarator(Scope *S,
Diag(D.getDeclSpec().getVirtualSpecLoc(), diag::err_virtual_in_union);
}
- SetNestedNameSpecifier(NewFD, D);
+ SetNestedNameSpecifier(*this, NewFD, D);
isMemberSpecialization = false;
isFunctionTemplateSpecialization = false;
if (D.isInvalidType())
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=349904&r1=349903&r2=349904&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Dec 21 06:35:24 2018
@@ -16547,7 +16547,7 @@ ExprResult RebuildUnknownAnyExpr::resolv
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E);
if (DRE && Proto && Proto->getParamTypes().empty() && Proto->isVariadic()) {
SourceLocation Loc = FD->getLocation();
- FunctionDecl *NewFD = FunctionDecl::Create(FD->getASTContext(),
+ FunctionDecl *NewFD = FunctionDecl::Create(S.Context,
FD->getDeclContext(),
Loc, Loc, FD->getNameInfo().getName(),
DestType, FD->getTypeSourceInfo(),
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=349904&r1=349903&r2=349904&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Dec 21 06:35:24 2018
@@ -1255,9 +1255,10 @@ Sema::ActOnTemplateParameterList(unsigne
RAngleLoc, RequiresClause);
}
-static void SetNestedNameSpecifier(TagDecl *T, const CXXScopeSpec &SS) {
+static void SetNestedNameSpecifier(Sema &S, TagDecl *T,
+ const CXXScopeSpec &SS) {
if (SS.isSet())
- T->setQualifierInfo(SS.getWithLocInContext(T->getASTContext()));
+ T->setQualifierInfo(SS.getWithLocInContext(S.Context));
}
DeclResult Sema::CheckClassTemplate(
@@ -1554,7 +1555,7 @@ DeclResult Sema::CheckClassTemplate(
PrevClassTemplate && ShouldAddRedecl ?
PrevClassTemplate->getTemplatedDecl() : nullptr,
/*DelayTypeCreation=*/true);
- SetNestedNameSpecifier(NewClass, SS);
+ SetNestedNameSpecifier(*this, NewClass, SS);
if (NumOuterTemplateParamLists > 0)
NewClass->setTemplateParameterListsInfo(
Context, llvm::makeArrayRef(OuterTemplateParamLists,
@@ -7650,7 +7651,7 @@ DeclResult Sema::ActOnClassTemplateSpeci
TemplateArgs,
CanonType,
PrevPartial);
- SetNestedNameSpecifier(Partial, SS);
+ SetNestedNameSpecifier(*this, Partial, SS);
if (TemplateParameterLists.size() > 1 && SS.isSet()) {
Partial->setTemplateParameterListsInfo(
Context, TemplateParameterLists.drop_back(1));
@@ -7676,7 +7677,7 @@ DeclResult Sema::ActOnClassTemplateSpeci
ClassTemplate,
Converted,
PrevDecl);
- SetNestedNameSpecifier(Specialization, SS);
+ SetNestedNameSpecifier(*this, Specialization, SS);
if (TemplateParameterLists.size() > 0) {
Specialization->setTemplateParameterListsInfo(Context,
TemplateParameterLists);
@@ -8775,7 +8776,7 @@ DeclResult Sema::ActOnExplicitInstantiat
ClassTemplate,
Converted,
PrevDecl);
- SetNestedNameSpecifier(Specialization, SS);
+ SetNestedNameSpecifier(*this, Specialization, SS);
if (!HasNoEffect && !PrevDecl) {
// Insert the new specialization.
More information about the cfe-commits
mailing list