summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/Tooling.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-05-23 22:24:20 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-05-23 22:24:20 +0000
commit9b2d17c6137b5d79c7e1765e24ad35465a7fa095 (patch)
treed648dc09adc3aa26d0bad7c28363472bc9f1fb80 /clang/lib/Tooling/Tooling.cpp
parente351e8c52d2c6a95142c536ad929186940b1a748 (diff)
downloadbcm5719-llvm-9b2d17c6137b5d79c7e1765e24ad35465a7fa095.tar.gz
bcm5719-llvm-9b2d17c6137b5d79c7e1765e24ad35465a7fa095.zip
Tooling: Canonicalize Key in IndexByFile[]. llvm::sys::path::native() may be used here.
It fixes test/Tooling on Win32 hosts. llvm-svn: 157350
Diffstat (limited to 'clang/lib/Tooling/Tooling.cpp')
-rw-r--r--clang/lib/Tooling/Tooling.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp
index abd670380e9..a4a63e249f8 100644
--- a/clang/lib/Tooling/Tooling.cpp
+++ b/clang/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(
OpenPOWER on IntegriCloud