diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
| commit | bca07a4524feb4edec581062d631a13116320a24 (patch) | |
| tree | a9243275843fbeaa590afc07ee888e006b8d54ea /lib/Rewrite/FrontendActions.cpp | |
| parent | 998bc5802ecdd65ce3b270f6c69a8ae8557f0a10 (diff) | |
Notes
Diffstat (limited to 'lib/Rewrite/FrontendActions.cpp')
| -rw-r--r-- | lib/Rewrite/FrontendActions.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Rewrite/FrontendActions.cpp b/lib/Rewrite/FrontendActions.cpp index 977e0cfba6d0..33e79edaf93b 100644 --- a/lib/Rewrite/FrontendActions.cpp +++ b/lib/Rewrite/FrontendActions.cpp @@ -20,7 +20,7 @@ #include "clang/Rewrite/Rewriters.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/System/Path.h" +#include "llvm/Support/Path.h" using namespace clang; //===----------------------------------------------------------------------===// @@ -42,6 +42,7 @@ ASTConsumer *FixItAction::CreateASTConsumer(CompilerInstance &CI, return new ASTConsumer(); } +namespace { class FixItRewriteInPlace : public FixItOptions { public: std::string RewriteFilename(const std::string &Filename) { return Filename; } @@ -57,13 +58,13 @@ 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 bool FixItAction::BeginSourceFileAction(CompilerInstance &CI, llvm::StringRef Filename) { |
