[llvm-commits] [llvm-gcc-4.2] r44230 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Duncan Sands
baldrick at free.fr
Mon Nov 19 07:05:12 PST 2007
Author: baldrick
Date: Mon Nov 19 09:05:10 2007
New Revision: 44230
URL: http://llvm.org/viewvc/llvm-project?rev=44230&view=rev
Log:
Add attributes corresponding to gcc's nothrow and
noreturn. Get attributes via flags_from_decl_or_type.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=44230&r1=44229&r2=44230&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Nov 19 09:05:10 2007
@@ -1023,12 +1023,22 @@
ParamAttrsVector Attrs;
uint16_t RAttributes = ParamAttr::None;
+ int flags = flags_from_decl_or_type(decl ? decl : type);
+
// Check for 'const' function attribute
- if (decl && TREE_READONLY(decl))
+ if (flags & ECF_CONST)
RAttributes |= ParamAttr::Const;
+ // Check for 'noreturn' function attribute
+ if (flags & ECF_NORETURN)
+ RAttributes |= ParamAttr::NoReturn;
+
+ // Check for 'nounwind' function attribute
+ if (flags & ECF_NOTHROW)
+ RAttributes |= ParamAttr::NoUnwind;
+
// Check for 'pure' function attribute
- if (decl && DECL_IS_PURE(decl))
+ if (flags & ECF_PURE)
RAttributes |= ParamAttr::Pure;
// Compute whether the result needs to be zext or sext'd
More information about the llvm-commits
mailing list