diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h index 9b8a99c2c1d0..cba3dea5c8ee 100644 --- a/clang/include/clang/Parse/Action.h +++ b/clang/include/clang/Parse/Action.h @@ -455,7 +455,8 @@ public: /// ActOnTagFinishDefinition - Invoked once we have finished parsing /// the definition of a tag (enumeration, class, struct, or union). - virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl) { } + virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl, + SourceLocation RBraceLoc) { } virtual DeclPtrTy ActOnEnumConstant(Scope *S, DeclPtrTy EnumDecl, DeclPtrTy LastEnumConstant, diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 1ddd20a9ecbf..94855b24f5ff 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -1500,7 +1500,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, LBraceLoc, RBraceLoc, AttrList); StructScope.Exit(); - Actions.ActOnTagFinishDefinition(CurScope, TagDecl); + Actions.ActOnTagFinishDefinition(CurScope, TagDecl, RBraceLoc); } @@ -1656,7 +1656,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) { AttrList = ParseAttributes(); // FIXME: where do they do? EnumScope.Exit(); - Actions.ActOnTagFinishDefinition(CurScope, EnumDecl); + Actions.ActOnTagFinishDefinition(CurScope, EnumDecl, RBraceLoc); } /// isTypeSpecifierQualifier - Return true if the current token could be the diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 373d22fd9f4f..88e027db02eb 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -1213,7 +1213,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, ParsingDef.Pop(); ClassScope.Exit(); - Actions.ActOnTagFinishDefinition(CurScope, TagDecl); + Actions.ActOnTagFinishDefinition(CurScope, TagDecl, RBraceLoc); } /// ParseConstructorInitializer - Parse a C++ constructor initializer, diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index c2a484e75a0a..844566081629 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -563,7 +563,8 @@ public: /// ActOnTagFinishDefinition - Invoked once we have finished parsing /// the definition of a tag (enumeration, class, struct, or union). - virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl); + virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl, + SourceLocation RBraceLoc); EnumConstantDecl *CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index baa2a2b9abb0..3ce11570feb0 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3830,9 +3830,11 @@ void Sema::ActOnTagStartDefinition(Scope *S, DeclPtrTy TagD) { } } -void Sema::ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagD) { +void Sema::ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagD, + SourceLocation RBraceLoc) { AdjustDeclIfTemplate(TagD); TagDecl *Tag = cast(TagD.getAs()); + Tag->setRBraceLoc(RBraceLoc); if (isa(Tag)) FieldCollector->FinishClass();