[cfe-commits] r111314 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/AST/Decl.h lib/AST/ASTContext.cpp lib/AST/RecordLayoutBuilder.cpp lib/AST/StmtPrinter.cpp lib/Checker/CheckSecuritySyntaxOnly.cpp lib/CodeGen/CGObjCMac.cpp lib/Rewrite/RewriteObjC.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaObjCProperty.cpp

Daniel Dunbar daniel at zuster.org
Tue Aug 17 15:39:59 PDT 2010


Author: ddunbar
Date: Tue Aug 17 17:39:59 2010
New Revision: 111314

URL: http://llvm.org/viewvc/llvm-project?rev=111314&view=rev
Log:
StringRef'ication of lots stuff, patch by Peter Davies!

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
    cfe/trunk/lib/AST/StmtPrinter.cpp
    cfe/trunk/lib/Checker/CheckSecuritySyntaxOnly.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/Rewrite/RewriteObjC.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Tue Aug 17 17:39:59 2010
@@ -522,7 +522,7 @@
                             llvm::SmallVectorImpl<const Expr *> &Layout);
 
   /// This builds the struct used for __block variables.
-  QualType BuildByRefType(const char *DeclName, QualType Ty);
+  QualType BuildByRefType(llvm::StringRef DeclName, QualType Ty);
 
   /// Returns true iff we need copy/dispose helpers for the given type.
   bool BlockRequiresCopying(QualType Ty);

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Tue Aug 17 17:39:59 2010
@@ -118,16 +118,6 @@
     return getIdentifier() ? getIdentifier()->getName() : "";
   }
 
-  /// getNameAsCString - Get the name of identifier for this declaration as a
-  /// C string (const char*).  This requires that the declaration have a name
-  /// and that it be a simple identifier.
-  //
-  // FIXME: Deprecated, move clients to getName().
-  const char *getNameAsCString() const {
-    assert(Name.isIdentifier() && "Name is not a simple identifier");
-    return getIdentifier() ? getIdentifier()->getNameStart() : "";
-  }
-
   /// getNameAsString - Get a human-readable name for the declaration, even if
   /// it is one of the special kinds of names (C++ constructor, Objective-C
   /// selector, etc).  Creating this name requires expensive string

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Aug 17 17:39:59 2010
@@ -3186,7 +3186,7 @@
   return false;
 }
 
-QualType ASTContext::BuildByRefType(const char *DeclName, QualType Ty) {
+QualType ASTContext::BuildByRefType(llvm::StringRef DeclName, QualType Ty) {
   //  type = struct __Block_byref_1_X {
   //    void *__isa;
   //    struct __Block_byref_1_X *__forwarding;
@@ -3219,7 +3219,7 @@
     Ty
   };
 
-  const char *FieldNames[] = {
+  llvm::StringRef FieldNames[] = {
     "__isa",
     "__forwarding",
     "__flags",
@@ -3296,7 +3296,7 @@
       const ValueDecl *D = BDRE->getDecl();
       FieldName = D->getIdentifier();
       if (BDRE->isByRef())
-        FieldType = BuildByRefType(D->getNameAsCString(), FieldType);
+        FieldType = BuildByRefType(D->getName(), FieldType);
     } else {
       // Padding.
       assert(isa<ConstantArrayType>(FieldType) &&

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Tue Aug 17 17:39:59 2010
@@ -1630,7 +1630,7 @@
     if (const RecordType *RT = Field->getType()->getAs<RecordType>()) {
       if (const CXXRecordDecl *D = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
         DumpCXXRecordLayout(OS, D, C, FieldOffset, IndentLevel,
-                            Field->getNameAsCString(),
+                            Field->getName().data(),
                             /*IncludeVirtualBases=*/true);
         continue;
       }

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Tue Aug 17 17:39:59 2010
@@ -512,7 +512,7 @@
     PrintExpr(Node->getBase());
     OS << ".";
   }
-  OS << Node->getProperty()->getNameAsCString();
+  OS << Node->getProperty()->getName();
 }
 
 void StmtPrinter::VisitObjCImplicitSetterGetterRefExpr(

Modified: cfe/trunk/lib/Checker/CheckSecuritySyntaxOnly.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/CheckSecuritySyntaxOnly.cpp?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/CheckSecuritySyntaxOnly.cpp (original)
+++ cfe/trunk/lib/Checker/CheckSecuritySyntaxOnly.cpp Tue Aug 17 17:39:59 2010
@@ -217,7 +217,7 @@
   llvm::SmallString<256> sbuf;
   llvm::raw_svector_ostream os(sbuf);
 
-  os << "Variable '" << drCond->getDecl()->getNameAsCString()
+  os << "Variable '" << drCond->getDecl()->getName()
      << "' with floating point type '" << drCond->getType().getAsString()
      << "' should not be used as a loop counter";
 

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Aug 17 17:39:59 2010
@@ -3923,7 +3923,7 @@
    if (CGM.getLangOptions().ObjCGCBitmapPrint) {
     printf("\n%s ivar layout for class '%s': ",
            ForStrongLayout ? "strong" : "weak",
-           OMD->getClassInterface()->getNameAsCString());
+           OMD->getClassInterface()->getName().data());
     const unsigned char *s = (unsigned char*)BitMap.c_str();
     for (unsigned i = 0; i < BitMap.size(); i++)
       if (!(s[i] & 0xf0))
@@ -5040,7 +5040,7 @@
                                    ObjCTypes.ExternalProtocolPtrTy);
 
   std::string ProtocolName("\01l_OBJC_PROTOCOL_REFERENCE_$_");
-  ProtocolName += PD->getNameAsCString();
+  ProtocolName += PD->getName();
 
   llvm::GlobalVariable *PTGV = CGM.getModule().getGlobalVariable(ProtocolName);
   if (PTGV)

Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Tue Aug 17 17:39:59 2010
@@ -330,17 +330,17 @@
     void RewriteObjCMethodsMetaData(MethodIterator MethodBegin,
                                     MethodIterator MethodEnd,
                                     bool IsInstanceMethod,
-                                    const char *prefix,
-                                    const char *ClassName,
+                                    llvm::StringRef prefix,
+                                    llvm::StringRef ClassName,
                                     std::string &Result);
 
     void RewriteObjCProtocolMetaData(ObjCProtocolDecl *Protocol,
-                                     const char *prefix,
-                                     const char *ClassName,
+                                     llvm::StringRef prefix,
+                                     llvm::StringRef ClassName,
                                      std::string &Result);
     void RewriteObjCProtocolListMetaData(const ObjCList<ObjCProtocolDecl> &Prots,
-                                         const char *prefix,
-                                         const char *ClassName,
+                                         llvm::StringRef prefix,
+                                         llvm::StringRef ClassName,
                                          std::string &Result);
     void SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl,
                                       std::string &Result);
@@ -366,18 +366,18 @@
     void RewriteBlockPointerFunctionArgs(FunctionDecl *FD);
 
     std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
-                                      const char *funcName, std::string Tag);
+                                      llvm::StringRef funcName, std::string Tag);
     std::string SynthesizeBlockFunc(BlockExpr *CE, int i,
-                                      const char *funcName, std::string Tag);
+                                      llvm::StringRef funcName, std::string Tag);
     std::string SynthesizeBlockImpl(BlockExpr *CE, 
                                     std::string Tag, std::string Desc);
     std::string SynthesizeBlockDescriptor(std::string DescTag, 
                                           std::string ImplTag,
-                                          int i, const char *funcName,
+                                          int i, llvm::StringRef funcName,
                                           unsigned hasCopy);
     Stmt *SynthesizeBlockCall(CallExpr *Exp, const Expr* BlockExp);
     void SynthesizeBlockLiterals(SourceLocation FunLocStart,
-                                 const char *FunName);
+                                 llvm::StringRef FunName);
     void RewriteRecordBody(RecordDecl *RD);
 
     void CollectBlockDeclRefInfo(BlockExpr *Exp);
@@ -427,7 +427,7 @@
                             const char *&RParen);
     void RewriteCastExpr(CStyleCastExpr *CE);
 
-    FunctionDecl *SynthBlockInitFunctionDecl(const char *name);
+    FunctionDecl *SynthBlockInitFunctionDecl(llvm::StringRef name);
     Stmt *SynthBlockInitExpr(BlockExpr *Exp,
             const llvm::SmallVector<BlockDeclRefExpr *, 8> &InnerBlockDeclRefs);
 
@@ -678,7 +678,7 @@
     RewriteFunctionDecl(FD);
   } else if (VarDecl *FVD = dyn_cast<VarDecl>(D)) {
     // declared in <Foundation/NSString.h>
-    if (strcmp(FVD->getNameAsCString(), "_NSConstantStringClassReference") == 0) {
+    if (FVD->getName() == "_NSConstantStringClassReference") {
       ConstantStringClassReference = FVD;
       return;
     }
@@ -841,7 +841,7 @@
     Setr += "objc_setProperty (self, _cmd, ";
     SynthesizeIvarOffsetComputation(ClassDecl, OID, Setr);
     Setr += ", (id)";
-    Setr += PD->getNameAsCString();
+    Setr += PD->getName();
     Setr += ", ";
     if (Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic)
       Setr += "0, ";
@@ -854,7 +854,7 @@
   }
   else {
     Setr += getIvarAccessString(ClassDecl, OID) + " = ";
-    Setr += PD->getNameAsCString();
+    Setr += PD->getName();
   }
   Setr += "; }";
   InsertText(onePastSemiLoc, Setr);
@@ -1509,7 +1509,7 @@
 
   SourceLocation startLoc = S->getLocStart();
   const char *startBuf = SM->getCharacterData(startLoc);
-  const char *elementName;
+  llvm::StringRef elementName;
   std::string elementTypeAsString;
   std::string buf;
   buf = "\n{\n\t";
@@ -1525,13 +1525,13 @@
       elementTypeAsString = ElementType.getAsString(Context->PrintingPolicy);
     buf += elementTypeAsString;
     buf += " ";
-    elementName = D->getNameAsCString();
+    elementName = D->getName();
     buf += elementName;
     buf += ";\n\t";
   }
   else {
     DeclRefExpr *DR = cast<DeclRefExpr>(S->getElement());
-    elementName = DR->getDecl()->getNameAsCString();
+    elementName = DR->getDecl()->getName();
     ValueDecl *VD = cast<ValueDecl>(DR->getDecl());
     if (VD->getType()->isObjCQualifiedIdType() ||
         VD->getType()->isObjCQualifiedInterfaceType())
@@ -2272,7 +2272,7 @@
 void RewriteObjC::RewriteFunctionDecl(FunctionDecl *FD) {
   // declared in <objc/objc.h>
   if (FD->getIdentifier() &&
-      strcmp(FD->getNameAsCString(), "sel_registerName") == 0) {
+      FD->getName() == "sel_registerName") {
     SelGetUidFunctionDecl = FD;
     return;
   }
@@ -2332,7 +2332,7 @@
   QualType Type = proto->getResultType();
   std::string FdStr = Type.getAsString(Context->PrintingPolicy);
   FdStr += " ";
-  FdStr += FD->getNameAsCString();
+  FdStr += FD->getName();
   FdStr +=  "(";
   unsigned numArgs = proto->getNumArgs();
   for (unsigned i = 0; i < numArgs; i++) {
@@ -3126,7 +3126,7 @@
 void RewriteObjC::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl,
                                                std::string &Result) {
   assert(CDecl && "Class missing in SynthesizeObjCInternalStruct");
-  assert(CDecl->getNameAsCString() &&
+  assert(CDecl->getName() != "" &&
          "Name missing in SynthesizeObjCInternalStruct");
   // Do not synthesize more than once.
   if (ObjCSynthesizedStructs.count(CDecl))
@@ -3259,8 +3259,8 @@
 void RewriteObjC::RewriteObjCMethodsMetaData(MethodIterator MethodBegin,
                                              MethodIterator MethodEnd,
                                              bool IsInstanceMethod,
-                                             const char *prefix,
-                                             const char *ClassName,
+                                             llvm::StringRef prefix,
+                                             llvm::StringRef ClassName,
                                              std::string &Result) {
   if (MethodBegin == MethodEnd) return;
 
@@ -3329,8 +3329,8 @@
 
 /// RewriteObjCProtocolMetaData - Rewrite protocols meta-data.
 void RewriteObjC::
-RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, const char *prefix,
-                            const char *ClassName, std::string &Result) {
+RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, llvm::StringRef prefix,
+                            llvm::StringRef ClassName, std::string &Result) {
   static bool objc_protocol_methods = false;
 
   // Output struct protocol_methods holder of method selector and type.
@@ -3376,7 +3376,7 @@
         Result += "\t  ,{{(struct objc_selector *)\"";
       else
         Result += "\t  ,{(struct objc_selector *)\"";
-      Result += (*I)->getSelector().getAsString().c_str();
+      Result += (*I)->getSelector().getAsString();
       std::string MethodTypeString;
       Context->getObjCEncodingForMethodDecl((*I), MethodTypeString);
       Result += "\", \"";
@@ -3414,7 +3414,7 @@
         Result += "\t  ,{{(struct objc_selector *)\"";
       else
         Result += "\t  ,{(struct objc_selector *)\"";
-      Result += (*I)->getSelector().getAsString().c_str();
+      Result += (*I)->getSelector().getAsString();
       std::string MethodTypeString;
       Context->getObjCEncodingForMethodDecl((*I), MethodTypeString);
       Result += "\", \"";
@@ -3477,7 +3477,7 @@
 
 void RewriteObjC::
 RewriteObjCProtocolListMetaData(const ObjCList<ObjCProtocolDecl> &Protocols,
-                                const char *prefix, const char *ClassName,
+                                llvm::StringRef prefix, llvm::StringRef ClassName,
                                 std::string &Result) {
   if (Protocols.empty()) return;
 
@@ -3570,7 +3570,7 @@
   // Null CDecl is case of a category implementation with no category interface
   if (CDecl)
     RewriteObjCProtocolListMetaData(CDecl->getReferencedProtocols(), "CATEGORY",
-                                    FullCategoryName.c_str(), Result);
+                                    FullCategoryName, Result);
   /* struct _objc_category {
    char *category_name;
    char *class_name;
@@ -3768,15 +3768,15 @@
       InstanceMethods.push_back(Setter);
   }
   RewriteObjCMethodsMetaData(InstanceMethods.begin(), InstanceMethods.end(),
-                             true, "", IDecl->getNameAsCString(), Result);
+                             true, "", IDecl->getName(), Result);
 
   // Build _objc_method_list for class's class methods if needed
   RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(),
-                             false, "", IDecl->getNameAsCString(), Result);
+                             false, "", IDecl->getName(), Result);
 
   // Protocols referenced in class declaration?
   RewriteObjCProtocolListMetaData(CDecl->getReferencedProtocols(),
-                                  "CLASS", CDecl->getNameAsCString(), Result);
+                                  "CLASS", CDecl->getName(), Result);
 
   // Declaration of class/meta-class metadata
   /* struct _objc_class {
@@ -4042,13 +4042,13 @@
 }
 
 std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
-                                                   const char *funcName,
+                                                   llvm::StringRef funcName,
                                                    std::string Tag) {
   const FunctionType *AFT = CE->getFunctionType();
   QualType RT = AFT->getResultType();
   std::string StructRef = "struct " + Tag;
   std::string S = "static " + RT.getAsString(Context->PrintingPolicy) + " __" +
-                  funcName + "_" + "block_func_" + utostr(i);
+                  funcName.str() + "_" + "block_func_" + utostr(i);
 
   BlockDecl *BD = CE->getBlockDecl();
 
@@ -4136,7 +4136,7 @@
 }
 
 std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
-                                                   const char *funcName,
+                                                   llvm::StringRef funcName,
                                                    std::string Tag) {
   std::string StructRef = "struct " + Tag;
   std::string S = "static void __";
@@ -4311,7 +4311,7 @@
 
 std::string RewriteObjC::SynthesizeBlockDescriptor(std::string DescTag, 
                                                    std::string ImplTag, int i,
-                                                   const char *FunName,
+                                                   llvm::StringRef FunName,
                                                    unsigned hasCopy) {
   std::string S = "\nstatic struct " + DescTag;
   
@@ -4330,15 +4330,15 @@
   S += DescTag + "_DATA = { 0, sizeof(struct ";
   S += ImplTag + ")";
   if (hasCopy) {
-    S += ", __" + std::string(FunName) + "_block_copy_" + utostr(i);
-    S += ", __" + std::string(FunName) + "_block_dispose_" + utostr(i);
+    S += ", __" + FunName.str() + "_block_copy_" + utostr(i);
+    S += ", __" + FunName.str() + "_block_dispose_" + utostr(i);
   }
   S += "};\n";
   return S;
 }
 
 void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart,
-                                          const char *FunName) {
+                                          llvm::StringRef FunName) {
   // Insert declaration for the function in which block literal is used.
   if (CurFunctionDeclToDeclareForBlock && !Blocks.empty())
     RewriteBlockLiteralFunctionDecl(CurFunctionDeclToDeclareForBlock);
@@ -4372,8 +4372,8 @@
       }
     }
 
-    std::string ImplTag = "__" + std::string(FunName) + "_block_impl_" + utostr(i);
-    std::string DescTag = "__" + std::string(FunName) + "_block_desc_" + utostr(i);
+    std::string ImplTag = "__" + FunName.str() + "_block_impl_" + utostr(i);
+    std::string DescTag = "__" + FunName.str() + "_block_desc_" + utostr(i);
 
     std::string CI = SynthesizeBlockImpl(Blocks[i], ImplTag, DescTag);
 
@@ -4421,7 +4421,7 @@
 
 void RewriteObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) {
   SourceLocation FunLocStart = FD->getTypeSpecStartLoc();
-  const char *FuncName = FD->getNameAsCString();
+  llvm::StringRef FuncName = FD->getName();
 
   SynthesizeBlockLiterals(FunLocStart, FuncName);
 }
@@ -4429,7 +4429,7 @@
 static void BuildUniqueMethodName(std::string &Name,
                                   ObjCMethodDecl *MD) {
   ObjCInterfaceDecl *IFace = MD->getClassInterface();
-  Name = IFace->getNameAsCString();
+  Name = IFace->getName();
   Name += "__" + MD->getSelector().getAsString();
   // Convert colons to underscores.
   std::string::size_type loc = 0;
@@ -4443,7 +4443,7 @@
   SourceLocation FunLocStart = MD->getLocStart();
   std::string FuncName;
   BuildUniqueMethodName(FuncName, MD);
-  SynthesizeBlockLiterals(FunLocStart, FuncName.c_str());
+  SynthesizeBlockLiterals(FunLocStart, FuncName);
 }
 
 void RewriteObjC::GetBlockDeclRefExprs(Stmt *S) {
@@ -4671,7 +4671,7 @@
                                             FD, SourceLocation(),
                                             FD->getType());
 
-  const char *Name = VD->getNameAsCString();
+  llvm::StringRef Name = VD->getName();
   FD = FieldDecl::Create(*Context, 0, SourceLocation(),
                          &Context->Idents.get(Name), 
                          Context->VoidPtrTy, 0,
@@ -5111,7 +5111,7 @@
   }
 }
 
-FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(const char *name) {
+FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(llvm::StringRef name) {
   IdentifierInfo *ID = &Context->Idents.get(name);
   QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy);
   return FunctionDecl::Create(*Context, TUDecl,SourceLocation(),
@@ -5178,13 +5178,13 @@
   Expr *NewRep;
 
   // Simulate a contructor call...
-  FD = SynthBlockInitFunctionDecl(Tag.c_str());
+  FD = SynthBlockInitFunctionDecl(Tag);
   DeclRefExpr *DRE = new (Context) DeclRefExpr(FD, FType, SourceLocation());
 
   llvm::SmallVector<Expr*, 4> InitExprs;
 
   // Initialize the block function.
-  FD = SynthBlockInitFunctionDecl(Func.c_str());
+  FD = SynthBlockInitFunctionDecl(Func);
   DeclRefExpr *Arg = new (Context) DeclRefExpr(FD, FD->getType(),
                                                SourceLocation());
   CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, Context->VoidPtrTy,
@@ -5214,7 +5214,7 @@
          E = BlockByCopyDecls.end(); I != E; ++I) {
       if (isObjCType((*I)->getType())) {
         // FIXME: Conform to ABI ([[obj retain] autorelease]).
-        FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString());
+        FD = SynthBlockInitFunctionDecl((*I)->getName());
         Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
         if (HasLocalVariableExternalStorage(*I)) {
           QualType QT = (*I)->getType();
@@ -5223,12 +5223,12 @@
                                             SourceLocation());
         }
       } else if (isTopLevelBlockPointerType((*I)->getType())) {
-        FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString());
+        FD = SynthBlockInitFunctionDecl((*I)->getName());
         Arg = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
         Exp = NoTypeInfoCStyleCastExpr(Context, Context->VoidPtrTy,
                                        CastExpr::CK_Unknown, Arg);
       } else {
-        FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString());
+        FD = SynthBlockInitFunctionDecl((*I)->getName());
         Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
         if (HasLocalVariableExternalStorage(*I)) {
           QualType QT = (*I)->getType();
@@ -5254,7 +5254,7 @@
       assert(RD && "SynthBlockInitExpr(): Can't find RecordDecl");
       QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
       
-      FD = SynthBlockInitFunctionDecl((*I)->getNameAsCString());
+      FD = SynthBlockInitFunctionDecl((*I)->getName());
       Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
       Exp = new (Context) UnaryOperator(Exp, UnaryOperator::AddrOf,
                               Context->getPointerType(Exp->getType()),
@@ -5670,7 +5670,7 @@
         PropParentMap = 0;
       }
       SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(),
-                              VD->getNameAsCString());
+                              VD->getName());
       GlobalVarDecl = 0;
 
       // This is needed for blocks.

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Aug 17 17:39:59 2010
@@ -4789,7 +4789,7 @@
       // emitted.
       Diag(FD->getLocation(),
            diag::warn_redeclaration_without_attribute_prev_attribute_ignored)
-        << FD->getNameAsCString() << "dllimport";
+        << FD->getName() << "dllimport";
     }
   }
   return DeclPtrTy::make(FD);

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=111314&r1=111313&r2=111314&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Tue Aug 17 17:39:59 2010
@@ -387,7 +387,7 @@
       << property->getDeclName() << Ivar->getDeclName()
       << ClassDeclared->getDeclName();
       Diag(Ivar->getLocation(), diag::note_previous_access_declaration)
-      << Ivar << Ivar->getNameAsCString();
+      << Ivar << Ivar->getName();
       // Note! I deliberately want it to fall thru so more errors are caught.
     }
     QualType IvarType = Context.getCanonicalType(Ivar->getType());





More information about the cfe-commits mailing list