diff options
| author | Eric Liu <ioeric@google.com> | 2016-12-05 11:17:04 +0000 |
|---|---|---|
| committer | Eric Liu <ioeric@google.com> | 2016-12-05 11:17:04 +0000 |
| commit | 2dd0e1bca33c2408893f88d33c9c6595cbdc9484 (patch) | |
| tree | 9b99646ab212ce4456e09f73ee5921fbf8768397 /clang-tools-extra/change-namespace/ChangeNamespace.cpp | |
| parent | 7a6252158e2fa1f3dfd0a4c846db0c6365d3f3ea (diff) | |
| download | bcm5719-llvm-2dd0e1bca33c2408893f88d33c9c6595cbdc9484.tar.gz bcm5719-llvm-2dd0e1bca33c2408893f88d33c9c6595cbdc9484.zip | |
[change-namespace] get changing namespace to global correct.
llvm-svn: 288662
Diffstat (limited to 'clang-tools-extra/change-namespace/ChangeNamespace.cpp')
| -rw-r--r-- | clang-tools-extra/change-namespace/ChangeNamespace.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang-tools-extra/change-namespace/ChangeNamespace.cpp b/clang-tools-extra/change-namespace/ChangeNamespace.cpp index 7de4690ac11..c0a8fe0370e 100644 --- a/clang-tools-extra/change-namespace/ChangeNamespace.cpp +++ b/clang-tools-extra/change-namespace/ChangeNamespace.cpp @@ -210,7 +210,8 @@ std::string wrapCodeInNamespace(StringRef NestedNs, std::string Code) { if (Code.back() != '\n') Code += "\n"; llvm::SmallVector<StringRef, 4> NsSplitted; - NestedNs.split(NsSplitted, "::"); + NestedNs.split(NsSplitted, "::", /*MaxSplit=*/-1, + /*KeepEmpty=*/false); while (!NsSplitted.empty()) { // FIXME: consider code style for comments. Code = ("namespace " + NsSplitted.back() + " {\n" + Code + @@ -272,7 +273,9 @@ void ChangeNamespaceTool::registerMatchers(ast_matchers::MatchFinder *Finder) { // be "a::b". Declarations in this namespace will not be visible in the new // namespace. If DiffOldNamespace is empty, Prefix will be a invalid name "-". llvm::SmallVector<llvm::StringRef, 4> DiffOldNsSplitted; - llvm::StringRef(DiffOldNamespace).split(DiffOldNsSplitted, "::"); + llvm::StringRef(DiffOldNamespace) + .split(DiffOldNsSplitted, "::", /*MaxSplit=*/-1, + /*KeepEmpty=*/false); std::string Prefix = "-"; if (!DiffOldNsSplitted.empty()) Prefix = (StringRef(FullOldNs).drop_back(DiffOldNamespace.size()) + |

