File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -176,12 +176,19 @@ void ProjectBuildDatabase::initInfo(const nlohmann::json &linkCommandsJson) {
176
176
}
177
177
targetInfo->addFile (currentFile);
178
178
if (Paths::isObjectFile (currentFile)) {
179
- if (!CollectionUtils::containsKey (objectFileInfos, currentFile)) {
179
+ if (!CollectionUtils::containsKey (objectFileInfos, currentFile) &&
180
+ !CollectionUtils::containsKey (objectFileInfos,
181
+ relative (currentFile, directory))) {
180
182
throw CompilationDatabaseException (
181
- " compile_commands.json doesn't contain a command for object file "
182
- + currentFile.string ());
183
+ " compile_commands.json doesn't contain a command for object file " +
184
+ currentFile.string ());
185
+ }
186
+ if (CollectionUtils::containsKey (objectFileInfos, currentFile)) {
187
+ objectFileInfos[currentFile]->linkUnit = output;
188
+ } else if (CollectionUtils::containsKey (objectFileInfos,
189
+ relative (currentFile, directory))) {
190
+ objectFileInfos[relative (currentFile, directory)]->linkUnit = output;
183
191
}
184
- objectFileInfos[currentFile]->linkUnit = output;
185
192
}
186
193
}
187
194
targetInfo->commands .emplace_back (command);
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ namespace CompilationUtils {
96
96
}
97
97
}
98
98
99
- StringUtils::replaceAll (directoryField, userSystemProjectPath, projectPathStr);
99
+ // StringUtils::replaceAll(directoryField, userSystemProjectPath, projectPathStr);
100
100
cmd[directoryFieldName] = directoryField;
101
101
102
102
if (cmd.contains (fileFieldName)) {
You can’t perform that action at this time.
0 commit comments