[cfe-commits] r171781 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/Sema/SemaDeclAttr.cpp test/Sema/attr-mode.c
Rafael Espindola
rafael.espindola at gmail.com
Mon Jan 7 11:58:54 PST 2013
Author: rafael
Date: Mon Jan 7 13:58:54 2013
New Revision: 171781
URL: http://llvm.org/viewvc/llvm-project?rev=171781&view=rev
Log:
Add support for attribute((mode(unwind_word))).
Patch by Nick Lewycky. Fixes pr8703.
Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/attr-mode.c
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=171781&r1=171780&r2=171781&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Mon Jan 7 13:58:54 2013
@@ -338,6 +338,9 @@
return getTypeWidth(IntMaxType);
}
+ // Return the size of unwind_word for this target.
+ unsigned getUnwindWordWidth() const { return getPointerWidth(0); }
+
/// \brief Return the "preferred" register width on this target.
uint64_t getRegisterWidth() const {
// Currently we assume the register width on the target matches the pointer
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=171781&r1=171780&r2=171781&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Jan 7 13:58:54 2013
@@ -3270,6 +3270,10 @@
if (Str == "pointer")
DestWidth = S.Context.getTargetInfo().getPointerWidth(0);
break;
+ case 11:
+ if (Str == "unwind_word")
+ DestWidth = S.Context.Target.getUnwindWordWidth();
+ break;
}
QualType OldTy;
Modified: cfe/trunk/test/Sema/attr-mode.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-mode.c?rev=171781&r1=171780&r2=171781&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-mode.c (original)
+++ cfe/trunk/test/Sema/attr-mode.c Mon Jan 7 13:58:54 2013
@@ -17,6 +17,8 @@
typedef struct {int i,j,k;} invalid_4 __attribute((mode(SI))); // expected-error{{mode attribute only supported for integer and floating-point types}}
typedef float invalid_5 __attribute((mode(SI))); // expected-error{{type of machine mode does not match type of base type}}
+typedef unsigned unwind_word __attribute((mode(unwind_word)));
+
int **__attribute((mode(QI)))* i32; // expected-error{{mode attribute}}
typedef _Complex double c32 __attribute((mode(SC)));
More information about the cfe-commits
mailing list