diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-01-07 19:58:54 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-01-07 19:58:54 +0000 |
commit | f0dafd3cbb951ac63c1994aca007d9eacc3948c7 (patch) | |
tree | b65cb4bc727cd723868f8f5d387cfb181b971770 | |
parent | fba226004d667028aec872945d1dd02cdfec7204 (diff) | |
download | bcm5719-llvm-f0dafd3cbb951ac63c1994aca007d9eacc3948c7.tar.gz bcm5719-llvm-f0dafd3cbb951ac63c1994aca007d9eacc3948c7.zip |
Add support for attribute((mode(unwind_word))).
Patch by Nick Lewycky. Fixes pr8703.
llvm-svn: 171781
-rw-r--r-- | clang/include/clang/Basic/TargetInfo.h | 3 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 4 | ||||
-rw-r--r-- | clang/test/Sema/attr-mode.c | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h index fbf2d30e4e2..328ffd96015 100644 --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -338,6 +338,9 @@ public: 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 diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index aabf061c321..accea53bb84 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3270,6 +3270,10 @@ static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (Str == "pointer") DestWidth = S.Context.getTargetInfo().getPointerWidth(0); break; + case 11: + if (Str == "unwind_word") + DestWidth = S.Context.Target.getUnwindWordWidth(); + break; } QualType OldTy; diff --git a/clang/test/Sema/attr-mode.c b/clang/test/Sema/attr-mode.c index 0c5336282c4..a89c8397e0a 100644 --- a/clang/test/Sema/attr-mode.c +++ b/clang/test/Sema/attr-mode.c @@ -17,6 +17,8 @@ typedef int invalid_3 __attribute((mode(II))); // expected-error{{unknown machin 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))); |