diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -3645,13 +3645,13 @@ // file. SmallVector IIs; for (const auto &ID : PP.getIdentifierTable()) - IIs.push_back(ID.second); - // Sort the identifiers lexicographically before getting them references so + if (Trait.isInterestingNonMacroIdentifier(ID.second)) + IIs.push_back(ID.second); + // Sort the identifiers lexicographically before getting the references so // that their order is stable. llvm::sort(IIs, llvm::deref>()); for (const IdentifierInfo *II : IIs) - if (Trait.isInterestingNonMacroIdentifier(II)) - getIdentifierRef(II); + getIdentifierRef(II); // Create the on-disk hash table representation. We only store offsets // for identifiers that appear here for the first time.