From acca9559f4fdf99de62537592d7d63409229857b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 13 Jan 2009 07:22:22 +0000 Subject: [PATCH] make -march=cpp handle the nocapture attribute, make it assert if it sees attributes it doesn't know. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62155 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CppBackend/CPPBackend.cpp | 41 +++++++++++++--------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 6bf463846f4..fff6ef034f1 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -450,28 +450,25 @@ namespace { unsigned index = PAL.getSlot(i).Index; Attributes attrs = PAL.getSlot(i).Attrs; Out << "PAWI.Index = " << index << "U; PAWI.Attrs = 0 "; - if (attrs & Attribute::SExt) - Out << " | Attribute::SExt"; - if (attrs & Attribute::ZExt) - Out << " | Attribute::ZExt"; - if (attrs & Attribute::StructRet) - Out << " | Attribute::StructRet"; - if (attrs & Attribute::InReg) - Out << " | Attribute::InReg"; - if (attrs & Attribute::NoReturn) - Out << " | Attribute::NoReturn"; - if (attrs & Attribute::NoUnwind) - Out << " | Attribute::NoUnwind"; - if (attrs & Attribute::ByVal) - Out << " | Attribute::ByVal"; - if (attrs & Attribute::NoAlias) - Out << " | Attribute::NoAlias"; - if (attrs & Attribute::Nest) - Out << " | Attribute::Nest"; - if (attrs & Attribute::ReadNone) - Out << " | Attribute::ReadNone"; - if (attrs & Attribute::ReadOnly) - Out << " | Attribute::ReadOnly"; +#define HANDLE_ATTR(X) \ + if (attrs & Attribute::X) \ + Out << " | Attribute::" #X; \ + attrs &= ~Attribute::X; + + HANDLE_ATTR(SExt); + HANDLE_ATTR(ZExt); + HANDLE_ATTR(StructRet); + HANDLE_ATTR(InReg); + HANDLE_ATTR(NoReturn); + HANDLE_ATTR(NoUnwind); + HANDLE_ATTR(ByVal); + HANDLE_ATTR(NoAlias); + HANDLE_ATTR(Nest); + HANDLE_ATTR(ReadNone); + HANDLE_ATTR(ReadOnly); + HANDLE_ATTR(NoCapture); +#undef HANDLE_ATTR + assert(attrs == 0 && "Unhandled attribute!"); Out << ";"; nl(Out); Out << "Attrs.push_back(PAWI);"; -- 2.34.1