@@ -136,7 +136,7 @@ class SwiftDispatcher {
136
136
std::string filepath = getFilepath (start);
137
137
auto fileLabel = arena.allocateLabel <FileTag>();
138
138
trap.assignKey (fileLabel, filepath);
139
- // / TODO: do not emit duplicate trap entries for Files
139
+ // TODO: do not emit duplicate trap entries for Files
140
140
trap.emit (FilesTrap{fileLabel, filepath});
141
141
auto [startLine, startColumn] = sourceManager.getLineAndColumnInBuffer (start);
142
142
auto [endLine, endColumn] = sourceManager.getLineAndColumnInBuffer (end);
@@ -148,15 +148,22 @@ class SwiftDispatcher {
148
148
}
149
149
150
150
std::string getFilepath (swift::SourceLoc loc) {
151
- // / TODO: this needs more testing
151
+ // TODO: this needs more testing
152
+ // TODO: check canonicaliztion of names on a case insensitive filesystems
153
+ // TODO: make symlink resolution conditional on CODEQL_PRESERVE_SYMLINKS=true
152
154
std::string displayName = sourceManager.getDisplayNameForLoc (loc).str ();
153
155
llvm::SmallString<PATH_MAX> filePath (displayName);
154
156
if (std::error_code ec = llvm::sys::fs::make_absolute (filePath)) {
155
157
std::cerr << " Cannot make absolute path: '" << displayName << " ': " << ec.message () << " \n " ;
156
158
return {};
157
159
}
158
- llvm::sys::path::remove_dots (filePath);
159
- return filePath.str ().str ();
160
+ 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 " ;
164
+ return {};
165
+ }
166
+ return realPath.str ().str ();
160
167
}
161
168
162
169
// TODO: The following methods are supposed to redirect TRAP emission to correpsonding visitors,
0 commit comments