aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/DeclObjC.cpp4
-rw-r--r--lib/AST/StmtDumper.cpp9
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp16
-rw-r--r--lib/CodeGen/CGDecl.cpp6
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp22
-rw-r--r--lib/CodeGen/CGObjCMac.cpp7
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp3
-rw-r--r--lib/Sema/Sema.h2
-rw-r--r--lib/Sema/SemaDeclObjC.cpp23
9 files changed, 45 insertions, 47 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index e69526e241..040a921908 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -758,11 +758,11 @@ unsigned ObjCMethodDecl::getSynthesizedMethodSize() const {
// syntesized method name is a concatenation of -/+[class-name selector]
// Get length of this name.
unsigned length = 3; // _I_ or _C_
- length += strlen(getClassInterface()->getIdentifierName()) +1; // extra for _
+ length += getClassInterface()->getNameAsString().size()+1; // extra for _
NamedDecl *MethodContext = getMethodContext();
if (ObjCCategoryImplDecl *CID =
dyn_cast<ObjCCategoryImplDecl>(MethodContext))
- length += strlen(CID->getIdentifierName()) +1;
+ length += CID->getNameAsString().size()+1;
length += getSelector().getAsString().size(); // selector name
return length;
}
diff --git a/lib/AST/StmtDumper.cpp b/lib/AST/StmtDumper.cpp
index f7330c2a9d..b73dc534dc 100644
--- a/lib/AST/StmtDumper.cpp
+++ b/lib/AST/StmtDumper.cpp
@@ -203,7 +203,7 @@ void StmtDumper::DumpDeclarator(Decl *D) {
if (TypedefDecl *localType = dyn_cast<TypedefDecl>(D)) {
fprintf(F, "\"typedef %s %s\"",
localType->getUnderlyingType().getAsString().c_str(),
- localType->getIdentifierName());
+ localType->getNameAsString().c_str());
} else if (ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
fprintf(F, "\"");
// Emit storage class for vardecls.
@@ -304,8 +304,7 @@ void StmtDumper::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
DumpExpr(Node);
fprintf(F, " %sDecl='%s' %p", Node->getDecl()->getDeclKindName(),
- Node->getDecl()->getIdentifierName(),
- (void*)Node->getDecl());
+ Node->getDecl()->getNameAsString().c_str(), (void*)Node->getDecl());
if (Node->isFreeIvar())
fprintf(F, " isFreeIvar");
}
@@ -464,14 +463,14 @@ void StmtDumper::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
DumpExpr(Node);
fprintf(F, " ");
- fprintf(F, "%s", Node->getProtocol()->getIdentifierName());
+ fprintf(F, "%s", Node->getProtocol()->getNameAsString().c_str());
}
void StmtDumper::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
DumpExpr(Node);
fprintf(F, " Kind=PropertyRef Property=\"%s\"",
- Node->getProperty()->getIdentifierName());
+ Node->getProperty()->getNameAsString().c_str());
}
void StmtDumper::VisitObjCKVCRefExpr(ObjCKVCRefExpr *Node) {
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 55ce237e14..444ee7c400 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -152,7 +152,7 @@ llvm::DIType CGDebugInfo::CreateType(const TypedefType *Ty,
// We don't set size information, but do specify where the typedef was
// declared.
- const char *TyName = Ty->getDecl()->getIdentifierName();
+ std::string TyName = Ty->getDecl()->getNameAsString();
SourceLocation DefLoc = Ty->getDecl()->getLocation();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
@@ -206,8 +206,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
SourceManager &SM = M->getContext().getSourceManager();
// Get overall information about the record type for the debug info.
- const char *Name = Decl->getIdentifierName();
- if (Name == 0) Name = "";
+ std::string Name = Decl->getNameAsString();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(Decl->getLocation());
uint64_t Line = SM.getLogicalLineNumber(Decl->getLocation());
@@ -241,9 +240,8 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
E = Decl->field_end(); I != E; ++I, ++FieldNo) {
FieldDecl *Field = *I;
llvm::DIType FieldTy = getOrCreateType(Field->getType(), Unit);
-
- const char *FieldName = Field->getIdentifierName();
- if (FieldName == 0) FieldName = "";
+
+ std::string FieldName = Field->getNameAsString();
// Get the location for the field.
SourceLocation FieldDefLoc = Field->getLocation();
@@ -301,8 +299,7 @@ llvm::DIType CGDebugInfo::CreateType(const EnumType *Ty,
llvm::DIArray EltArray =
DebugFactory.GetOrCreateArray(&Enumerators[0], Enumerators.size());
- const char *EnumName
- = Decl->getIdentifierName() ? Decl->getIdentifierName() : "";
+ std::string EnumName = Decl->getNameAsString();
SourceLocation DefLoc = Decl->getLocation();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
SourceManager &SM = M->getContext().getSourceManager();
@@ -516,7 +513,8 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
SourceManager &SM = M->getContext().getSourceManager();
uint64_t LineNo = SM.getLogicalLineNumber(Decl->getLocation());
- const char *Name = Decl->getIdentifierName();
+
+ std::string Name = Decl->getNameAsString();
DebugFactory.CreateGlobalVariable(Unit, Name, Name, "", Unit, LineNo,
getOrCreateType(Decl->getType(), Unit),
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 7a86d24801..77ef57750e 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -146,7 +146,8 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
if (!Target.useGlobalsForAutomaticVariables()) {
// A normal fixed sized variable becomes an alloca in the entry block.
const llvm::Type *LTy = ConvertType(Ty);
- llvm::AllocaInst * Alloc = CreateTempAlloca(LTy, D.getIdentifierName());
+ llvm::AllocaInst *Alloc =
+ CreateTempAlloca(LTy, D.getIdentifier()->getName());
unsigned align = getContext().getTypeAlign(Ty);
if (const AlignedAttr* AA = D.getAttr<AlignedAttr>())
align = std::max(align, AA->getAlignment());
@@ -164,7 +165,8 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
// FIXME: VLA: Add VLA support. For now just make up enough to let
// the compile go through.
const llvm::Type *LTy = ConvertType(Ty);
- llvm::AllocaInst * Alloc = CreateTempAlloca(LTy, D.getIdentifierName());
+ llvm::AllocaInst *Alloc =
+ CreateTempAlloca(LTy, D.getIdentifier()->getName());
DeclPtr = Alloc;
}
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index 9bcd816c6d..32da770ba6 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -570,7 +570,7 @@ llvm::Value *CGObjCGNU::GenerateProtocolRef(CGBuilderTy &Builder,
void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
ASTContext &Context = CGM.getContext();
- const char *ProtocolName = PD->getIdentifierName();
+ std::string ProtocolName = PD->getNameAsString();
llvm::SmallVector<std::string, 16> Protocols;
for (ObjCProtocolDecl::protocol_iterator PI = PD->protocol_begin(),
E = PD->protocol_end(); PI != E; ++PI)
@@ -625,8 +625,8 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
}
void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
- const char *ClassName = OCD->getClassInterface()->getIdentifierName();
- const char *CategoryName = OCD->getIdentifierName();
+ std::string ClassName = OCD->getClassInterface()->getNameAsString();
+ std::string CategoryName = OCD->getNameAsString();
// Collect information about instance methods
llvm::SmallVector<Selector, 16> InstanceMethodSels;
llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes;
@@ -682,14 +682,13 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
// Get the superclass name.
const ObjCInterfaceDecl * SuperClassDecl =
OID->getClassInterface()->getSuperClass();
- const char * SuperClassName = NULL;
- if (SuperClassDecl) {
- SuperClassName = SuperClassDecl->getIdentifierName();
- }
+ std::string SuperClassName;
+ if (SuperClassDecl)
+ SuperClassName = SuperClassDecl->getNameAsString();
// Get the class name
ObjCInterfaceDecl * ClassDecl = (ObjCInterfaceDecl*)OID->getClassInterface();
- const char * ClassName = ClassDecl->getIdentifierName();
+ std::string ClassName = ClassDecl->getNameAsString();
// Get the size of instances. For runtimes that support late-bound instances
// this should probably be something different (size just of instance
@@ -758,7 +757,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
// Get the superclass pointer.
llvm::Constant *SuperClass;
- if (SuperClassName) {
+ if (!SuperClassName.empty()) {
SuperClass = MakeConstantString(SuperClassName, ".super_class_name");
} else {
SuperClass = llvm::ConstantPointerNull::get(
@@ -778,8 +777,9 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
NULLPtr, 0x2L, /*name*/"", 0, Zeros[0], GenerateIvarList(
empty, empty, empty), ClassMethodList, NULLPtr);
// Generate the class structure
- llvm::Constant *ClassStruct = GenerateClassStructure(MetaClassStruct,
- SuperClass, 0x1L, ClassName, 0,
+ llvm::Constant *ClassStruct =
+ GenerateClassStructure(MetaClassStruct, SuperClass, 0x1L,
+ ClassName.c_str(), 0,
llvm::ConstantInt::get(llvm::Type::Int32Ty, instanceSize), IvarList,
MethodList, GenerateProtocolList(Protocols));
// Add class structure to list to be added to the symtab later
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index f9a4d77925..975e386c70 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -664,7 +664,7 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) {
// over.
LazySymbols.insert(&CGM.getContext().Idents.get("Protocol"));
- const char *ProtocolName = PD->getIdentifierName();
+ const char *ProtocolName = PD->getNameAsCString();
// Construct method lists.
std::vector<llvm::Constant*> InstanceMethods, ClassMethods;
@@ -1076,7 +1076,7 @@ static bool IsClassHidden(const ObjCInterfaceDecl *ID) {
void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
DefinedSymbols.insert(ID->getIdentifier());
- const char *ClassName = ID->getIdentifierName();
+ std::string ClassName = ID->getNameAsString();
// FIXME: Gross
ObjCInterfaceDecl *Interface =
const_cast<ObjCInterfaceDecl*>(ID->getClassInterface());
@@ -1169,7 +1169,6 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
llvm::Constant *Protocols,
const llvm::Type *InterfaceTy,
const ConstantVector &Methods) {
- const char *ClassName = ID->getIdentifierName();
unsigned Flags = eClassFlags_Meta;
unsigned Size = CGM.getTargetData().getABITypeSize(ObjCTypes.ClassTy);
@@ -1215,7 +1214,7 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
Values);
std::string Name("\01L_OBJC_METACLASS_");
- Name += ClassName;
+ Name += ID->getNameAsCString();
// Check for a forward reference.
llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index b56b050c14..534adfe5bb 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -121,7 +121,8 @@ void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy,
if (CGDebugInfo *DI = CGM.getDebugInfo()) {
DI->setLocation(StartLoc);
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- DI->EmitFunctionStart(FD->getIdentifierName(), RetTy, CurFn, Builder);
+ DI->EmitFunctionStart(FD->getIdentifier()->getName(),
+ RetTy, CurFn, Builder);
} else {
// Just use LLVM function name.
DI->EmitFunctionStart(Fn->getName().c_str(),
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index de588c58fb..1b37051a7b 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -1029,7 +1029,7 @@ public:
unsigned &Attributes);
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
ObjCPropertyDecl *SuperProperty,
- const char *Name);
+ const IdentifierInfo *Name);
void ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl);
void MergeProtocolPropertiesIntoClass(ObjCInterfaceDecl *IDecl,
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 64fd6c515d..9141cb5b9e 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -242,7 +242,7 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
void
Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
ObjCPropertyDecl *SuperProperty,
- const char *inheritedName) {
+ const IdentifierInfo *inheritedName) {
ObjCPropertyDecl::PropertyAttributeKind CAttr =
Property->getPropertyAttributes();
ObjCPropertyDecl::PropertyAttributeKind SAttr =
@@ -250,31 +250,31 @@ Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
if ((CAttr & ObjCPropertyDecl::OBJC_PR_readonly)
&& (SAttr & ObjCPropertyDecl::OBJC_PR_readwrite))
Diag(Property->getLocation(), diag::warn_readonly_property)
- << Property->getName() << inheritedName;
+ << Property->getDeclName() << inheritedName;
if ((CAttr & ObjCPropertyDecl::OBJC_PR_copy)
!= (SAttr & ObjCPropertyDecl::OBJC_PR_copy))
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "copy" << inheritedName;
+ << Property->getDeclName() << "copy" << inheritedName;
else if ((CAttr & ObjCPropertyDecl::OBJC_PR_retain)
!= (SAttr & ObjCPropertyDecl::OBJC_PR_retain))
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "retain" << inheritedName;
+ << Property->getDeclName() << "retain" << inheritedName;
if ((CAttr & ObjCPropertyDecl::OBJC_PR_nonatomic)
!= (SAttr & ObjCPropertyDecl::OBJC_PR_nonatomic))
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "atomic" << inheritedName;
+ << Property->getDeclName() << "atomic" << inheritedName;
if (Property->getSetterName() != SuperProperty->getSetterName())
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "setter" << inheritedName;
+ << Property->getDeclName() << "setter" << inheritedName;
if (Property->getGetterName() != SuperProperty->getGetterName())
Diag(Property->getLocation(), diag::warn_property_attribute)
- << Property->getName() << "getter" << inheritedName;
+ << Property->getDeclName() << "getter" << inheritedName;
if (Context.getCanonicalType(Property->getType()) !=
Context.getCanonicalType(SuperProperty->getType()))
Diag(Property->getLocation(), diag::warn_property_type)
- << Property->getType().getAsString() << inheritedName;
+ << Property->getType() << inheritedName;
}
@@ -297,7 +297,7 @@ Sema::ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl) {
ObjCPropertyDecl *PDecl = (*I);
if (SuperPDecl->getIdentifier() == PDecl->getIdentifier())
DiagnosePropertyMismatch(PDecl, SuperPDecl,
- SDecl->getIdentifierName());
+ SDecl->getIdentifier());
}
}
}
@@ -307,8 +307,7 @@ Sema::ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl) {
/// of properties for current class if it is not there already.
void
Sema::MergeOneProtocolPropertiesIntoClass(ObjCInterfaceDecl *IDecl,
- ObjCProtocolDecl *PDecl)
-{
+ ObjCProtocolDecl *PDecl) {
llvm::SmallVector<ObjCPropertyDecl*, 16> mergeProperties;
for (ObjCProtocolDecl::classprop_iterator P = PDecl->classprop_begin(),
E = PDecl->classprop_end(); P != E; ++P) {
@@ -324,7 +323,7 @@ Sema::MergeOneProtocolPropertiesIntoClass(ObjCInterfaceDecl *IDecl,
mergeProperties.push_back(Pr);
else
// Property protocol already exist in class. Diagnose any mismatch.
- DiagnosePropertyMismatch((*CP), Pr, PDecl->getIdentifierName());
+ DiagnosePropertyMismatch((*CP), Pr, PDecl->getIdentifier());
}
IDecl->mergeProperties(&mergeProperties[0], mergeProperties.size());
}