[llvm-branch-commits] [cfe-branch] r71662 - in /cfe/branches/Apple/Dib: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDeclAttr.cpp test/Sema/vector-init.c

Mike Stump mrs at apple.com
Wed May 13 08:24:35 PDT 2009


Author: mrs
Date: Wed May 13 10:24:11 2009
New Revision: 71662

URL: http://llvm.org/viewvc/llvm-project?rev=71662&view=rev
Log:
Merge in 71633:

Fix rdar://6881069, a crash on a form of vector_size that we
don't support.  While it would be nice to support this eventually,
this form is not common at all (just seen in gcc testsuite) and
it might be better to model vector_size as a type attribute anyway.
For now just emit a nice error on it.

Modified:
    cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/branches/Apple/Dib/lib/Sema/SemaDeclAttr.cpp
    cfe/branches/Apple/Dib/test/Sema/vector-init.c

Modified: cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td?rev=71662&r1=71661&r2=71662&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td Wed May 13 10:24:11 2009
@@ -382,6 +382,8 @@
   "can't convert between vector values of different size (%0 and %1)">;
 def err_typecheck_ext_vector_not_typedef : Error<
   "ext_vector_type only applies to types, not variables">;
+def err_unsupported_vector_size : Error<
+  "unsupported type %0 for vector_size attribute, please use on typedef">;
 def err_ext_vector_component_exceeds_length : Error<
   "vector component access exceeds type %0">;
 def err_ext_vector_component_requires_even : Error<

Modified: cfe/branches/Apple/Dib/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Sema/SemaDeclAttr.cpp?rev=71662&r1=71661&r2=71662&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Sema/SemaDeclAttr.cpp Wed May 13 10:24:11 2009
@@ -207,7 +207,8 @@
   // vector arrays, and functions returning vectors.
   if (CurType->isPointerType() || CurType->isArrayType() ||
       CurType->isFunctionType()) {
-    assert(0 && "HandleVector(): Complex type construction unimplemented");
+    S.Diag(Attr.getLoc(), diag::err_unsupported_vector_size) << CurType;
+    return;
     /* FIXME: rebuild the type from the inside out, vectorizing the inner type.
      do {
      if (PointerType *PT = dyn_cast<PointerType>(canonType))

Modified: cfe/branches/Apple/Dib/test/Sema/vector-init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Sema/vector-init.c?rev=71662&r1=71661&r2=71662&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/test/Sema/vector-init.c (original)
+++ cfe/branches/Apple/Dib/test/Sema/vector-init.c Wed May 13 10:24:11 2009
@@ -15,3 +15,9 @@
 
 float4 array3[2] = { {1.0, 2.0, 3.0}, 5.0, 6.0, 7.0, 8.0,
                      9.0 }; // expected-warning {{excess elements in array initializer}}
+
+
+// rdar://6881069
+__attribute__((vector_size(16))) // expected-error {{unsupported type 'float (void)' for vector_size attribute, please use on typedef}}
+float f1(void) {
+}





More information about the llvm-branch-commits mailing list