[cfe-commits] r75150 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/default-constructor-initializers.cpp

Anders Carlsson andersca at mac.com
Thu Jul 9 10:37:13 PDT 2009


Author: andersca
Date: Thu Jul  9 12:37:12 2009
New Revision: 75150

URL: http://llvm.org/viewvc/llvm-project?rev=75150&view=rev
Log:
Pass the DeclName to the diagnostic builder so that member names will be quoted correctly.

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/SemaCXX/default-constructor-initializers.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=75150&r1=75149&r2=75150&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Jul  9 12:37:12 2009
@@ -1989,13 +1989,13 @@
     }
     else if (FieldType->isReferenceType()) {
       Diag(CurrentLocation, diag::err_unintialized_member) 
-        << Context.getTagDeclType(ClassDecl) << 0 << (*Field)->getNameAsCString();
+        << Context.getTagDeclType(ClassDecl) << 0 << Field->getDeclName();
       Diag((*Field)->getLocation(), diag::note_declared_at);
       err = true;
     }
     else if (FieldType.isConstQualified()) {
       Diag(CurrentLocation, diag::err_unintialized_member) 
-        << Context.getTagDeclType(ClassDecl) << 1 << (*Field)->getNameAsCString();
+        << Context.getTagDeclType(ClassDecl) << 1 << Field->getDeclName();
        Diag((*Field)->getLocation(), diag::note_declared_at);
       err = true;
     }

Modified: cfe/trunk/test/SemaCXX/default-constructor-initializers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/default-constructor-initializers.cpp?rev=75150&r1=75149&r2=75150&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/default-constructor-initializers.cpp (original)
+++ cfe/trunk/test/SemaCXX/default-constructor-initializers.cpp Thu Jul  9 12:37:12 2009
@@ -20,7 +20,7 @@
 };
 
 X4 x4; // expected-error {{cannot define the implicit default constructor for 'struct X4', because base class 'struct X2' does not have any default constructor}} \
-       // expected-error {{cannot define the implicit default constructor for 'struct X4', because reference member rx2 cannot be default-initialized}}
+       // expected-error {{cannot define the implicit default constructor for 'struct X4', because reference member 'rx2' cannot be default-initialized}}
 
 
 struct Y1 { // has no implicit default constructor
@@ -51,6 +51,6 @@
   	volatile int v1;
 };
 
-Z1 z1;  // expected-error {{cannot define the implicit default constructor for 'struct Z1', because reference member z cannot be default-initialized}} \
-        // expected-error {{cannot define the implicit default constructor for 'struct Z1', because const member c1 cannot be default-initialized}}
+Z1 z1;  // expected-error {{cannot define the implicit default constructor for 'struct Z1', because reference member 'z' cannot be default-initialized}} \
+        // expected-error {{cannot define the implicit default constructor for 'struct Z1', because const member 'c1' cannot be default-initialized}}
 





More information about the cfe-commits mailing list