[PATCH] D13931: [Tooling] Add a utility function to replace one nested name with another.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 07:50:26 PDT 2015


klimek added inline comments.

================
Comment at: include/clang/Tooling/Core/Lookup.h:37-38
@@ +36,4 @@
+/// \param FromDecl The declaration to which the nested name points.
+/// \param ReplacementString The replacement nested name. Should be qualified,
+///                          leading "::" is optional.
+/// \returns The new name to be inserted in place of the current nested name.
----------------
After some pondering, I think we should require a fully qualified name, as then it's really unambiguous from the call site what is happening.

================
Comment at: unittests/Tooling/LookupTest.cpp:69-73
@@ +68,7 @@
+
+  Visitor.OnCall = [&](CallExpr *Expr) {
+    EXPECT_EQ("bar", replaceCallExpr(Expr, "a::bar"));
+  };
+  Visitor.runOver("namespace a { namespace b { void foo(); }\n"
+                  "void f() { b::foo(); } }\n");
+
----------------
Do we already have a test that tests c::bar with replaceCallExpr(Expr, "a::c::bar"), or do you think that obviously works from this test?


http://reviews.llvm.org/D13931





More information about the cfe-commits mailing list