Skip to content

Commit d316a0b

Browse files
committed
[NFC] Remove unused ASTWriter::getTypeID
As the title suggests, the `ASTWriter:getTypeID` method is not used. This patch removes it.
1 parent 8de7890 commit d316a0b

File tree

3 files changed

+25
-40
lines changed

3 files changed

+25
-40
lines changed

clang/include/clang/Serialization/ASTWriter.h

-3
Original file line numberDiff line numberDiff line change
@@ -715,9 +715,6 @@ class ASTWriter : public ASTDeserializationListener,
715715
/// Force a type to be emitted and get its ID.
716716
serialization::TypeID GetOrCreateTypeID(QualType T);
717717

718-
/// Determine the type ID of an already-emitted type.
719-
serialization::TypeID getTypeID(QualType T) const;
720-
721718
/// Find the first local declaration of a given local redeclarable
722719
/// decl.
723720
const Decl *getFirstLocalDecl(const Decl *D);

clang/lib/Serialization/ASTCommon.h

-24
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,6 @@ enum DeclUpdateKind {
4646

4747
TypeIdx TypeIdxFromBuiltin(const BuiltinType *BT);
4848

49-
template <typename IdxForTypeTy>
50-
TypeID MakeTypeID(ASTContext &Context, QualType T, IdxForTypeTy IdxForType) {
51-
if (T.isNull())
52-
return PREDEF_TYPE_NULL_ID;
53-
54-
unsigned FastQuals = T.getLocalFastQualifiers();
55-
T.removeLocalFastQualifiers();
56-
57-
if (T.hasLocalNonFastQualifiers())
58-
return IdxForType(T).asTypeID(FastQuals);
59-
60-
assert(!T.hasLocalQualifiers());
61-
62-
if (const BuiltinType *BT = dyn_cast<BuiltinType>(T.getTypePtr()))
63-
return TypeIdxFromBuiltin(BT).asTypeID(FastQuals);
64-
65-
if (T == Context.AutoDeductTy)
66-
return TypeIdx(PREDEF_TYPE_AUTO_DEDUCT).asTypeID(FastQuals);
67-
if (T == Context.AutoRRefDeductTy)
68-
return TypeIdx(PREDEF_TYPE_AUTO_RREF_DEDUCT).asTypeID(FastQuals);
69-
70-
return IdxForType(T).asTypeID(FastQuals);
71-
}
72-
7349
unsigned ComputeHash(Selector Sel);
7450

7551
/// Retrieve the "definitive" declaration that provides all of the

clang/lib/Serialization/ASTWriter.cpp

+25-13
Original file line numberDiff line numberDiff line change
@@ -6074,6 +6074,31 @@ void ASTWriter::AddTypeRef(QualType T, RecordDataImpl &Record) {
60746074
Record.push_back(GetOrCreateTypeID(T));
60756075
}
60766076

6077+
template <typename IdxForTypeTy>
6078+
static TypeID MakeTypeID(ASTContext &Context, QualType T,
6079+
IdxForTypeTy IdxForType) {
6080+
if (T.isNull())
6081+
return PREDEF_TYPE_NULL_ID;
6082+
6083+
unsigned FastQuals = T.getLocalFastQualifiers();
6084+
T.removeLocalFastQualifiers();
6085+
6086+
if (T.hasLocalNonFastQualifiers())
6087+
return IdxForType(T).asTypeID(FastQuals);
6088+
6089+
assert(!T.hasLocalQualifiers());
6090+
6091+
if (const BuiltinType *BT = dyn_cast<BuiltinType>(T.getTypePtr()))
6092+
return TypeIdxFromBuiltin(BT).asTypeID(FastQuals);
6093+
6094+
if (T == Context.AutoDeductTy)
6095+
return TypeIdx(PREDEF_TYPE_AUTO_DEDUCT).asTypeID(FastQuals);
6096+
if (T == Context.AutoRRefDeductTy)
6097+
return TypeIdx(PREDEF_TYPE_AUTO_RREF_DEDUCT).asTypeID(FastQuals);
6098+
6099+
return IdxForType(T).asTypeID(FastQuals);
6100+
}
6101+
60776102
TypeID ASTWriter::GetOrCreateTypeID(QualType T) {
60786103
assert(Context);
60796104
return MakeTypeID(*Context, T, [&](QualType T) -> TypeIdx {
@@ -6097,19 +6122,6 @@ TypeID ASTWriter::GetOrCreateTypeID(QualType T) {
60976122
});
60986123
}
60996124

6100-
TypeID ASTWriter::getTypeID(QualType T) const {
6101-
assert(Context);
6102-
return MakeTypeID(*Context, T, [&](QualType T) -> TypeIdx {
6103-
if (T.isNull())
6104-
return TypeIdx();
6105-
assert(!T.getLocalFastQualifiers());
6106-
6107-
TypeIdxMap::const_iterator I = TypeIdxs.find(T);
6108-
assert(I != TypeIdxs.end() && "Type not emitted!");
6109-
return I->second;
6110-
});
6111-
}
6112-
61136125
void ASTWriter::AddEmittedDeclRef(const Decl *D, RecordDataImpl &Record) {
61146126
if (!wasDeclEmitted(D))
61156127
return;

0 commit comments

Comments
 (0)