diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-10-26 00:51:02 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-10-26 00:51:02 +0000 |
| commit | f86c939bfffd40c8b37315dfed44b9f27ce4349e (patch) | |
| tree | 5b72d6c839dc29daaf1c08832837951410f99ba9 /clang/lib/Serialization | |
| parent | 5c01cb6b7750c467e19aea48331a8f588792f29d (diff) | |
| download | bcm5719-llvm-f86c939bfffd40c8b37315dfed44b9f27ce4349e.tar.gz bcm5719-llvm-f86c939bfffd40c8b37315dfed44b9f27ce4349e.zip | |
When de-serializing a type that is supposed to be canonical, call
getCanonicalType() to make sure that the type we got back is actually
canonical. This is the case for most types, which always build a
canonical type when given canonical components. However, some types that
involve expressions in their canonicalization (e.g., array types with
dependent sizes) don't always build canonical types from canonical
components, because there is no such thing as a "canonical"
expression. Therefore, we do this extra mapping to ensure that the
canonical types we store are actually canonical.
llvm-svn: 117344
Diffstat (limited to 'clang/lib/Serialization')
| -rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 38e786bff10..c0aff9afde3 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2764,6 +2764,8 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) { } TypedefDecl *Decl = cast<TypedefDecl>(GetDecl(Record[0])); QualType Canonical = GetType(Record[1]); + if (!Canonical.isNull()) + Canonical = Context->getCanonicalType(Canonical); return Context->getTypedefType(Decl, Canonical); } @@ -2867,6 +2869,8 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) { NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx); const IdentifierInfo *Name = this->GetIdentifierInfo(Record, Idx); QualType Canon = GetType(Record[Idx++]); + if (!Canon.isNull()) + Canon = Context->getCanonicalType(Canon); return Context->getDependentNameType(Keyword, NNS, Name, Canon); } |

