aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-08-26 14:27:30 +0000
committerDouglas Gregor <dgregor@apple.com>2009-08-26 14:27:30 +0000
commit91a2886d558ea6ca7a0bed73ab5acea5ae78eac2 (patch)
tree1d297e1668b7e3054281c81b3896097f33669c10 /lib/Parse/ParseDecl.cpp
parenteb1a1b6df0ba8d6d42e16f056cf54a2c87780ffe (diff)
Fix bug in __extension__ handling for declarations, from Abramo
Bagnara with a fix from Enea Zaffanella! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 8cb8ffdd05..c29f601f29 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1509,10 +1509,19 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
// Convert them all to fields.
for (unsigned i = 0, e = FieldDeclarators.size(); i != e; ++i) {
FieldDeclarator &FD = FieldDeclarators[i];
+ DeclPtrTy Field;
// Install the declarator into the current TagDecl.
- DeclPtrTy Field = Actions.ActOnField(CurScope, TagDecl,
- DS.getSourceRange().getBegin(),
- FD.D, FD.BitfieldSize);
+ if (FD.D.getExtension()) {
+ // Silences extension warnings
+ ExtensionRAIIObject O(Diags);
+ Field = Actions.ActOnField(CurScope, TagDecl,
+ DS.getSourceRange().getBegin(),
+ FD.D, FD.BitfieldSize);
+ } else {
+ Field = Actions.ActOnField(CurScope, TagDecl,
+ DS.getSourceRange().getBegin(),
+ FD.D, FD.BitfieldSize);
+ }
FieldDecls.push_back(Field);
}
} else { // Handle @defs
@@ -2016,6 +2025,8 @@ void Parser::ParseDeclarator(Declarator &D) {
void Parser::ParseDeclaratorInternal(Declarator &D,
DirectDeclParseFunction DirectDeclParser) {
+ if (Diags.hasAllExtensionsSilenced())
+ D.setExtension();
// C++ member pointers start with a '::' or a nested-name.
// Member pointers get special handling, since there's no place for the
// scope spec in the generic path below.