This revision was automatically updated to reflect the committed changes.
Closed by commit rG5fee6936b8b2: [AST] Use PrintingPolicy for format string 
diagnosis (authored by jrtc27).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78777/new/

https://reviews.llvm.org/D78777

Files:
  clang/lib/AST/FormatString.cpp
  clang/test/SemaOpenCL/printf-format-strings.cl


Index: clang/test/SemaOpenCL/printf-format-strings.cl
===================================================================
--- clang/test/SemaOpenCL/printf-format-strings.cl
+++ clang/test/SemaOpenCL/printf-format-strings.cl
@@ -65,8 +65,8 @@
 
 kernel void format_v4f16(half4 arg_h, float4 arg_f, double4 arg_d)
 {
-  printf("%v4hf\n", arg_d); // expected-warning{{format specifies type '__fp16 
__attribute__((ext_vector_type(4)))' but the argument has type 'double4' 
(vector of 4 'double' values)}}
-  printf("%v4hf\n", arg_f); // expected-warning{{format specifies type '__fp16 
__attribute__((ext_vector_type(4)))' but the argument has type 'float4' (vector 
of 4 'float' values)}}
+  printf("%v4hf\n", arg_d); // expected-warning{{format specifies type 'half 
__attribute__((ext_vector_type(4)))' but the argument has type 'double4' 
(vector of 4 'double' values)}}
+  printf("%v4hf\n", arg_f); // expected-warning{{format specifies type 'half 
__attribute__((ext_vector_type(4)))' but the argument has type 'float4' (vector 
of 4 'float' values)}}
   printf("%v4hf\n", arg_h);
 }
 
Index: clang/lib/AST/FormatString.cpp
===================================================================
--- clang/lib/AST/FormatString.cpp
+++ clang/lib/AST/FormatString.cpp
@@ -539,7 +539,7 @@
 }
 
 std::string ArgType::getRepresentativeTypeName(ASTContext &C) const {
-  std::string S = getRepresentativeType(C).getAsString();
+  std::string S = getRepresentativeType(C).getAsString(C.getPrintingPolicy());
 
   std::string Alias;
   if (Name) {


Index: clang/test/SemaOpenCL/printf-format-strings.cl
===================================================================
--- clang/test/SemaOpenCL/printf-format-strings.cl
+++ clang/test/SemaOpenCL/printf-format-strings.cl
@@ -65,8 +65,8 @@
 
 kernel void format_v4f16(half4 arg_h, float4 arg_f, double4 arg_d)
 {
-  printf("%v4hf\n", arg_d); // expected-warning{{format specifies type '__fp16 __attribute__((ext_vector_type(4)))' but the argument has type 'double4' (vector of 4 'double' values)}}
-  printf("%v4hf\n", arg_f); // expected-warning{{format specifies type '__fp16 __attribute__((ext_vector_type(4)))' but the argument has type 'float4' (vector of 4 'float' values)}}
+  printf("%v4hf\n", arg_d); // expected-warning{{format specifies type 'half __attribute__((ext_vector_type(4)))' but the argument has type 'double4' (vector of 4 'double' values)}}
+  printf("%v4hf\n", arg_f); // expected-warning{{format specifies type 'half __attribute__((ext_vector_type(4)))' but the argument has type 'float4' (vector of 4 'float' values)}}
   printf("%v4hf\n", arg_h);
 }
 
Index: clang/lib/AST/FormatString.cpp
===================================================================
--- clang/lib/AST/FormatString.cpp
+++ clang/lib/AST/FormatString.cpp
@@ -539,7 +539,7 @@
 }
 
 std::string ArgType::getRepresentativeTypeName(ASTContext &C) const {
-  std::string S = getRepresentativeType(C).getAsString();
+  std::string S = getRepresentativeType(C).getAsString(C.getPrintingPolicy());
 
   std::string Alias;
   if (Name) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D78777: [AST] Us... Anastasia Stulova via Phabricator via cfe-commits
    • [PATCH] D78777: [AS... Jessica Clarke via Phabricator via cfe-commits

Reply via email to