diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-27 06:01:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-27 06:01:06 +0000 |
commit | 4e3fcc845b43a890f660a8abcee5e358882c5e8e (patch) | |
tree | 2c033370a110ece655ccf7d69d65d276932d8a32 /lib/Frontend/PCHReader.cpp | |
parent | da93061f56d5820725b01a140879d047554e7d32 (diff) |
move attribute reading to PCHReaderDecl.cpp, remove some
extraneous braces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70191 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 4f60db9e68..5a018e4806 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -1711,140 +1711,6 @@ std::string PCHReader::ReadString(const RecordData &Record, unsigned &Idx) { return Result; } -/// \brief Reads attributes from the current stream position. -Attr *PCHReader::ReadAttributes() { - unsigned Code = DeclsCursor.ReadCode(); - assert(Code == llvm::bitc::UNABBREV_RECORD && - "Expected unabbreviated record"); (void)Code; - - RecordData Record; - unsigned Idx = 0; - unsigned RecCode = DeclsCursor.ReadRecord(Code, Record); - assert(RecCode == pch::DECL_ATTR && "Expected attribute record"); - (void)RecCode; - -#define SIMPLE_ATTR(Name) \ - case Attr::Name: \ - New = ::new (Context) Name##Attr(); \ - break - -#define STRING_ATTR(Name) \ - case Attr::Name: \ - New = ::new (Context) Name##Attr(ReadString(Record, Idx)); \ - break - -#define UNSIGNED_ATTR(Name) \ - case Attr::Name: \ - New = ::new (Context) Name##Attr(Record[Idx++]); \ - break - - Attr *Attrs = 0; - while (Idx < Record.size()) { - Attr *New = 0; - Attr::Kind Kind = (Attr::Kind)Record[Idx++]; - bool IsInherited = Record[Idx++]; - - switch (Kind) { - STRING_ATTR(Alias); - UNSIGNED_ATTR(Aligned); - SIMPLE_ATTR(AlwaysInline); - SIMPLE_ATTR(AnalyzerNoReturn); - STRING_ATTR(Annotate); - STRING_ATTR(AsmLabel); - - case Attr::Blocks: - New = ::new (Context) BlocksAttr( - (BlocksAttr::BlocksAttrTypes)Record[Idx++]); - break; - - case Attr::Cleanup: - New = ::new (Context) CleanupAttr( - cast<FunctionDecl>(GetDecl(Record[Idx++]))); - break; - - SIMPLE_ATTR(Const); - UNSIGNED_ATTR(Constructor); - SIMPLE_ATTR(DLLExport); - SIMPLE_ATTR(DLLImport); - SIMPLE_ATTR(Deprecated); - UNSIGNED_ATTR(Destructor); - SIMPLE_ATTR(FastCall); - - case Attr::Format: { - std::string Type = ReadString(Record, Idx); - unsigned FormatIdx = Record[Idx++]; - unsigned FirstArg = Record[Idx++]; - New = ::new (Context) FormatAttr(Type, FormatIdx, FirstArg); - break; - } - - SIMPLE_ATTR(GNUInline); - - case Attr::IBOutletKind: - New = ::new (Context) IBOutletAttr(); - break; - - SIMPLE_ATTR(NoReturn); - SIMPLE_ATTR(NoThrow); - SIMPLE_ATTR(Nodebug); - SIMPLE_ATTR(Noinline); - - case Attr::NonNull: { - unsigned Size = Record[Idx++]; - llvm::SmallVector<unsigned, 16> ArgNums; - ArgNums.insert(ArgNums.end(), &Record[Idx], &Record[Idx] + Size); - Idx += Size; - New = ::new (Context) NonNullAttr(&ArgNums[0], Size); - break; - } - - SIMPLE_ATTR(ObjCException); - SIMPLE_ATTR(ObjCNSObject); - SIMPLE_ATTR(ObjCOwnershipRetain); - SIMPLE_ATTR(ObjCOwnershipReturns); - SIMPLE_ATTR(Overloadable); - UNSIGNED_ATTR(Packed); - SIMPLE_ATTR(Pure); - UNSIGNED_ATTR(Regparm); - STRING_ATTR(Section); - SIMPLE_ATTR(StdCall); - SIMPLE_ATTR(TransparentUnion); - SIMPLE_ATTR(Unavailable); - SIMPLE_ATTR(Unused); - SIMPLE_ATTR(Used); - - case Attr::Visibility: - New = ::new (Context) VisibilityAttr( - (VisibilityAttr::VisibilityTypes)Record[Idx++]); - break; - - SIMPLE_ATTR(WarnUnusedResult); - SIMPLE_ATTR(Weak); - SIMPLE_ATTR(WeakImport); - } - - assert(New && "Unable to decode attribute?"); - New->setInherited(IsInherited); - New->setNext(Attrs); - Attrs = New; - } -#undef UNSIGNED_ATTR -#undef STRING_ATTR -#undef SIMPLE_ATTR - - // The list of attributes was built backwards. Reverse the list - // before returning it. - Attr *PrevAttr = 0, *NextAttr = 0; - while (Attrs) { - NextAttr = Attrs->getNext(); - Attrs->setNext(PrevAttr); - PrevAttr = Attrs; - Attrs = NextAttr; - } - - return PrevAttr; -} - DiagnosticBuilder PCHReader::Diag(unsigned DiagID) { return Diag(SourceLocation(), DiagID); } |