diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaType.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 3b1dac348e..e849e05c7b 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -463,6 +463,15 @@ distributeFunctionTypeAttrFromDeclSpec(TypeProcessingState &state, QualType &declSpecType) { state.saveDeclSpecAttrs(); + // C++11 attributes before the decl specifiers actually appertain to + // the declarators. Move them straight there. We don't support the + // 'put them wherever you like' semantics we allow for GNU attributes. + if (attr.isCXX11Attribute()) { + moveAttrFromListToList(attr, state.getCurrentAttrListRef(), + state.getDeclarator().getAttrListRef()); + return; + } + // Try to distribute to the innermost. if (distributeFunctionTypeAttrToInnermost(state, attr, state.getCurrentAttrListRef(), @@ -512,6 +521,11 @@ static void distributeTypeAttrsFromDeclarator(TypeProcessingState &state, do { next = attr->getNext(); + // Do not distribute C++11 attributes. They have strict rules for what + // they appertain to. + if (attr->isCXX11Attribute()) + continue; + switch (attr->getKind()) { OBJC_POINTER_TYPE_ATTRS_CASELIST: distributeObjCPointerTypeAttrFromDeclarator(state, *attr, declSpecType); |