summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-08-14 01:55:37 +0000
committerReid Kleckner <rnk@google.com>2018-08-14 01:55:37 +0000
commit11f9f8acdec0685d39099ea25ac2cb49f82003a9 (patch)
tree6e59af817088865427f48a1f3fa743e90dce77e5 /clang/lib/Serialization/ASTWriter.cpp
parentc7816800d87f848907b1c86d6fc614ad03585c46 (diff)
downloadbcm5719-llvm-11f9f8acdec0685d39099ea25ac2cb49f82003a9.tar.gz
bcm5719-llvm-11f9f8acdec0685d39099ea25ac2cb49f82003a9.zip
Revert r339623 "Model type attributes as regular Attrs."
This breaks compiling atlwin.h in Chromium. I'm sure the code is invalid in some way, but we put a lot of work into accepting it, and I'm sure rejecting it was not an intended consequence of this refactoring. :) llvm-svn: 339638
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index f2fde2c76f2..ea3a75da48a 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -770,7 +770,19 @@ void TypeLocWriter::VisitEnumTypeLoc(EnumTypeLoc TL) {
}
void TypeLocWriter::VisitAttributedTypeLoc(AttributedTypeLoc TL) {
- Record.AddAttr(TL.getAttr());
+ Record.AddSourceLocation(TL.getAttrNameLoc());
+ if (TL.hasAttrOperand()) {
+ SourceRange range = TL.getAttrOperandParensRange();
+ Record.AddSourceLocation(range.getBegin());
+ Record.AddSourceLocation(range.getEnd());
+ }
+ if (TL.hasAttrExprOperand()) {
+ Expr *operand = TL.getAttrExprOperand();
+ Record.push_back(operand ? 1 : 0);
+ if (operand) Record.AddStmt(operand);
+ } else if (TL.hasAttrEnumOperand()) {
+ Record.AddSourceLocation(TL.getAttrEnumOperandLoc());
+ }
}
void TypeLocWriter::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) {
@@ -4469,21 +4481,16 @@ void ASTWriter::WriteModuleFileExtension(Sema &SemaRef,
// General Serialization Routines
//===----------------------------------------------------------------------===//
-void ASTRecordWriter::AddAttr(const Attr *A) {
+/// Emit the list of attributes to the specified record.
+void ASTRecordWriter::AddAttributes(ArrayRef<const Attr *> Attrs) {
auto &Record = *this;
- if (!A)
- return Record.push_back(0);
- Record.push_back(A->getKind() + 1); // FIXME: stable encoding, target attrs
- Record.AddSourceRange(A->getRange());
+ Record.push_back(Attrs.size());
+ for (const auto *A : Attrs) {
+ Record.push_back(A->getKind()); // FIXME: stable encoding, target attrs
+ Record.AddSourceRange(A->getRange());
#include "clang/Serialization/AttrPCHWrite.inc"
-}
-
-/// Emit the list of attributes to the specified record.
-void ASTRecordWriter::AddAttributes(ArrayRef<const Attr *> Attrs) {
- push_back(Attrs.size());
- for (const auto *A : Attrs)
- AddAttr(A);
+ }
}
void ASTWriter::AddToken(const Token &Tok, RecordDataImpl &Record) {
OpenPOWER on IntegriCloud