[PATCH] D29176: [change-namespace] add leading '::' to references in new namespace when name conflict is possible.

Benjamin Kramer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 07:06:23 PST 2017


bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Only nits below.



================
Comment at: change-namespace/ChangeNamespace.cpp:232
+    auto &DeclNsTop = DeclNsSplitted.front();
+    for (auto &Ns : NsNameSplitted)
+      if (Ns == DeclNsTop)
----------------
This could use llvm::is_contained


================
Comment at: change-namespace/ChangeNamespace.cpp:237
+  }
+  // Since there is already an overlap namespace, we know that `DeclName` can be
+  // shortened.
----------------
I guess you could add here that you're now searching the longest common prefix.


================
Comment at: change-namespace/ChangeNamespace.cpp:243
+  auto NsE = NsNameSplitted.end();
+  for (; DeclI != DeclE && NsI != NsE && *DeclI == *NsI; ++DeclI, ++NsI) {
   }
----------------
Not sure if this should be a while loop. It's so ugly right now :(


https://reviews.llvm.org/D29176





More information about the cfe-commits mailing list