@@ -136,7 +136,7 @@ class SwiftDispatcher {
136136 std::string filepath = getFilepath (start);
137137 auto fileLabel = arena.allocateLabel <FileTag>();
138138 trap.assignKey (fileLabel, filepath);
139- // / TODO: do not emit duplicate trap entries for Files
139+ // TODO: do not emit duplicate trap entries for Files
140140 trap.emit (FilesTrap{fileLabel, filepath});
141141 auto [startLine, startColumn] = sourceManager.getLineAndColumnInBuffer (start);
142142 auto [endLine, endColumn] = sourceManager.getLineAndColumnInBuffer (end);
@@ -148,15 +148,22 @@ class SwiftDispatcher {
148148 }
149149
150150 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
152154 std::string displayName = sourceManager.getDisplayNameForLoc (loc).str ();
153155 llvm::SmallString<PATH_MAX> filePath (displayName);
154156 if (std::error_code ec = llvm::sys::fs::make_absolute (filePath)) {
155157 std::cerr << " Cannot make absolute path: '" << displayName << " ': " << ec.message () << " \n " ;
156158 return {};
157159 }
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 ();
160167 }
161168
162169 // TODO: The following methods are supposed to redirect TRAP emission to correpsonding visitors,
0 commit comments