mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] getIdentifierText, for when an Identifier isn't needed
Not everything that goes into the "identifier table" is actually an Identifier. If we don't need the string to be uniqued in the ASTContext, don't bother calling getIdentifier. May save some memory usage (and a string table lookup) for deserialization.
This commit is contained in:
@@ -314,11 +314,11 @@ private:
|
||||
|
||||
/// Represents an identifier that may or may not have been deserialized yet.
|
||||
///
|
||||
/// If \c Offset is non-zero, the identifier has not been loaded yet.
|
||||
/// If \c Ident is empty, the identifier has not been loaded yet.
|
||||
class SerializedIdentifier {
|
||||
public:
|
||||
Identifier Ident;
|
||||
serialization::BitOffset Offset;
|
||||
unsigned Offset;
|
||||
|
||||
template <typename IntTy>
|
||||
/*implicit*/ SerializedIdentifier(IntTy rawOffset)
|
||||
@@ -793,6 +793,11 @@ public:
|
||||
/// given ID. Asserts that the name with this ID is not special.
|
||||
Identifier getIdentifier(serialization::IdentifierID IID);
|
||||
|
||||
/// Convenience method to retrieve the text of the name with the given ID.
|
||||
/// This can be used if the result doesn't need to be uniqued in the
|
||||
/// ASTContext. Asserts that the name with this ID is not special.
|
||||
StringRef getIdentifierText(serialization::IdentifierID IID);
|
||||
|
||||
/// Returns the decl with the given ID, deserializing it if needed.
|
||||
///
|
||||
/// \param DID The ID for the decl within this module.
|
||||
|
||||
Reference in New Issue
Block a user