]> granicus.if.org Git - clang/commitdiff
print "const intptr_t" instead of "intptr_t const"
authorChris Lattner <sabre@nondot.org>
Sun, 5 Sep 2010 00:07:29 +0000 (00:07 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 5 Sep 2010 00:07:29 +0000 (00:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113091 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/TypePrinter.cpp
test/Misc/diag-aka-types.cpp
test/Sema/varargs-x86-64.c
test/SemaCXX/reinterpret-cast.cpp

index e21f9ac3ae4f448684511fb27ea6cfcb3d0e7547..f5291871455ab7cc4c296fd1ab22228590d0b03a 100644 (file)
@@ -72,7 +72,8 @@ void TypePrinter::Print(QualType T, std::string &S) {
   // the type is complex.  For example if the type is "int*", we *must* print
   // "int * const", printing "const int *" is different.  Only do this when the
   // type expands to a simple string.
-  bool CanPrefixQualifiers = isa<BuiltinType>(T);
+  bool CanPrefixQualifiers =
+    isa<BuiltinType>(T) || isa<TypedefType>(T);
   
   if (!CanPrefixQualifiers && !Quals.empty()) {
     std::string TQS;
index 7233c4e85b49998628faede7c66a3fa36b685ba2..51d4093e7489f2bcf631da211d899001787d92e6 100644 (file)
@@ -7,4 +7,4 @@ foo_t *ptr;
 char c1 = ptr; // expected-error{{'foo_t *' (aka 'X *')}}
 
 const foo_t &ref = foo_t();
-char c2 = ref; // expected-error{{'foo_t const' (aka 'X const')}}
+char c2 = ref; // expected-error{{'const foo_t' (aka 'X const')}}
index 2cfedc1b37e7a608e2bdf3f4fd18ec3044b7c0be..2fe9b10cf78db4425700f61a2d5de3d0e1fc8988 100644 (file)
@@ -3,6 +3,6 @@
 // rdar://6726818
 void f1() {
   const __builtin_va_list args2;
-  (void)__builtin_va_arg(args2, int); // expected-error {{first argument to 'va_arg' is of type '__builtin_va_list const' and not 'va_list'}}
+  (void)__builtin_va_arg(args2, int); // expected-error {{first argument to 'va_arg' is of type 'const __builtin_va_list' and not 'va_list'}}
 }
 
index 335fe7edbcf36e108a57e88a8ec1fa40c414c7dc..bde4a0c4ecfa276236e280fad2b3a6af5add8da3 100644 (file)
@@ -105,6 +105,6 @@ void const_arrays() {
   const STRING *s;
   const char *c;
 
-  (void)reinterpret_cast<char *>(s); // expected-error {{reinterpret_cast from 'STRING const *' (aka 'char const (*)[10]') to 'char *' casts away constness}}
+  (void)reinterpret_cast<char *>(s); // expected-error {{reinterpret_cast from 'const STRING *' (aka 'char const (*)[10]') to 'char *' casts away constness}}
   (void)reinterpret_cast<const STRING *>(c);
 }