diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Sema/DeclSpec.h | 17 | ||||
-rw-r--r-- | include/clang/Sema/Sema.h | 32 |
2 files changed, 29 insertions, 20 deletions
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index 3f11ee4f55..1ed45cbf4c 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -1411,6 +1411,12 @@ private: /// GroupingParens - Set by Parser::ParseParenDeclarator(). bool GroupingParens : 1; + /// FunctionDefinition - Is this Declarator for a function or member defintion + bool FunctionDefinition : 1; + + // Redeclaration - Is this Declarator is a redeclaration. + bool Redeclaration : 1; + /// Attrs - Attributes. ParsedAttributes Attrs; @@ -1436,8 +1442,9 @@ public: Declarator(const DeclSpec &ds, TheContext C) : DS(ds), Range(ds.getSourceRange()), Context(C), InvalidType(DS.getTypeSpecType() == DeclSpec::TST_error), - GroupingParens(false), Attrs(ds.getAttributePool().getFactory()), - AsmLabel(0), InlineParamsUsed(false), Extension(false) { + GroupingParens(false), FunctionDefinition(false), Redeclaration(false), + Attrs(ds.getAttributePool().getFactory()), AsmLabel(0), + InlineParamsUsed(false), Extension(false) { } ~Declarator() { @@ -1796,6 +1803,12 @@ public: bool hasEllipsis() const { return EllipsisLoc.isValid(); } SourceLocation getEllipsisLoc() const { return EllipsisLoc; } void setEllipsisLoc(SourceLocation EL) { EllipsisLoc = EL; } + + void setFunctionDefinition(bool Val) { FunctionDefinition = Val; } + bool isFunctionDefinition() const { return FunctionDefinition; } + + void setRedeclaration(bool Val) { Redeclaration = Val; } + bool isRedeclaration() const { return Redeclaration; } }; /// FieldDeclarator - This little struct is used to capture information about diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index c7b188d096..c171da820c 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -986,8 +986,7 @@ public: Decl *ActOnDeclarator(Scope *S, Declarator &D); Decl *HandleDeclarator(Scope *S, Declarator &D, - MultiTemplateParamsArg TemplateParameterLists, - bool IsFunctionDefinition); + MultiTemplateParamsArg TemplateParameterLists); void RegisterLocallyScopedExternCDecl(NamedDecl *ND, const LookupResult &Previous, Scope *S); @@ -998,24 +997,21 @@ public: void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange); void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D); NamedDecl* ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, - QualType R, TypeSourceInfo *TInfo, - LookupResult &Previous, bool &Redeclaration); + TypeSourceInfo *TInfo, + LookupResult &Previous); NamedDecl* ActOnTypedefNameDecl(Scope* S, DeclContext* DC, TypedefNameDecl *D, LookupResult &Previous, bool &Redeclaration); NamedDecl* ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC, - QualType R, TypeSourceInfo *TInfo, + TypeSourceInfo *TInfo, LookupResult &Previous, - MultiTemplateParamsArg TemplateParamLists, - bool &Redeclaration); - void CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous, - bool &Redeclaration); + MultiTemplateParamsArg TemplateParamLists); + // Returns true if the variable declaration is a redeclaration + bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous); void CheckCompleteVariableDeclaration(VarDecl *var); NamedDecl* ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, - QualType R, TypeSourceInfo *TInfo, + TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, - bool IsFunctionDefinition, - bool &Redeclaration, bool &AddToScope); bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD); @@ -1036,10 +1032,10 @@ public: bool CheckConstexprFunctionBody(const FunctionDecl *FD, Stmt *Body); void DiagnoseHiddenVirtualMethods(CXXRecordDecl *DC, CXXMethodDecl *MD); - void CheckFunctionDeclaration(Scope *S, + // Returns true if the function declaration is a redeclaration + bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, - bool IsExplicitSpecialization, - bool &Redeclaration); + bool IsExplicitSpecialization); void CheckMain(FunctionDecl *FD, const DeclSpec &D); Decl *ActOnParamDeclarator(Scope *S, Declarator &D); ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC, @@ -3427,7 +3423,7 @@ public: Declarator &D, MultiTemplateParamsArg TemplateParameterLists, Expr *BitfieldWidth, const VirtSpecifiers &VS, - bool HasDeferredInit, bool IsDefinition); + bool HasDeferredInit); void ActOnCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init); @@ -3568,9 +3564,9 @@ public: FriendDecl *CheckFriendTypeDecl(SourceLocation FriendLoc, TypeSourceInfo *TSInfo); Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, + MultiTemplateParamsArg TemplateParams); + Decl *ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams); - Decl *ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition, - MultiTemplateParamsArg TemplateParams); QualType CheckConstructorDeclarator(Declarator &D, QualType R, StorageClass& SC); |