From bb85f8edca8103aa10e4b2f4a6fcc3a251b0ea03 Mon Sep 17 00:00:00 2001 From: Sean Hunt Date: Fri, 6 May 2011 21:24:28 +0000 Subject: [PATCH] Per Richard's suggestion, rename DefLoc to DefaultLoc where it appears. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131018 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Sema/Sema.h | 6 +++--- lib/Parse/ParseDecl.cpp | 4 +--- lib/Parse/ParseDeclCXX.cpp | 12 ++++++------ lib/Sema/SemaDecl.cpp | 33 +++++++++++++++++---------------- lib/Sema/SemaDeclCXX.cpp | 8 ++++---- 5 files changed, 31 insertions(+), 32 deletions(-) diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index f741bc06d4..13a8a9a5b5 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -936,7 +936,7 @@ public: Decl *HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, bool IsFunctionDefinition, - SourceLocation DefLoc = SourceLocation()); + SourceLocation DefaultLoc = SourceLocation()); void RegisterLocallyScopedExternCDecl(NamedDecl *ND, const LookupResult &Previous, Scope *S); @@ -965,7 +965,7 @@ public: MultiTemplateParamsArg TemplateParamLists, bool IsFunctionDefinition, bool &Redeclaration, - SourceLocation DefLoc = SourceLocation()); + SourceLocation DefaultLoc = SourceLocation()); bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD); void DiagnoseHiddenVirtualMethods(CXXRecordDecl *DC, CXXMethodDecl *MD); void CheckFunctionDeclaration(Scope *S, @@ -3068,7 +3068,7 @@ public: Expr *BitfieldWidth, const VirtSpecifiers &VS, Expr *Init, bool IsDefinition, bool Deleted = false, - SourceLocation DefLoc = SourceLocation()); + SourceLocation DefaultLoc = SourceLocation()); MemInitResult ActOnMemInitializer(Decl *ConstructorD, Scope *S, diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index a4c323979d..bde650ba3f 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -967,9 +967,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, Actions.SetDeclDeleted(ThisDecl, DelLoc); } else if (Tok.is(tok::kw_default)) { - SourceLocation DefLoc = ConsumeToken(); - - Diag(DefLoc, diag::err_default_special_members); + Diag(ConsumeToken(), diag::err_default_special_members); } else { if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { EnterScope(0); diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index d263f96e26..ccc245016e 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -1648,7 +1648,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, ExprResult BitfieldSize; ExprResult Init; bool Deleted = false; - SourceLocation DefLoc; + SourceLocation DefaultLoc; while (1) { // member-declarator: @@ -1683,7 +1683,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, } else if (Tok.is(tok::kw_default)) { if (!getLang().CPlusPlus0x) Diag(Tok, diag::warn_defaulted_function_accepted_as_extension); - DefLoc = ConsumeToken(); + DefaultLoc = ConsumeToken(); } else { Init = ParseInitializer(); if (Init.isInvalid()) @@ -1711,8 +1711,8 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, Decl *ThisDecl = 0; if (DS.isFriendSpecified()) { - if (DefLoc.isValid()) - Diag(DefLoc, diag::err_default_special_members); + if (DefaultLoc.isValid()) + Diag(DefaultLoc, diag::err_default_special_members); // TODO: handle initializers, bitfields, 'delete' ThisDecl = Actions.ActOnFriendFunctionDecl(getCurScope(), DeclaratorInfo, @@ -1725,7 +1725,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, BitfieldSize.release(), VS, Init.release(), /*IsDefinition*/Deleted, - Deleted, DefLoc); + Deleted, DefaultLoc); } if (ThisDecl) DeclsInGroup.push_back(ThisDecl); @@ -1752,7 +1752,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, BitfieldSize = 0; Init = 0; Deleted = false; - DefLoc = SourceLocation(); + DefaultLoc = SourceLocation(); // Attributes are only allowed on the second declarator. MaybeParseGNUAttributes(DeclaratorInfo); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 46b38e165d..586a298f2d 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2915,7 +2915,7 @@ bool Sema::DiagnoseClassNameShadow(DeclContext *DC, Decl *Sema::HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, bool IsFunctionDefinition, - SourceLocation DefLoc) { + SourceLocation DefaultLoc) { // TODO: consider using NameInfo for diagnostic. DeclarationNameInfo NameInfo = GetNameForDeclarator(D); DeclarationName Name = NameInfo.getName(); @@ -3116,8 +3116,8 @@ Decl *Sema::HandleDeclarator(Scope *S, Declarator &D, bool Redeclaration = false; if (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef) { - if (DefLoc.isValid()) - Diag(DefLoc, diag::err_default_special_members); + if (DefaultLoc.isValid()) + Diag(DefaultLoc, diag::err_default_special_members); if (TemplateParamLists.size()) { Diag(D.getIdentifierLoc(), diag::err_template_typedef); @@ -3128,9 +3128,10 @@ Decl *Sema::HandleDeclarator(Scope *S, Declarator &D, } else if (R->isFunctionType()) { New = ActOnFunctionDeclarator(S, D, DC, R, TInfo, Previous, move(TemplateParamLists), - IsFunctionDefinition, Redeclaration, DefLoc); + IsFunctionDefinition, Redeclaration, + DefaultLoc); } else { - assert(!DefLoc.isValid() && "We should have caught this in a caller"); + assert(!DefaultLoc.isValid() && "We should have caught this in a caller"); New = ActOnVariableDeclarator(S, D, DC, R, TInfo, Previous, move(TemplateParamLists), Redeclaration); @@ -4003,7 +4004,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool IsFunctionDefinition, bool &Redeclaration, - SourceLocation DefLoc) { + SourceLocation DefaultLoc) { assert(R.getTypePtr()->isFunctionType()); // TODO: consider using NameInfo for diagnostic. @@ -4060,7 +4061,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, bool isFunctionTemplateSpecialization = false; if (!getLangOptions().CPlusPlus) { - assert(!DefLoc.isValid() && "Defaulted functions are a C++ feature"); + assert(!DefaultLoc.isValid() && "Defaulted functions are a C++ feature"); // Determine whether the function was written with a // prototype. This true when: @@ -4116,13 +4117,13 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, NewFD = NewCD; - if (DefLoc.isValid()) { + if (DefaultLoc.isValid()) { if (NewCD->isDefaultConstructor() || NewCD->isCopyOrMoveConstructor()) { NewFD->setDefaulted(); NewFD->setExplicitlyDefaulted(); } else { - Diag(DefLoc, diag::err_default_special_members); + Diag(DefaultLoc, diag::err_default_special_members); } } } else if (Name.getNameKind() == DeclarationName::CXXDestructorName) { @@ -4138,7 +4139,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, /*isImplicitlyDeclared=*/false); isVirtualOkay = true; - if (DefLoc.isValid()) { + if (DefaultLoc.isValid()) { NewFD->setDefaulted(); NewFD->setExplicitlyDefaulted(); } @@ -4160,8 +4161,8 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, return 0; } - if (DefLoc.isValid()) - Diag(DefLoc, diag::err_default_special_members); + if (DefaultLoc.isValid()) + Diag(DefaultLoc, diag::err_default_special_members); CheckConversionDeclarator(D, R, SC); NewFD = CXXConversionDecl::Create(Context, cast(DC), @@ -4211,18 +4212,18 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, isVirtualOkay = !isStatic; - if (DefLoc.isValid()) { + if (DefaultLoc.isValid()) { if (NewMD->isCopyAssignmentOperator() /* || NewMD->isMoveAssignmentOperator() */) { NewFD->setDefaulted(); NewFD->setExplicitlyDefaulted(); } else { - Diag(DefLoc, diag::err_default_special_members); + Diag(DefaultLoc, diag::err_default_special_members); } } } else { - if (DefLoc.isValid()) - Diag(DefLoc, diag::err_default_special_members); + if (DefaultLoc.isValid()) + Diag(DefaultLoc, diag::err_default_special_members); // Determine whether the function was written with a // prototype. This true when: diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 41b09df9ca..bc6584bc73 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -963,7 +963,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, ExprTy *BW, const VirtSpecifiers &VS, ExprTy *InitExpr, bool IsDefinition, - bool Deleted, SourceLocation DefLoc) { + bool Deleted, SourceLocation DefaultLoc) { const DeclSpec &DS = D.getDeclSpec(); DeclarationNameInfo NameInfo = GetNameForDeclarator(D); DeclarationName Name = NameInfo.getName(); @@ -1028,8 +1028,8 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, if (isInstField) { CXXScopeSpec &SS = D.getCXXScopeSpec(); - if (DefLoc.isValid()) - Diag(DefLoc, diag::err_default_special_members); + if (DefaultLoc.isValid()) + Diag(DefaultLoc, diag::err_default_special_members); if (SS.isSet() && !SS.isInvalid()) { // The user provided a superfluous scope specifier inside a class @@ -1056,7 +1056,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, assert(Member && "HandleField never returns null"); } else { Member = HandleDeclarator(S, D, move(TemplateParameterLists), IsDefinition, - DefLoc); + DefaultLoc); if (!Member) { return 0; } -- 2.40.0