diff options
Diffstat (limited to 'clang/lib/Rewrite/FrontendActions.cpp')
-rw-r--r-- | clang/lib/Rewrite/FrontendActions.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Rewrite/FrontendActions.cpp b/clang/lib/Rewrite/FrontendActions.cpp index ec99ace18a9..33e79edaf93 100644 --- a/clang/lib/Rewrite/FrontendActions.cpp +++ b/clang/lib/Rewrite/FrontendActions.cpp @@ -58,11 +58,10 @@ public: } std::string RewriteFilename(const std::string &Filename) { - llvm::sys::Path Path(Filename); - std::string Suffix = Path.getSuffix(); - Path.eraseSuffix(); - Path.appendSuffix(NewSuffix + "." + Suffix); - return Path.c_str(); + llvm::SmallString<128> Path(Filename); + llvm::sys::path::replace_extension(Path, + NewSuffix + llvm::sys::path::extension(Path)); + return Path.str(); } }; } // end anonymous namespace |