]> granicus.if.org Git - clang/commitdiff
Modify a diagnostic introduced in r132612 to emit QualTypes directly
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 8 Jun 2011 15:15:17 +0000 (15:15 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 8 Jun 2011 15:15:17 +0000 (15:15 +0000)
This fixes a memory error on FreeBSD (and is the right thing to do
in any case).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132750 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/Parser/opencl-astype.cl

index 1914a6a6ba777a125a1f75269b2760615ae6258d..6d8e8c6311f8523880b553900af59ec47d410791 100644 (file)
@@ -5009,8 +5009,8 @@ ExprResult Sema::ActOnAsTypeExpr(Expr *expr, ParsedType destty,
   if (Context.getTypeSize(DstTy) != Context.getTypeSize(SrcTy))
     return ExprError(Diag(BuiltinLoc,
                           diag::err_invalid_astype_of_different_size)
-                     << DstTy.getAsString().c_str() 
-                     << SrcTy.getAsString().c_str()
+                     << DstTy
+                     << SrcTy
                      << expr->getSourceRange());
   return Owned(new (Context) AsTypeExpr(expr, DstTy, VK, OK, BuiltinLoc, RParenLoc));
 }
index d476b841aae964d9b47bac23c73ce9eaa99a510f..d4c547e5cb823ac44f245839f834598df73f8277 100644 (file)
@@ -11,10 +11,10 @@ void test_astype() {
   typedef __attribute__(( ext_vector_type(4) ))  double double4;
   
   float4 f4;
-  double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of double4 and float4 must match}}
+  double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of 'double4' and 'float4' must match}}
   
   // Verify int4->float3, float3->int4 works.
   int4 i4;
   float3 f3 = __builtin_astype(i4, float3);
   i4 = __builtin_astype(f3, int4);
-}
\ No newline at end of file
+}