Skip to content

Commit 35467bc

Browse files
committed
Swift: rely on llvm::sys::fs::real_path to get absolute path
1 parent 043b1b9 commit 35467bc

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

swift/extractor/SwiftDispatcher.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,10 @@ class SwiftDispatcher {
151151
// TODO: this needs more testing
152152
// TODO: check canonicaliztion of names on a case insensitive filesystems
153153
// TODO: make symlink resolution conditional on CODEQL_PRESERVE_SYMLINKS=true
154-
std::string displayName = sourceManager.getDisplayNameForLoc(loc).str();
155-
llvm::SmallString<PATH_MAX> filePath(displayName);
156-
if (std::error_code ec = llvm::sys::fs::make_absolute(filePath)) {
157-
std::cerr << "Cannot make absolute path: '" << displayName << "': " << ec.message() << "\n";
158-
return {};
159-
}
154+
auto displayName = sourceManager.getDisplayNameForLoc(loc);
160155
llvm::SmallString<PATH_MAX> realPath;
161-
if (std::error_code ec = llvm::sys::fs::real_path(filePath, realPath)) {
162-
std::cerr << "Cannot get real path: '" << filePath.str().str() << "': " << ec.message()
163-
<< "\n";
156+
if (std::error_code ec = llvm::sys::fs::real_path(displayName, realPath)) {
157+
std::cerr << "Cannot get real path: '" << displayName.str() << "': " << ec.message() << "\n";
164158
return {};
165159
}
166160
return realPath.str().str();

0 commit comments

Comments
 (0)