Index: clang/tools/libclang/Indexing.cpp =================================================================== --- clang/tools/libclang/Indexing.cpp +++ clang/tools/libclang/Indexing.cpp @@ -132,7 +132,7 @@ Set = ParsedRegions; } - void update(ArrayRef Regions) { + void update(const PPRegionSetTy& Regions) { std::lock_guard MG(Mux); ParsedRegions.insert(Regions.begin(), Regions.end()); } @@ -144,7 +144,8 @@ Preprocessor &PP; PPRegionSetTy ParsedRegions; - SmallVector NewParsedRegions; + PPRegionSetTy NewParsedRegions; + PPRegion LastRegion; bool LastIsParsed; @@ -166,9 +167,9 @@ return LastIsParsed; LastRegion = region; - LastIsParsed = ParsedRegions.count(region); + LastIsParsed = NewParsedRegions.count(region) || ParsedRegions.count(region); if (!LastIsParsed) - NewParsedRegions.push_back(region); + NewParsedRegions.insert(std::move(region)); return LastIsParsed; }