]> git.eshelyaron.com Git - emacs.git/commitdiff
C++: Deal with 'using' statements when calculating scope
authorDavid Engster <dengste@eml.cc>
Mon, 18 Nov 2013 22:11:17 +0000 (23:11 +0100)
committerEdward John Steere <edward.steere@gmail.com>
Wed, 25 Jan 2017 17:28:21 +0000 (19:28 +0200)
* semantic/bovine/c.el (semantic-ctxt-scoped-types): Go through all
  tags around point and search them for using statements.  Before, we
  skipped the last one thinking that it would have to be function, but
  it could also be a type.

* semantic/scope.el (semantic-completable-tags-from-type): When
  creating the list of completable types, pull in types which are
  referenced through 'using' statements.

* tests/cedet/semantic/test/manual/cedet/testusing.cpp:
* tests/cedet/semantic/test/manual/cedet/testusing.hh: Add tests for
  the above.

test/manual/cedet/cedet/semantic/tests/testusing.cpp

index 4fa26872ab55e004cb91ab87959775b84884018c..f7135d1a7e9710ecdd3a97fcf6cdf16b3f2a4a8e 100644 (file)
@@ -218,3 +218,28 @@ void acc_using2()
   sn.//-19-
     ; //#19# ( "one" "two" )
 }
+
+// Check if scope gets correctly generated, i.e., without us providing any
+// hints in the form of an existing type
+
+void check_scope()
+{
+  using namespace first;
+  AAA//-20-
+    ; //#20# ( "AAA1" "AAA2" )
+}
+
+void check_scope2()
+{
+  using namespace third;
+  AAA//-21-
+    ; //#21# ( "AAA1" "AAA2" "AAA3" )
+}
+
+// Make sure this also works not only in functions
+
+namespace check_scope3 {
+  using namespace first;
+  AAA//-22-
+  ; //#22# ( "AAA1" "AAA2" )
+}