[cfe-commits] r114637 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaType.cpp test/CodeGen/imaginary.c

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Sep 23 02:40:31 PDT 2010


Author: akirtzidis
Date: Thu Sep 23 04:40:31 2010
New Revision: 114637

URL: http://llvm.org/viewvc/llvm-project?rev=114637&view=rev
Log:
Don't crash on _Imaginary.

Added:
    cfe/trunk/test/CodeGen/imaginary.c
Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=114637&r1=114636&r2=114637&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Sep 23 04:40:31 2010
@@ -2303,6 +2303,8 @@
 def ext_freestanding_complex : Extension<
   "complex numbers are an extension in a freestanding C99 implementation">;
 
+// FIXME: Remove when we support imaginary.
+def err_imaginary_not_supported : Error<"imaginary types are not supported">;
 
 // Obj-c expressions
 def warn_root_inst_method_not_found : Warning<

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=114637&r1=114636&r2=114637&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Sep 23 04:40:31 2010
@@ -392,8 +392,9 @@
     Result = Context.getVectorType(Result, 128/typeSize, AltiVecSpec);
   }
 
-  assert(DS.getTypeSpecComplex() != DeclSpec::TSC_imaginary &&
-         "FIXME: imaginary types not supported yet!");
+  // FIXME: Imaginary.
+  if (DS.getTypeSpecComplex() == DeclSpec::TSC_imaginary)
+    TheSema.Diag(DS.getTypeSpecComplexLoc(), diag::err_imaginary_not_supported);
 
   // See if there are any attributes on the declspec that apply to the type (as
   // opposed to the decl).

Added: cfe/trunk/test/CodeGen/imaginary.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/imaginary.c?rev=114637&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/imaginary.c (added)
+++ cfe/trunk/test/CodeGen/imaginary.c Thu Sep 23 04:40:31 2010
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -verify -emit-llvm-only %s
+
+// Just verify that we don't crash until we support _Imaginary.
+double _Imaginary foo; // expected-error {{imaginary types are not supported}}





More information about the cfe-commits mailing list