aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-20 16:04:14 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-08-20 16:04:14 +0000
commit7fb35182f43392cea4517c203bbabb22364a19fc (patch)
treef31809d22c0a3c78bd0bf253f0962663dd7b5173 /lib/Serialization/ASTWriter.cpp
parent26fca90786af17f97e1a5ecc310d4bf39b831595 (diff)
Introduce ASTWriter::GetOrCreateTypeID and move most of the functionality of AddTypeRef there.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111633 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r--lib/Serialization/ASTWriter.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 16c6f4b101..5a376a9f12 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -2579,21 +2579,18 @@ void ASTWriter::AddTypeSourceInfo(TypeSourceInfo *TInfo, RecordData &Record) {
}
void ASTWriter::AddTypeRef(QualType T, RecordData &Record) {
- if (T.isNull()) {
- Record.push_back(PREDEF_TYPE_NULL_ID);
- return;
- }
+ Record.push_back(GetOrCreateTypeID(T));
+}
+
+TypeID ASTWriter::GetOrCreateTypeID(QualType T) {
+ if (T.isNull())
+ return PREDEF_TYPE_NULL_ID;
unsigned FastQuals = T.getLocalFastQualifiers();
T.removeFastQualifiers();
- if (T.hasLocalNonFastQualifiers()) {
- TypeIdx Idx = GetOrCreateTypeIdx(T);
-
- // Encode the type qualifiers in the type reference.
- Record.push_back(Idx.asTypeID(FastQuals));
- return;
- }
+ if (T.hasLocalNonFastQualifiers())
+ return GetOrCreateTypeIdx(T).asTypeID(FastQuals);
assert(!T.hasLocalQualifiers());
@@ -2633,14 +2630,10 @@ void ASTWriter::AddTypeRef(QualType T, RecordData &Record) {
break;
}
- Record.push_back(TypeIdx(ID).asTypeID(FastQuals));
- return;
+ return TypeIdx(ID).asTypeID(FastQuals);
}
- TypeIdx Idx = GetOrCreateTypeIdx(T);
-
- // Encode the type qualifiers in the type reference.
- Record.push_back(Idx.asTypeID(FastQuals));
+ return GetOrCreateTypeIdx(T).asTypeID(FastQuals);
}
TypeIdx ASTWriter::GetOrCreateTypeIdx(QualType T) {