Skip to content

Commit 693ff52

Browse files
committed
update
1 parent d286f03 commit 693ff52

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

externals/simplecpp/simplecpp.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3273,11 +3273,18 @@ static std::string getFileIdPath(const std::map<std::string, simplecpp::TokenLis
32733273
}
32743274

32753275
if (!systemheader) {
3276-
const std::string absoluteFilename = getRelativeFileName(sourcefile, header, true);
3277-
const std::string match = findPathInMapBothRelativeAndAbsolute(filedata, absoluteFilename);
3276+
const std::string relativeFilename = getRelativeFileName(sourcefile, header, true);
3277+
const std::string match = findPathInMapBothRelativeAndAbsolute(filedata, relativeFilename);
32783278
if (!match.empty()) {
32793279
return match;
32803280
}
3281+
// if the file exists but hasn't been loaded yet then we need to stop searching here or we could get a false match
3282+
std::ifstream f;
3283+
openHeader(f, relativeFilename);
3284+
if (f.is_open()) {
3285+
f.close();
3286+
return "";
3287+
}
32813288
} else if (filedata.find(header) != filedata.end()) {
32823289
return header;// system header that its file is already in the filedata - return that as is
32833290
}

0 commit comments

Comments
 (0)