summaryrefslogtreecommitdiffstats
path: root/clang/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
commit9ab44ea6bd4d53626a6eb9507ab303e97c3cfe3b (patch)
tree9ed1d1e9c5c56e401df18f0943e7c3e6df15272b /clang/lib/Serialization/ASTWriter.cpp
parente394f2ca8bb845d6d25e99c2438d5aa4c36dffd3 (diff)
downloadbcm5719-llvm-9ab44ea6bd4d53626a6eb9507ab303e97c3cfe3b.tar.gz
bcm5719-llvm-9ab44ea6bd4d53626a6eb9507ab303e97c3cfe3b.zip
Introduce ASTWriter::GetOrCreateTypeID and move most of the functionality of AddTypeRef there.
No functionality change. llvm-svn: 111633
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 16c6f4b1010..5a376a9f12c 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud