[PATCH] D25771: [change-namespace] shorten namespace qualifier based on UsingDecl and UsingDirectiveDecl.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 8 11:06:53 PST 2016


hokein added inline comments.


================
Comment at: change-namespace/ChangeNamespace.cpp:233
+                             const DeclContext *DeclCtx, SourceLocation Loc) {
+  return SM.isBeforeInTranslationUnit(SM.getSpellingLoc(D->getLocation()),
+                                      SM.getSpellingLoc(Loc)) &&
----------------
I will create two variables for `SM.getSpellingLoc(D->getLocation())` and `SM.getSpellingLoc(Loc)` to avoid redundant function call.


================
Comment at: change-namespace/ChangeNamespace.cpp:569
+    StringRef FromDeclNameRef = FromDeclName;
+    if (FromDeclNameRef.consume_front(UsingNamespace->getNominatedNamespace()
+                                          ->getQualifiedNameAsString())) {
----------------
Shouldn't we check whether the using namespace decl is visible here? 


https://reviews.llvm.org/D25771





More information about the cfe-commits mailing list