================
@@ -322,3 +372,81 @@ void HeaderIncludesJSONCallback::FileSkipped(
IncludedHeaders.push_back(SkippedFile.getName().str());
}
+
+void HeaderIncludesDirectPerFileCallback::EndOfMainFile() {
+ if (Dependencies.empty())
+ return;
+
+ // Sort the files so that the output does not depend on the DenseMap order.
+ SmallVector<FileEntryRef> SourceFiles;
+ for (auto F = Dependencies.begin(), FEnd = Dependencies.end(); F != FEnd;
+ ++F) {
+ SourceFiles.push_back(F->first);
+ }
+ llvm::sort(SourceFiles, [](const FileEntryRef &LHS, const FileEntryRef &RHS)
{
+ return LHS.getUID() < RHS.getUID();
----------------
Bigcheese wrote:
This is stable in the order of files opened. That's probably fine, but can
change order if the source code changes.
https://github.com/llvm/llvm-project/pull/137087
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits