diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-05-23 22:24:20 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-05-23 22:24:20 +0000 |
commit | 62d198c5b1174279174eb35d222b5cee46f3ef6f (patch) | |
tree | 1d5928861931805f1da5d1da0d252fa1fb51f822 /lib/Tooling/Tooling.cpp | |
parent | 1b8fbd3601e009803565e74d2ec54abecb5cbf73 (diff) |
Tooling: Canonicalize Key in IndexByFile[]. llvm::sys::path::native() may be used here.
It fixes test/Tooling on Win32 hosts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157350 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Tooling/Tooling.cpp')
-rw-r--r-- | lib/Tooling/Tooling.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp index abd670380e..a4a63e249f 100644 --- a/lib/Tooling/Tooling.cpp +++ b/lib/Tooling/Tooling.cpp @@ -142,17 +142,21 @@ bool runToolOnCode(clang::FrontendAction *ToolAction, const Twine &Code, /// \param BaseDirectory An absolute path. static std::string getAbsolutePath( StringRef File, StringRef BaseDirectory) { + SmallString<1024> PathStorage; assert(llvm::sys::path::is_absolute(BaseDirectory)); if (llvm::sys::path::is_absolute(File)) { - return File; + llvm::sys::path::native(File, PathStorage); + return PathStorage.str(); } StringRef RelativePath(File); + // FIXME: Should '.\\' be accepted on Win32? if (RelativePath.startswith("./")) { RelativePath = RelativePath.substr(strlen("./")); } llvm::SmallString<1024> AbsolutePath(BaseDirectory); llvm::sys::path::append(AbsolutePath, RelativePath); - return AbsolutePath.str(); + llvm::sys::path::native(Twine(AbsolutePath), PathStorage); + return PathStorage.str(); } ToolInvocation::ToolInvocation( |