@@ -703,8 +703,10 @@ class Driver {
703
703
fullIndex.SerializeToOstream (&outputStream);
704
704
}
705
705
706
- bool isMultiplyIndexedApproximate (const std::string &relativePath,
707
- AbsolutePathRef shardPath) const {
706
+ bool
707
+ isMultiplyIndexedApproximate (const std::string &relativePath,
708
+ AbsolutePathRef shardPath,
709
+ absl::flat_hash_set<uint32_t > &badJobIds) const {
708
710
auto multiplyIndexed = this ->planner .isMultiplyIndexed (
709
711
RootRelativePathRef{relativePath, RootKind::Project});
710
712
bool isMultiplyIndexed;
@@ -719,15 +721,7 @@ class Driver {
719
721
if (auto optFileName = shardPath.fileName ()) {
720
722
if (auto optJobId = ShardPaths::tryParseJobId (*optFileName)) {
721
723
auto jobId = optJobId.value ();
722
- spdlog::info (" the unknown header was encountered when processing "
723
- " the compilation command at index {} in the "
724
- " compilation database" ,
725
- jobId);
726
- spdlog::info (
727
- " it may be possible to reproduce this issue by subsetting the "
728
- " compilation database using `jq '.[{}:{}]` {} > bad.json` and "
729
- " re-running `scip-clang --compdb-path=bad.json <flags...>`" ,
730
- jobId, jobId + 1 , this ->options .compdbPath .asStringRef ());
724
+ badJobIds.insert (jobId);
731
725
}
732
726
}
733
727
// Be conservative here
@@ -787,6 +781,8 @@ class Driver {
787
781
return true ;
788
782
};
789
783
784
+ absl::flat_hash_set<uint32_t > badJobIds{};
785
+
790
786
scip::IndexBuilder builder{fullIndex};
791
787
// TODO: Measure how much time this is taking and parallelize if too slow.
792
788
for (auto &paths : this ->shardPaths ) {
@@ -796,7 +792,7 @@ class Driver {
796
792
}
797
793
for (auto &doc : *indexShard.mutable_documents ()) {
798
794
bool isMultiplyIndexed = this ->isMultiplyIndexedApproximate (
799
- doc.relative_path (), paths.docsAndExternals .asRef ());
795
+ doc.relative_path (), paths.docsAndExternals .asRef (), badJobIds );
800
796
builder.addDocument (std::move (doc), isMultiplyIndexed);
801
797
}
802
798
// See NOTE(ref: precondition-deterministic-ext-symbol-docs); in
@@ -808,6 +804,21 @@ class Driver {
808
804
}
809
805
}
810
806
807
+ if (!badJobIds.empty ()) {
808
+ std::vector<uint32_t > badJobIdsSorted{badJobIds.begin (), badJobIds.end ()};
809
+ absl::c_sort (badJobIdsSorted);
810
+ spdlog::info (" previously unseen headers were encountered when processing"
811
+ " the compilation commands at indexes [{}] in the "
812
+ " compilation database" ,
813
+ fmt::join (badJobIdsSorted, " ," ));
814
+ spdlog::info (
815
+ " it may be possible to reproduce this issue by subsetting the "
816
+ " compilation database using `jq '[.[{}]]` {} > bad.json` and "
817
+ " re-running `scip-clang --compdb-path=bad.json <flags...>`" ,
818
+ fmt::join (badJobIdsSorted, " ," ),
819
+ this ->options .compdbPath .asStringRef ());
820
+ }
821
+
811
822
auto symbolToInfoMap = builder.populateSymbolToInfoMap ();
812
823
813
824
for (auto &paths : this ->shardPaths ) {
0 commit comments