diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 9c17d6eabdaad09307197319650012ee170807b8..bd81c27ad1736d204cfcea79550040ecc351d5dd 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -912,47 +912,16 @@ static void handleLocksExcludedAttr(Sema &S, Decl *D, static void handleExtVectorTypeAttr(Sema &S, Scope *scope, Decl *D, const AttributeList &Attr) { - TypedefNameDecl *tDecl = dyn_cast<TypedefNameDecl>(D); - if (tDecl == 0) { + TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D); + if (TD == 0) { + // __attribute__((ext_vector_type(N))) can only be applied to typedefs + // and type-ids. S.Diag(Attr.getLoc(), diag::err_typecheck_ext_vector_not_typedef); return; } - QualType curType = tDecl->getUnderlyingType(); - - Expr *sizeExpr; - - // Special case where the argument is a template id. - if (Attr.getParameterName()) { - CXXScopeSpec SS; - SourceLocation TemplateKWLoc; - UnqualifiedId id; - id.setIdentifier(Attr.getParameterName(), Attr.getLoc()); - - ExprResult Size = S.ActOnIdExpression(scope, SS, TemplateKWLoc, id, - false, false); - if (Size.isInvalid()) - return; - - sizeExpr = Size.get(); - } else { - // check the attribute arguments. - if (!checkAttributeNumArgs(S, Attr, 1)) - return; - - sizeExpr = Attr.getArg(0); - } - - // Instantiate/Install the vector type, and let Sema build the type for us. - // This will run the reguired checks. - QualType T = S.BuildExtVectorType(curType, sizeExpr, Attr.getLoc()); - if (!T.isNull()) { - // FIXME: preserve the old source info. - tDecl->setTypeSourceInfo(S.Context.getTrivialTypeSourceInfo(T)); - - // Remember this typedef decl, we will need it later for diagnostics. - S.ExtVectorDecls.push_back(tDecl); - } + // Remember this typedef decl, we will need it later for diagnostics. + S.ExtVectorDecls.push_back(TD); } static void handlePackedAttr(Sema &S, Decl *D, const AttributeList &Attr) { diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 59c1dea8ff57e67b29c0cef28c5b185ce3adb54d..f44603b1efee9dafc64877df5efe2c72bb9f0065 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -4213,9 +4213,7 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type, attr.setUsedAsTypeAttr(); break; case AttributeList::AT_ExtVectorType: - if (state.getDeclarator().getDeclSpec().getStorageClassSpec() - != DeclSpec::SCS_typedef) - HandleExtVectorTypeAttr(type, attr, state.getSema()); + HandleExtVectorTypeAttr(type, attr, state.getSema()); attr.setUsedAsTypeAttr(); break; case AttributeList::AT_NeonVectorType: