aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-01-20 04:34:22 +0000
committerAnders Carlsson <andersca@mac.com>2011-01-20 04:34:22 +0000
commitaae5af24f031ad5f17872bd8b27ed5c175c0f90c (patch)
tree69416fff661274e7b6a3020d2bcd758b5f13c805 /include/clang
parent37ea6c461897bcfc8865eb130cddd5c1853c3c22 (diff)
Only allow virtual member functions to be marked 'override' and 'final'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123882 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td4
-rw-r--r--include/clang/Sema/DeclSpec.h9
2 files changed, 13 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 9e7d0a5761..b61fcc1ab3 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -870,6 +870,10 @@ def err_trailing_return_without_auto : Error<
// C++0x attributes
def err_repeat_attribute : Error<"'%0' attribute cannot be repeated">;
+// C++0x override control
+def override_keyword_only_allowed_on_virtual_member_functions : Error<
+ "only virtual member functions can be marked '%0'">;
+
// C++0x [[final]]
def err_final_function_overridden : Error<
"declaration of %0 overrides a 'final' function">;
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h
index 9c1f98fa1a..0f8624f0a3 100644
--- a/include/clang/Sema/DeclSpec.h
+++ b/include/clang/Sema/DeclSpec.h
@@ -1483,6 +1483,15 @@ public:
bool SetVirtSpecifier(VirtSpecifier VS, SourceLocation Loc,
const char *&PrevSpec);
+ bool isOverrideSpecified() const { return Specifiers & VS_Override; }
+ SourceLocation getOverrideLoc() const { return VS_overrideLoc; }
+
+ bool isFinalSpecified() const { return Specifiers & VS_Final; }
+ SourceLocation getFinalLoc() const { return VS_finalLoc; }
+
+ bool isNewSpecified() const { return Specifiers & VS_New; }
+ SourceLocation getNewLoc() const { return VS_newLoc; }
+
private:
unsigned Specifiers;