diff options
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 754536e629f..1a415b01dac 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -47,6 +47,7 @@ #include <algorithm> #include <cstring> #include <functional> + using namespace clang; using namespace sema; @@ -88,7 +89,7 @@ class TypeNameValidatorCCC : public CorrectionCandidateCallback { bool AllowClassTemplates; }; -} +} // end anonymous namespace /// \brief Determine whether the token kind starts a simple-type-specifier. bool Sema::isSimpleTypeSpecifier(tok::TokenKind Kind) const { @@ -134,7 +135,7 @@ enum class UnqualifiedTypeNameLookupResult { FoundNonType, FoundType }; -} // namespace +} // end anonymous namespace /// \brief Tries to perform unqualified lookup of the type decls in bases for /// dependent class. @@ -1143,7 +1144,6 @@ void Sema::ExitDeclaratorContext(Scope *S) { // disappear. } - void Sema::ActOnReenterFunctionContext(Scope* S, Decl *D) { // We assume that the caller has already called // ActOnReenterTemplateScope so getTemplatedDecl() works. @@ -1168,7 +1168,6 @@ void Sema::ActOnReenterFunctionContext(Scope* S, Decl *D) { } } - void Sema::ActOnExitFunctionContext() { // Same implementation as PopDeclContext, but returns to the lexical parent, // rather than the top-level class. @@ -1177,7 +1176,6 @@ void Sema::ActOnExitFunctionContext() { assert(CurContext && "Popped translation unit!"); } - /// \brief Determine whether we allow overloading of the function /// PrevDecl with another declaration. /// @@ -1531,7 +1529,6 @@ static void GenerateFixForUnusedDecl(const NamedDecl *D, ASTContext &Ctx, Hint = FixItHint::CreateRemoval(CharSourceRange:: getCharRange(D->getLocStart(), AfterColon)); } - return; } void Sema::DiagnoseUnusedNestedTypedefs(const RecordDecl *D) { @@ -2524,7 +2521,7 @@ struct GNUCompatibleParamWarning { QualType PromotedType; }; -} +} // end anonymous namespace /// getSpecialMember - get the special member enum for a method. Sema::CXXSpecialMember Sema::getSpecialMember(const CXXMethodDecl *MD) { @@ -3226,10 +3223,8 @@ bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old, return false; } - void Sema::mergeObjCMethodDecls(ObjCMethodDecl *newMethod, ObjCMethodDecl *oldMethod) { - // Merge the attributes, including deprecated/unavailable AvailabilityMergeKind MergeKind = isa<ObjCProtocolDecl>(oldMethod->getDeclContext()) @@ -5266,7 +5261,6 @@ Sema::CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *NewTD) { } } - /// ActOnTypedefNameDecl - Perform semantic checking for a declaration which /// declares a typedef-name, either using the 'typedef' type specifier or via /// a C++0x [dcl.typedef]p2 alias-declaration: 'using T = A;'. @@ -6855,7 +6849,7 @@ namespace { MultiTemplateParamsArg TemplateParamLists; bool AddToScope; }; -} +} // end anonymous namespace namespace { @@ -6899,7 +6893,7 @@ class DifferentNameValidatorCCC : public CorrectionCandidateCallback { CXXRecordDecl *ExpectedParent; }; -} +} // end anonymous namespace /// \brief Generate diagnostics for an invalid function redeclaration. /// @@ -7527,7 +7521,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, Invalid = true; } - FunctionTemplate = FunctionTemplateDecl::Create(Context, DC, NewFD->getLocation(), Name, TemplateParams, @@ -7879,7 +7872,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, NewFD->setInvalidDecl(); } } - } else if (const FunctionProtoType *FT = R->getAs<FunctionProtoType>()) { // When we're declaring a function with a typedef, typeof, etc as in the // following example, we'll need to synthesize (unnamed) @@ -8094,7 +8086,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, << FixItHint::CreateRemoval( D.getDeclSpec().getStorageClassSpecLoc()); } - } else if (isExplicitSpecialization && isa<CXXMethodDecl>(NewFD)) { if (CheckMemberSpecialization(NewFD, Previous)) NewFD->setInvalidDecl(); @@ -8213,7 +8204,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, return Result; } } - } else if (!D.isFunctionDefinition() && isa<CXXMethodDecl>(NewFD) && NewFD->isOutOfLine() && !isFriend && !isFunctionTemplateSpecialization && @@ -8843,6 +8833,7 @@ namespace { bool isInitList; llvm::SmallVector<unsigned, 4> InitFieldIndex; + public: typedef EvaluatedExprVisitor<SelfReferenceChecker> Inherited; @@ -9064,7 +9055,7 @@ namespace { Inherited::VisitUnaryOperator(E); } - void VisitObjCMessageExpr(ObjCMessageExpr *E) { return; } + void VisitObjCMessageExpr(ObjCMessageExpr *E) {} void VisitCXXConstructExpr(CXXConstructExpr *E) { if (E->getConstructor()->isCopyConstructor()) { @@ -9160,7 +9151,7 @@ namespace { SelfReferenceChecker(S, OrigDecl).CheckExpr(E); } -} +} // end anonymous namespace QualType Sema::deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, @@ -10084,7 +10075,6 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) { if (getLangOpts().CPlusPlus11) Diag(var->getLocation(), diag::note_use_thread_local); } - } // Apply section attributes and pragmas to global variables. @@ -10888,7 +10878,6 @@ Sema::CheckForFunctionRedefinition(FunctionDecl *FD, FD->setInvalidDecl(); } - static void RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator, Sema &S) { CXXRecordDecl *const LambdaClass = CallOperator->getParent(); @@ -11417,7 +11406,6 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, return dcl; } - /// When we finish delayed parsing of an attribute, we must attach it to the /// relevant Decl. void Sema::ActOnFinishDelayedAttribute(Scope *S, Decl *D, @@ -11432,7 +11420,6 @@ void Sema::ActOnFinishDelayedAttribute(Scope *S, Decl *D, checkThisInStaticMemberFunctionAttributes(Method); } - /// ImplicitlyDefineFunction - An undeclared identifier was used in a function /// call, forming a call to an implicitly defined function (per C99 6.5.1p2). NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, @@ -11684,7 +11671,6 @@ TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T, return NewTD; } - /// \brief Check that this is a valid underlying type for an enum declaration. bool Sema::CheckEnumUnderlyingType(TypeSourceInfo *TI) { SourceLocation UnderlyingLoc = TI->getTypeLoc().getBeginLoc(); @@ -12528,7 +12514,6 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // is non-NULL, it's a definition of the tag declared by // PrevDecl. If it's NULL, we have a new definition. - // Otherwise, PrevDecl is not a tag, but was found with tag // lookup. This is only actually possible in C++, where a few // things like templates still live in the tag namespace. @@ -12646,7 +12631,6 @@ CreateNewDecl: ED->setIntegerType(QualType(EnumUnderlying.get<const Type*>(), 0)); ED->setPromotionType(ED->getIntegerType()); } - } else { // struct/union/class @@ -12787,7 +12771,6 @@ CreateNewDecl: PushOnScopeChains(New, S, !IsForwardReference); if (IsForwardReference) SearchDC->makeDeclVisibleInContext(New); - } else { CurContext->addDecl(New); } |