[llvm-branch-commits] [cfe-branch] r105030 - in /cfe/branches/Apple/whitney: include/clang/Parse/Action.h lib/Parse/ParsePragma.cpp lib/Sema/SemaAttr.cpp test/Sema/pragma-pack-and-options-align.c
Daniel Dunbar
daniel at zuster.org
Fri May 28 16:06:23 PDT 2010
Author: ddunbar
Date: Fri May 28 18:06:23 2010
New Revision: 105030
URL: http://llvm.org/viewvc/llvm-project?rev=105030&view=rev
Log:
Merge r104864:
--
Author: Daniel Dunbar <daniel at zuster.org>
Date: Thu May 27 18:42:09 2010 +0000
Parse/Sema: Add support for '#pragma options align=native'.
Modified:
cfe/branches/Apple/whitney/include/clang/Parse/Action.h
cfe/branches/Apple/whitney/lib/Parse/ParsePragma.cpp
cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp
cfe/branches/Apple/whitney/test/Sema/pragma-pack-and-options-align.c
Modified: cfe/branches/Apple/whitney/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Parse/Action.h?rev=105030&r1=105029&r2=105030&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Parse/Action.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Parse/Action.h Fri May 28 18:06:23 2010
@@ -2565,6 +2565,7 @@
//===---------------------------- Pragmas -------------------------------===//
enum PragmaOptionsAlignKind {
+ POAK_Native, // #pragma options align=native
POAK_Natural, // #pragma options align=natural
POAK_Power, // #pragma options align=power
POAK_Mac68k, // #pragma options align=mac68k
Modified: cfe/branches/Apple/whitney/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Parse/ParsePragma.cpp?rev=105030&r1=105029&r2=105030&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Parse/ParsePragma.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Parse/ParsePragma.cpp Fri May 28 18:06:23 2010
@@ -110,7 +110,7 @@
LParenLoc, RParenLoc);
}
-// #pragma 'options' 'align' '=' {'natural', 'mac68k', 'power', 'reset'}
+// #pragma 'options' 'align' '=' {'native','natural','mac68k','power','reset'}
void PragmaOptionsHandler::HandlePragma(Preprocessor &PP, Token &OptionsTok) {
SourceLocation OptionsLoc = OptionsTok.getLocation();
@@ -120,7 +120,7 @@
PP.Diag(Tok.getLocation(), diag::warn_pragma_options_expected_align);
return;
}
-
+
PP.Lex(Tok);
if (Tok.isNot(tok::equal)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_options_expected_equal);
@@ -136,7 +136,9 @@
Action::PragmaOptionsAlignKind Kind = Action::POAK_Natural;
const IdentifierInfo *II = Tok.getIdentifierInfo();
- if (II->isStr("natural"))
+ if (II->isStr("native"))
+ Kind = Action::POAK_Native;
+ else if (II->isStr("natural"))
Kind = Action::POAK_Natural;
else if (II->isStr("power"))
Kind = Action::POAK_Power;
Modified: cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp?rev=105030&r1=105029&r2=105030&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp Fri May 28 18:06:23 2010
@@ -137,6 +137,10 @@
// We don't support #pragma options align=power.
switch (Kind) {
+ // For all targets we support native and natural are the same.
+ //
+ // FIXME: This is not true on Darwin/PPC.
+ case POAK_Native:
case POAK_Natural:
Context->push(0);
Context->setAlignment(0);
Modified: cfe/branches/Apple/whitney/test/Sema/pragma-pack-and-options-align.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/Sema/pragma-pack-and-options-align.c?rev=105030&r1=105029&r2=105030&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/Sema/pragma-pack-and-options-align.c (original)
+++ cfe/branches/Apple/whitney/test/Sema/pragma-pack-and-options-align.c Fri May 28 18:06:23 2010
@@ -16,6 +16,14 @@
};
extern int a[sizeof(struct s1) == 8 ? 1 : -1];
+#pragma options align=reset
+#pragma options align=native
+struct s1_1 {
+ char c;
+ int x;
+};
+extern int a[sizeof(struct s1_1) == 8 ? 1 : -1];
+
#pragma pack(pop)
struct s2 {
char c;
More information about the llvm-branch-commits
mailing list