[clang] [cindex] Add support for calling getFullyQualifiedName to the Python binding. (PR #135420)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 12 23:23:56 PDT 2025


================
@@ -535,6 +535,28 @@ def test_pretty(self):
         pp.set_property(PrintingPolicyProperty.SuppressTagKeyword, False)
         self.assertEqual(f.type.get_canonical().pretty_printed(pp), "struct X")
 
+    def test_fully_qualified_name(self):
+        source = """
+        namespace home {
+          class Bar {
+          };
+          class Foo {
+            public:
+              void setIt(Bar*);
+          };
+        }
+        class A : public home::Foo {
+        };
+        """
+        tu = get_tu(source, lang="cpp")
+        c = get_cursor(tu, "A")
+        pp = PrintingPolicy.create(c)
+        base = list(c.get_children())[0].type.get_declaration()
+        set_it = list(base.get_children())[1]
+        arg = list(set_it.get_arguments())[0]
----------------
DeinAlptraum wrote:

This seems a bit roundabout, why not do something like
```suggestion
        arg = next(get_cursor(tu, "setIt").get_arguments())
```
You also don't need `class A` at as far as I can tell. 

https://github.com/llvm/llvm-project/pull/135420


More information about the cfe-commits mailing list