[cfe-commits] r96784 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Douglas Gregor dgregor at apple.com
Mon Feb 22 08:44:27 PST 2010


Author: dgregor
Date: Mon Feb 22 10:44:27 2010
New Revision: 96784

URL: http://llvm.org/viewvc/llvm-project?rev=96784&view=rev
Log:
Don't use NamedDecl::getNameAsCString() when dealing with C++ methods,
since they may not have normal identifiers for names. Fixes PR6369.

Modified:
    cfe/trunk/lib/CodeGen/CGVtable.cpp

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=96784&r1=96783&r2=96784&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Mon Feb 22 10:44:27 2010
@@ -1877,10 +1877,10 @@
       // If already set, note the two sets as the same
       if (0)
         printf("%s::%s same as %s::%s\n",
-               PrevU->getParent()->getNameAsCString(),
-               PrevU->getNameAsCString(),
-               U->getParent()->getNameAsCString(),
-               U->getNameAsCString());
+               PrevU->getParent()->getNameAsString().c_str(),
+               PrevU->getNameAsString().c_str(),
+               U->getParent()->getNameAsString().c_str(),
+               U->getNameAsString().c_str());
       ForwardUnique[PrevU] = U;
       return;
     }
@@ -1888,11 +1888,11 @@
     // Not set, set it now
     if (0)
       printf("marking %s::%s %p override as %s::%s\n",
-             MD->getParent()->getNameAsCString(),
-             MD->getNameAsCString(),
+             MD->getParent()->getNameAsString().c_str(),
+             MD->getNameAsString().c_str(),
              (void*)MD,
-             U->getParent()->getNameAsCString(),
-             U->getNameAsCString());
+             U->getParent()->getNameAsString().c_str(),
+             U->getNameAsString().c_str());
     UniqueOverrider[MD] = U;
 
     for (CXXMethodDecl::method_iterator mi = MD->begin_overridden_methods(),
@@ -1914,8 +1914,8 @@
         BuildUniqueOverrider(MD, MD);
         if (0)
           printf("top set is %s::%s %p\n",
-                  MD->getParent()->getNameAsCString(),
-                  MD->getNameAsCString(),
+                  MD->getParent()->getNameAsString().c_str(),
+                  MD->getNameAsString().c_str(),
                   (void*)MD);
         ForwardUnique[MD] = MD;
       }
@@ -1950,7 +1950,7 @@
       A_t::iterator J = I;
       while (++J != E  && DclCmp(I, J) == 0)
         if (DclIsSame(*I, *J)) {
-          if (0) printf("connecting %s\n", (*I)->getNameAsCString());
+          if (0) printf("connecting %s\n", (*I)->getNameAsString().c_str());
           ForwardUnique[*J] = *I;
         }
     }
@@ -2178,7 +2178,7 @@
       return;
 
     D1(printf("  vfn for %s at %d\n",
-              dyn_cast<CXXMethodDecl>(GD.getDecl())->getNameAsCString(),
+              dyn_cast<CXXMethodDecl>(GD.getDecl())->getNameAsString().c_str(),
               (int)Methods.size()));
 
     // We didn't find an entry in the vtable that we could use, add a new
@@ -2201,7 +2201,7 @@
         idx = VCalls.size()+1;
         VCalls.push_back(Offset/8 - CurrentVBaseOffset/8);
         D1(printf("  vcall for %s at %d with delta %d\n",
-                  dyn_cast<CXXMethodDecl>(GD.getDecl())->getNameAsCString(),
+                  dyn_cast<CXXMethodDecl>(GD.getDecl())->getNameAsString().c_str(),
                   (int)-VCalls.size()-3, (int)VCalls[idx-1]));
       }
     }





More information about the cfe-commits mailing list