summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/clang-move/ClangMove.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-move/ClangMove.cpp b/clang-tools-extra/clang-move/ClangMove.cpp
index c8365f07f86..268d31dc4b9 100644
--- a/clang-tools-extra/clang-move/ClangMove.cpp
+++ b/clang-tools-extra/clang-move/ClangMove.cpp
@@ -233,10 +233,10 @@ createInsertedReplacements(const std::vector<std::string> &Includes,
std::string NewCode;
std::string GuardName(FileName);
if (IsHeader) {
- std::replace(GuardName.begin(), GuardName.end(), '/', '_');
- std::replace(GuardName.begin(), GuardName.end(), '.', '_');
- std::replace(GuardName.begin(), GuardName.end(), '-', '_');
-
+ for (size_t i = 0; i < GuardName.size(); ++i) {
+ if (!isAlphanumeric(GuardName[i]))
+ GuardName[i] = '_';
+ }
GuardName = StringRef(GuardName).upper();
NewCode += "#ifndef " + GuardName + "\n";
NewCode += "#define " + GuardName + "\n";
OpenPOWER on IntegriCloud