diff options
author | John McCall <rjmccall@apple.com> | 2011-01-06 01:58:22 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-01-06 01:58:22 +0000 |
commit | 8190451ddc7ee3021939ade3707cc5f6d7510188 (patch) | |
tree | a22a3173b7b062e0a7f42f0c95dfcdb40fab520c /clang/lib/Serialization/ASTWriter.cpp | |
parent | 4072e59189fe077ffae359e99268193af8cedb1c (diff) | |
download | bcm5719-llvm-8190451ddc7ee3021939ade3707cc5f6d7510188.tar.gz bcm5719-llvm-8190451ddc7ee3021939ade3707cc5f6d7510188.zip |
Introduce an AttributedType, but don't actually use it anywhere yet.
The initial TreeTransform is a cop-out, but it's more-or-less equivalent
to what we were doing before, or rather what we're doing now and might
eventually stop doing in favor of using this type.
I am simultaneously intrigued by the possibilities of rebuilding a
dependent Attri
llvm-svn: 122942
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 2c0239de17e..eb312522c7a 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -228,6 +228,13 @@ void ASTTypeWriter::VisitEnumType(const EnumType *T) { Code = TYPE_ENUM; } +void ASTTypeWriter::VisitAttributedType(const AttributedType *T) { + Writer.AddTypeRef(T->getModifiedType(), Record); + Writer.AddTypeRef(T->getEquivalentType(), Record); + Record.push_back(T->getAttrKind()); + Code = TYPE_ATTRIBUTED; +} + void ASTTypeWriter::VisitSubstTemplateTypeParmType( const SubstTemplateTypeParmType *T) { @@ -462,6 +469,21 @@ void TypeLocWriter::VisitRecordTypeLoc(RecordTypeLoc TL) { void TypeLocWriter::VisitEnumTypeLoc(EnumTypeLoc TL) { Writer.AddSourceLocation(TL.getNameLoc(), Record); } +void TypeLocWriter::VisitAttributedTypeLoc(AttributedTypeLoc TL) { + Writer.AddSourceLocation(TL.getAttrNameLoc(), Record); + if (TL.hasAttrOperand()) { + SourceRange range = TL.getAttrOperandParensRange(); + Writer.AddSourceLocation(range.getBegin(), Record); + Writer.AddSourceLocation(range.getEnd(), Record); + } + if (TL.hasAttrExprOperand()) { + Expr *operand = TL.getAttrExprOperand(); + Record.push_back(operand ? 1 : 0); + if (operand) Writer.AddStmt(operand); + } else if (TL.hasAttrEnumOperand()) { + Writer.AddSourceLocation(TL.getAttrEnumOperandLoc(), Record); + } +} void TypeLocWriter::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) { Writer.AddSourceLocation(TL.getNameLoc(), Record); } |