[PATCH v2] semantic/bovine: parse C++ override/final correctly

Ramkumar Ramachandra <[email protected]> Sat, 17 Jan 2015 17:43:57 -0500
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
override and final are a perfectly good opt-post-fcn-modifiers in
C++. Parse them correctly.

Signed-off-by: Ramkumar Ramachandra <[email protected]>
---
 lisp/cedet/semantic/bovine/c.by     |  6 ++++++
 lisp/cedet/semantic/bovine/c.el     |  4 +++-
 tests/cedet/semantic/tests/test.cpp | 12 ++++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/lisp/cedet/semantic/bovine/c.by b/lisp/cedet/semantic/bovine/c.by
index e4214b4..8dc3a82 100644
--- a/lisp/cedet/semantic/bovine/c.by
+++ b/lisp/cedet/semantic/bovine/c.by
@@ -140,6 +140,10 @@
 %put THROW summary "<type> <methoddef> (<method args>) throw (<exception>) ..."
 %token REENTRANT "reentrant"
 %put REENTRANT summary "<type> <methoddef> (<method args>) reentrant ..."
+%token OVERRIDE "override"
+%put OVERRIDE summary "<type> <methoddef> (<method args>) override ..."
+%token FINAL "final"
+%put FINAL summary "<type> <methoddef> (<method args>) final ..."
 %token TRY "try"
 %token CATCH "catch"
 %put { TRY CATCH } summary "try { <body> } catch { <catch code> }"
@@ -844,6 +848,8 @@ opt-post-fcn-modifiers
 post-fcn-modifiers
   : REENTRANT
   | CONST
+  | OVERRIDE
+  | FINAL
   ;
 
 opt-throw
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index 8592400..6dc136f 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -1350,8 +1350,10 @@ Optional argument STAR and REF indicate the number of * and & in the typedef."
 	    ;; `throws' as a common name for things that toss
 	    ;; exceptions about.
 	    :throws (nth 5 tokenpart)
-	    ;; Reentrant is a C++ thingy.  Add it here
+	    ;; rerentrant, override, final are a C++ things.  Add it here
 	    :reentrant-flag (if (member "reentrant" (nth 6 tokenpart)) t)
+	    :override-flag (if (member "override" (nth 6 tokenpart)) t)
+	    :final-flag (if (member "final" (nth 6 tokenpart)) t)
 	    ;; A function post-const is funky.  Try stuff
 	    :methodconst-flag (if (member "const" (nth 6 tokenpart)) t)
 	    ;; prototypes are functions w/ no body
diff --git a/tests/cedet/semantic/tests/test.cpp b/tests/cedet/semantic/tests/test.cpp
index 8a00c6b..8bb27ed 100644
--- a/tests/cedet/semantic/tests/test.cpp
+++ b/tests/cedet/semantic/tests/test.cpp
@@ -161,6 +161,18 @@ void *class3::method5_for_class3( int a, int b) const
 {
 }
 
+void *class3::method6_for_class3( int a, int b) override
+{
+  int q = a;
+  return "Moose";
+}
+
+void *class3::method7_for_class3( int a, int b) final
+{
+  int q = a;
+  return "Moose";
+}
+
 /*
  * Namespace parsing tests
  */
-- 
2.2.1


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet