diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-24 03:33:22 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-24 03:33:22 +0000 |
commit | 79bf92055219324f3777a71faedfb2ccdd8f9599 (patch) | |
tree | bae3349af9e2d6044f5fdbf162d2fff4e4c02ea8 /clang/lib/Serialization/ASTReader.cpp | |
parent | d134a67ce9537bba2947df75cd65c31246bbbdd9 (diff) | |
download | bcm5719-llvm-79bf92055219324f3777a71faedfb2ccdd8f9599.tar.gz bcm5719-llvm-79bf92055219324f3777a71faedfb2ccdd8f9599.zip |
[modules] Stop updating all identifiers when writing a module. This is
unnecessary in C++ modules (where we don't need the identifiers for their
Decls) and expensive.
llvm-svn: 245821
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 9899eaf6989..8e19c708f73 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -755,6 +755,12 @@ static bool readBit(unsigned &Bits) { return Value; } +IdentID ASTIdentifierLookupTrait::ReadIdentifierID(const unsigned char *d) { + using namespace llvm::support; + unsigned RawID = endian::readNext<uint32_t, little, unaligned>(d); + return Reader.getGlobalIdentifierID(F, RawID >> 1); +} + IdentifierInfo *ASTIdentifierLookupTrait::ReadData(const internal_key_type& k, const unsigned char* d, unsigned DataLen) { @@ -3455,7 +3461,20 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName, ASTIdentifierLookupTrait Trait(*this, F); auto KeyDataLen = Trait.ReadKeyDataLength(Data); auto Key = Trait.ReadKey(Data, KeyDataLen.first); - PP.getIdentifierTable().getOwn(Key).setOutOfDate(true); + auto &II = PP.getIdentifierTable().getOwn(Key); + II.setOutOfDate(true); + + // Mark this identifier as being from an AST file so that we can track + // whether we need to serialize it. + if (!II.isFromAST()) { + II.setIsFromAST(); + if (isInterestingIdentifier(*this, II, F.isModule())) + II.setChangedSinceDeserialization(); + } + + // Associate the ID with the identifier so that the writer can reuse it. + auto ID = Trait.ReadIdentifierID(Data + KeyDataLen.first); + SetIdentifierInfo(ID, &II); } } |