diff options
author | John McCall <rjmccall@apple.com> | 2012-09-25 07:32:39 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-09-25 07:32:39 +0000 |
commit | e402e72273cde2a64fa6097c1fe93f500038675d (patch) | |
tree | 06462d2691ea6e840a20fb9209ee1711b723a529 /include | |
parent | 9f357de8d5823f9b13cf33ad1f6af1dd69b7669f (diff) |
Fix for r163013 regression and further __interface enhancement.
Patch by Andy Gibbs!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/DeclCXX.h | 4 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 5 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 8 | ||||
-rw-r--r-- | include/clang/Parse/Parser.h | 16 |
4 files changed, 25 insertions, 8 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 76be4086c9..26f91dd42d 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -1565,9 +1565,9 @@ public: CXXMethodDecl *CD = cast<CXXMethodDecl>(const_cast<CXXMethodDecl*>(this)->getCanonicalDecl()); - // Methods declared in interfaces are automatically (pure) virtual + // Methods declared in interfaces are automatically (pure) virtual. if (CD->isVirtualAsWritten() || - CD->getParent()->getTagKind() == TTK_Interface) + (CD->getParent()->isInterface() && CD->isUserProvided())) return true; return (CD->begin_overridden_methods() != CD->end_overridden_methods()); diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 6d308ff70d..7f46bf0ce0 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -644,6 +644,11 @@ def ext_override_control_keyword : ExtWarn< def warn_cxx98_compat_override_control_keyword : Warning< "'%0' keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; +def err_override_control_interface : Error< + "'%0' keyword not permitted with interface types">; + +def err_access_specifier_interface : Error< + "interface types cannot specify '%select{private|protected}0' access">; def err_duplicate_virt_specifier : Error< "class member already marked '%0'">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index c314cf78d9..6c92a6d23f 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -812,6 +812,14 @@ def err_friend_def_in_local_class : Error< def err_friend_not_first_in_declaration : Error< "'friend' must appear first in a non-function declaration">; +def err_invalid_member_in_interface : Error< + "%select{data member |non-public member function |static member function |" + "user-declared constructor|user-declared destructor|operator |" + "nested class }0%1 is not permitted within an interface type">; +def err_invalid_base_in_interface : Error< + "interface type cannot inherit from " + "%select{'struct|non-public 'interface|'class}0 %1'">; + def err_abstract_type_in_decl : Error< "%select{return|parameter|variable|field|instance variable}0 type %1 is an abstract class">; def err_allocation_of_abstract_type : Error< diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index b5c1a41650..d143a1a0c5 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -925,9 +925,9 @@ private: /// any member function declarations or definitions that need to be /// parsed after the corresponding top-level class is complete. struct ParsingClass { - ParsingClass(Decl *TagOrTemplate, bool TopLevelClass) + ParsingClass(Decl *TagOrTemplate, bool TopLevelClass, bool IsInterface) : TopLevelClass(TopLevelClass), TemplateScope(false), - TagOrTemplate(TagOrTemplate) { } + IsInterface(IsInterface), TagOrTemplate(TagOrTemplate) { } /// \brief Whether this is a "top-level" class, meaning that it is /// not nested within another class. @@ -938,6 +938,9 @@ private: /// othewise, it is a tag declaration. bool TemplateScope : 1; + /// \brief Whether this class is an __interface. + bool IsInterface : 1; + /// \brief The class or class template whose definition we are parsing. Decl *TagOrTemplate; @@ -964,9 +967,10 @@ private: Sema::ParsingClassState State; public: - ParsingClassDefinition(Parser &P, Decl *TagOrTemplate, bool TopLevelClass) + ParsingClassDefinition(Parser &P, Decl *TagOrTemplate, bool TopLevelClass, + bool IsInterface) : P(P), Popped(false), - State(P.PushParsingClass(TagOrTemplate, TopLevelClass)) { + State(P.PushParsingClass(TagOrTemplate, TopLevelClass, IsInterface)) { } /// \brief Pop this class of the stack. @@ -1054,7 +1058,7 @@ private: void LateTemplateParser(const FunctionDecl *FD); Sema::ParsingClassState - PushParsingClass(Decl *TagOrTemplate, bool TopLevelClass); + PushParsingClass(Decl *TagOrTemplate, bool TopLevelClass, bool IsInterface); void DeallocateParsedClasses(ParsingClass *Class); void PopParsingClass(Sema::ParsingClassState); @@ -1931,7 +1935,7 @@ private: VirtSpecifiers::Specifier isCXX0XVirtSpecifier() const { return isCXX0XVirtSpecifier(Tok); } - void ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS); + void ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS, bool IsInterface); bool isCXX0XFinalKeyword() const; |