summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Analysis/BugReporter.cpp6
-rw-r--r--clang/lib/Analysis/CheckDeadStores.cpp2
-rw-r--r--clang/lib/Analysis/CheckNSError.cpp2
-rw-r--r--clang/lib/Analysis/CheckObjCDealloc.cpp9
-rw-r--r--clang/lib/Analysis/CheckObjCInstMethSignature.cpp6
-rw-r--r--clang/lib/Analysis/CheckObjCUnusedIVars.cpp4
-rw-r--r--clang/lib/Analysis/MemRegion.cpp4
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp4
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp2
-rw-r--r--clang/lib/CodeGen/CGObjCGNU.cpp13
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp51
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp12
-rw-r--r--clang/lib/CodeGen/CodeGenTypes.cpp6
-rw-r--r--clang/lib/Sema/Sema.h4
-rw-r--r--clang/lib/Sema/SemaDecl.cpp48
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp19
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp8
-rw-r--r--clang/lib/Sema/SemaExpr.cpp34
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp10
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp2
-rw-r--r--clang/lib/Sema/SemaOverload.cpp22
21 files changed, 131 insertions, 137 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index 0074a93b5bc..905c697ffbb 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -400,8 +400,8 @@ public:
FullSourceLoc L(S->getLocStart(), BR.getSourceManager());
if (VD->getType()->isPointerLikeType()) {
- std::string msg = "'" + std::string(VD->getName()) +
- "' now aliases '" + MostRecent->getName() + "'";
+ std::string msg = "'" + std::string(VD->getNameAsString()) +
+ "' now aliases '" + MostRecent->getNameAsString() + "'";
PD.push_front(new PathDiagnosticPiece(L, msg));
}
@@ -579,7 +579,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
EnumConstantDecl* D = dyn_cast<EnumConstantDecl>(DR->getDecl());
if (D) {
GetRawInt = false;
- os << D->getName();
+ os << D->getNameAsString();
}
}
diff --git a/clang/lib/Analysis/CheckDeadStores.cpp b/clang/lib/Analysis/CheckDeadStores.cpp
index 2afc7e0235f..51943d50166 100644
--- a/clang/lib/Analysis/CheckDeadStores.cpp
+++ b/clang/lib/Analysis/CheckDeadStores.cpp
@@ -41,7 +41,7 @@ public:
void Report(VarDecl* V, DeadStoreKind dsk, SourceLocation L, SourceRange R) {
- std::string name(V->getName());
+ std::string name = V->getNameAsString();
const char* BugType = 0;
std::string msg;
diff --git a/clang/lib/Analysis/CheckNSError.cpp b/clang/lib/Analysis/CheckNSError.cpp
index f76b601e2d5..919c17d0646 100644
--- a/clang/lib/Analysis/CheckNSError.cpp
+++ b/clang/lib/Analysis/CheckNSError.cpp
@@ -251,7 +251,7 @@ void NSErrorCheck::CheckParamDeref(VarDecl* Param, GRStateRef rootState,
else
os << "documented in CoreFoundation/CFError.h the parameter '";
- os << Param->getName() << "' may be null.";
+ os << Param->getNameAsString() << "' may be null.";
desc = os.str().c_str();
BR.addNotableSymbol(SV->getSymbol());
diff --git a/clang/lib/Analysis/CheckObjCDealloc.cpp b/clang/lib/Analysis/CheckObjCDealloc.cpp
index 6fba9aeea9a..a9e5675ce21 100644
--- a/clang/lib/Analysis/CheckObjCDealloc.cpp
+++ b/clang/lib/Analysis/CheckObjCDealloc.cpp
@@ -149,7 +149,7 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D,
std::string buf;
llvm::raw_string_ostream os(buf);
- os << "Objective-C class '" << D->getName()
+ os << "Objective-C class '" << D->getNameAsString()
<< "' lacks a 'dealloc' instance method";
BR.EmitBasicReport(name, os.str().c_str(), D->getLocStart());
@@ -165,7 +165,8 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D,
std::string buf;
llvm::raw_string_ostream os(buf);
- os << "The 'dealloc' instance method in Objective-C class '" << D->getName()
+ os << "The 'dealloc' instance method in Objective-C class '"
+ << D->getNameAsString()
<< "' does not send a 'dealloc' message to its super class"
" (missing [super dealloc])";
@@ -220,7 +221,7 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D,
? "missing ivar release (leak)"
: "missing ivar release (Hybrid MM, non-GC)";
- os << "The '" << ID->getName()
+ os << "The '" << ID->getNameAsString()
<< "' instance variable was retained by a synthesized property but "
"wasn't released in 'dealloc'";
} else {
@@ -228,7 +229,7 @@ void clang::CheckObjCDealloc(ObjCImplementationDecl* D,
? "extra ivar release (use-after-release)"
: "extra ivar release (Hybrid MM, non-GC)";
- os << "The '" << ID->getName()
+ os << "The '" << ID->getNameAsString()
<< "' instance variable was not retained by a synthesized property "
"but was released in 'dealloc'";
}
diff --git a/clang/lib/Analysis/CheckObjCInstMethSignature.cpp b/clang/lib/Analysis/CheckObjCInstMethSignature.cpp
index 00dbe9f2b26..2d100793c21 100644
--- a/clang/lib/Analysis/CheckObjCInstMethSignature.cpp
+++ b/clang/lib/Analysis/CheckObjCInstMethSignature.cpp
@@ -49,16 +49,16 @@ static void CompareReturnTypes(ObjCMethodDecl* MethDerived,
std::ostringstream os;
os << "The Objective-C class '"
- << MethDerived->getClassInterface()->getName()
+ << MethDerived->getClassInterface()->getNameAsString()
<< "', which is derived from class '"
- << MethAncestor->getClassInterface()->getName()
+ << MethAncestor->getClassInterface()->getNameAsString()
<< "', defines the instance method '"
<< MethDerived->getSelector().getAsString()
<< "' whose return type is '"
<< ResDerived.getAsString()
<< "'. A method with the same name (same selector) is also defined in "
"class '"
- << MethAncestor->getClassInterface()->getName()
+ << MethAncestor->getClassInterface()->getNameAsString()
<< "' and has a return type of '"
<< ResAncestor.getAsString()
<< "'. These two types are incompatible, and may result in undefined "
diff --git a/clang/lib/Analysis/CheckObjCUnusedIVars.cpp b/clang/lib/Analysis/CheckObjCUnusedIVars.cpp
index c2deeeff8fe..ef7b318b769 100644
--- a/clang/lib/Analysis/CheckObjCUnusedIVars.cpp
+++ b/clang/lib/Analysis/CheckObjCUnusedIVars.cpp
@@ -98,8 +98,8 @@ void clang::CheckObjCUnusedIvar(ObjCImplementationDecl* D, BugReporter& BR) {
if (I->second == Unused) {
std::ostringstream os;
- os << "Instance variable '" << I->first->getName()
- << "' in class '" << ID->getName()
+ os << "Instance variable '" << I->first->getNameAsString()
+ << "' in class '" << ID->getNameAsString()
<< "' is never used by the methods in its @implementation "
"(although it may be used by category methods).";
diff --git a/clang/lib/Analysis/MemRegion.cpp b/clang/lib/Analysis/MemRegion.cpp
index 28a27b048ae..86f8571bc97 100644
--- a/clang/lib/Analysis/MemRegion.cpp
+++ b/clang/lib/Analysis/MemRegion.cpp
@@ -145,7 +145,7 @@ void AllocaRegion::print(llvm::raw_ostream& os) const {
}
void VarRegion::print(llvm::raw_ostream& os) const {
- os << cast<VarDecl>(D)->getName();
+ os << cast<VarDecl>(D)->getNameAsString();
}
void SymbolicRegion::print(llvm::raw_ostream& os) const {
@@ -154,7 +154,7 @@ void SymbolicRegion::print(llvm::raw_ostream& os) const {
void FieldRegion::print(llvm::raw_ostream& os) const {
superRegion->print(os);
- os << "->" << getDecl()->getName();
+ os << "->" << getDecl()->getNameAsString();
}
void ElementRegion::print(llvm::raw_ostream& os) const {
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 444ee7c4005..e862808d12a 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -291,7 +291,7 @@ llvm::DIType CGDebugInfo::CreateType(const EnumType *Ty,
// Create DIEnumerator elements for each enumerator.
for (EnumConstantDecl *Elt = Decl->getEnumConstantList(); Elt;
Elt = dyn_cast_or_null<EnumConstantDecl>(Elt->getNextDeclarator())) {
- Enumerators.push_back(DebugFactory.CreateEnumerator(Elt->getName(),
+ Enumerators.push_back(DebugFactory.CreateEnumerator(Elt->getNameAsString(),
Elt->getInitVal().getZExtValue()));
}
@@ -484,7 +484,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
// Create the descriptor for the variable.
llvm::DIVariable D =
- DebugFactory.CreateVariable(Tag, RegionStack.back(), Decl->getName(),
+ DebugFactory.CreateVariable(Tag, RegionStack.back(),Decl->getNameAsString(),
Unit, Line,
getOrCreateType(Decl->getType(), Unit));
// Insert an llvm.dbg.declare into the current block.
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 4ad698ad11a..bdbd5caa089 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -649,7 +649,7 @@ LValue CodeGenFunction::EmitPredefinedFunctionName(unsigned Type) {
std::string FunctionName;
if(const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurFuncDecl)) {
- FunctionName = FD->getName();
+ FunctionName = FD->getNameAsString();
} else {
// Just get the mangled name.
FunctionName = CurFn->getName();
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 32da770ba60..3f2f99c97c1 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -193,7 +193,7 @@ CGObjCGNU::CGObjCGNU(CodeGen::CodeGenModule &cgm)
// techniques can modify the name -> class mapping.
llvm::Value *CGObjCGNU::GetClass(CGBuilderTy &Builder,
const ObjCInterfaceDecl *OID) {
- llvm::Value *ClassName = CGM.GetAddrOfConstantCString(OID->getName());
+ llvm::Value *ClassName = CGM.GetAddrOfConstantCString(OID->getNameAsString());
ClassName = Builder.CreateStructGEP(ClassName, 0);
llvm::Constant *ClassLookupFn =
@@ -565,7 +565,7 @@ llvm::Constant *CGObjCGNU::GenerateProtocolList(
llvm::Value *CGObjCGNU::GenerateProtocolRef(CGBuilderTy &Builder,
const ObjCProtocolDecl *PD) {
- return ExistingProtocols[PD->getName()];
+ return ExistingProtocols[PD->getNameAsString()];
}
void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
@@ -574,7 +574,7 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
llvm::SmallVector<std::string, 16> Protocols;
for (ObjCProtocolDecl::protocol_iterator PI = PD->protocol_begin(),
E = PD->protocol_end(); PI != E; ++PI)
- Protocols.push_back((*PI)->getName());
+ Protocols.push_back((*PI)->getNameAsString());
llvm::SmallVector<llvm::Constant*, 16> InstanceMethodNames;
llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes;
for (ObjCProtocolDecl::instmeth_iterator iter = PD->instmeth_begin(),
@@ -655,7 +655,7 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
const ObjCList<ObjCProtocolDecl> &Protos =ClassDecl->getReferencedProtocols();
for (ObjCList<ObjCProtocolDecl>::iterator I = Protos.begin(),
E = Protos.end(); I != E; ++I)
- Protocols.push_back((*I)->getName());
+ Protocols.push_back((*I)->getNameAsString());
std::vector<llvm::Constant*> Elements;
Elements.push_back(MakeConstantString(CategoryName));
@@ -713,7 +713,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
for (ObjCInterfaceDecl::ivar_iterator iter = ClassDecl->ivar_begin(),
endIter = ClassDecl->ivar_end() ; iter != endIter ; iter++) {
// Store the name
- IvarNames.push_back(CGM.GetAddrOfConstantCString((*iter)->getName()));
+ IvarNames.push_back(CGM.GetAddrOfConstantCString((*iter)
+ ->getNameAsString()));
// Get the type encoding for this ivar
std::string TypeStr;
Context.getObjCEncodingForType((*iter)->getType(), TypeStr);
@@ -751,7 +752,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
const ObjCList<ObjCProtocolDecl> &Protos =ClassDecl->getReferencedProtocols();
for (ObjCList<ObjCProtocolDecl>::iterator I = Protos.begin(),
E = Protos.end(); I != E; ++I)
- Protocols.push_back((*I)->getName());
+ Protocols.push_back((*I)->getNameAsString());
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 975e386c705..67f65599388 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -695,17 +695,17 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) {
Values[0] = EmitProtocolExtension(PD, OptInstanceMethods, OptClassMethods);
Values[1] = GetClassName(PD->getIdentifier());
Values[2] =
- EmitProtocolList(std::string("\01L_OBJC_PROTOCOL_REFS_")+PD->getName(),
+ EmitProtocolList("\01L_OBJC_PROTOCOL_REFS_" + PD->getNameAsString(),
PD->protocol_begin(),
PD->protocol_end());
Values[3] =
- EmitMethodDescList(std::string("\01L_OBJC_PROTOCOL_INSTANCE_METHODS_")
- + PD->getName(),
+ EmitMethodDescList("\01L_OBJC_PROTOCOL_INSTANCE_METHODS_"
+ + PD->getNameAsString(),
"__OBJC,__cat_inst_meth,regular,no_dead_strip",
InstanceMethods);
Values[4] =
- EmitMethodDescList(std::string("\01L_OBJC_PROTOCOL_CLASS_METHODS_")
- + PD->getName(),
+ EmitMethodDescList("\01L_OBJC_PROTOCOL_CLASS_METHODS_"
+ + PD->getNameAsString(),
"__OBJC,__cat_cls_meth,regular,no_dead_strip",
ClassMethods);
llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ProtocolTy,
@@ -742,7 +742,7 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocolRef(const ObjCProtocolDecl *PD) {
new llvm::GlobalVariable(ObjCTypes.ProtocolTy, false,
llvm::GlobalValue::ExternalLinkage,
0,
- std::string("\01L_OBJC_PROTOCOL_")+PD->getName(),
+ "\01L_OBJC_PROTOCOL_" + PD->getNameAsString(),
&CGM.getModule());
Entry->setSection("__OBJC,__protocol,regular,no_dead_strip");
UsedGlobals.push_back(Entry);
@@ -770,17 +770,17 @@ CGObjCMac::EmitProtocolExtension(const ObjCProtocolDecl *PD,
std::vector<llvm::Constant*> Values(4);
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
Values[1] =
- EmitMethodDescList(std::string("\01L_OBJC_PROTOCOL_INSTANCE_METHODS_OPT_")
- + PD->getName(),
+ EmitMethodDescList("\01L_OBJC_PROTOCOL_INSTANCE_METHODS_OPT_"
+ + PD->getNameAsString(),
"__OBJC,__cat_inst_meth,regular,no_dead_strip",
OptInstanceMethods);
Values[2] =
- EmitMethodDescList(std::string("\01L_OBJC_PROTOCOL_CLASS_METHODS_OPT_")
- + PD->getName(),
+ EmitMethodDescList("\01L_OBJC_PROTOCOL_CLASS_METHODS_OPT_"
+ + PD->getNameAsString(),
"__OBJC,__cat_cls_meth,regular,no_dead_strip",
OptClassMethods);
- Values[3] = EmitPropertyList(std::string("\01L_OBJC_$_PROP_PROTO_LIST_") +
- PD->getName(),
+ Values[3] = EmitPropertyList("\01L_OBJC_$_PROP_PROTO_LIST_" +
+ PD->getNameAsString(),
0,
PD->classprop_begin(),
PD->classprop_end());
@@ -796,8 +796,7 @@ CGObjCMac::EmitProtocolExtension(const ObjCProtocolDecl *PD,
new llvm::GlobalVariable(ObjCTypes.ProtocolExtensionTy, false,
llvm::GlobalValue::InternalLinkage,
Init,
- (std::string("\01L_OBJC_PROTOCOLEXT_") +
- PD->getName()),
+ "\01L_OBJC_PROTOCOLEXT_" + PD->getNameAsString(),
&CGM.getModule());
// No special section, but goes in llvm.used
UsedGlobals.push_back(GV);
@@ -962,9 +961,8 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
const ObjCInterfaceDecl *Interface = OCD->getClassInterface();
const ObjCCategoryDecl *Category =
Interface->FindCategoryDeclaration(OCD->getIdentifier());
- std::string ExtName(std::string(Interface->getName()) +
- "_" +
- OCD->getName());
+ std::string ExtName(Interface->getNameAsString() + "_" +
+ OCD->getNameAsString());
std::vector<llvm::Constant*> InstanceMethods, ClassMethods;
for (ObjCCategoryImplDecl::instmeth_iterator i = OCD->instmeth_begin(),
@@ -1081,7 +1079,7 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
ObjCInterfaceDecl *Interface =
const_cast<ObjCInterfaceDecl*>(ID->getClassInterface());
llvm::Constant *Protocols =
- EmitProtocolList(std::string("\01L_OBJC_CLASS_PROTOCOLS_") + ID->getName(),
+ EmitProtocolList("\01L_OBJC_CLASS_PROTOCOLS_" + ID->getNameAsString(),
Interface->protocol_begin(),
Interface->protocol_end());
const llvm::Type *InterfaceTy =
@@ -1140,7 +1138,7 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
Values[ 5] = llvm::ConstantInt::get(ObjCTypes.LongTy, Size);
Values[ 6] = EmitIvarList(ID, false, InterfaceTy);
Values[ 7] =
- EmitMethodList(std::string("\01L_OBJC_INSTANCE_METHODS_") + ID->getName(),
+ EmitMethodList("\01L_OBJC_INSTANCE_METHODS_" + ID->getNameAsString(),
"__OBJC,__inst_meth,regular,no_dead_strip",
InstanceMethods);
// cache is always NULL.
@@ -1200,7 +1198,7 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
Values[ 5] = llvm::ConstantInt::get(ObjCTypes.LongTy, Size);
Values[ 6] = EmitIvarList(ID, true, InterfaceTy);
Values[ 7] =
- EmitMethodList(std::string("\01L_OBJC_CLASS_METHODS_") + ID->getName(),
+ EmitMethodList("\01L_OBJC_CLASS_METHODS_" + ID->getNameAsString(),
"__OBJC,__inst_meth,regular,no_dead_strip",
Methods);
// cache is always NULL.
@@ -1238,8 +1236,7 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
}
llvm::Constant *CGObjCMac::EmitMetaClassRef(const ObjCInterfaceDecl *ID) {
- std::string Name("\01L_OBJC_METACLASS_");
- Name += ID->getName();
+ std::string Name = "\01L_OBJC_METACLASS_" + ID->getNameAsString();
// FIXME: Should we look these up somewhere other than the
// module. Its a bit silly since we only generate these while
@@ -1278,8 +1275,7 @@ CGObjCMac::EmitClassExtension(const ObjCImplementationDecl *ID) {
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
// FIXME: Output weak_ivar_layout string.
Values[1] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy);
- Values[2] = EmitPropertyList(std::string("\01L_OBJC_$_PROP_LIST_") +
- ID->getName(),
+ Values[2] = EmitPropertyList("\01L_OBJC_$_PROP_LIST_" + ID->getNameAsString(),
ID,
ID->getClassInterface()->classprop_begin(),
ID->getClassInterface()->classprop_end());
@@ -1294,8 +1290,7 @@ CGObjCMac::EmitClassExtension(const ObjCImplementationDecl *ID) {
new llvm::GlobalVariable(ObjCTypes.ClassExtensionTy, false,
llvm::GlobalValue::InternalLinkage,
Init,
- (std::string("\01L_OBJC_CLASSEXT_") +
- ID->getName()),
+ "\01L_OBJC_CLASSEXT_" + ID->getNameAsString(),
&CGM.getModule());
// No special section, but goes in llvm.used
UsedGlobals.push_back(GV);
@@ -1361,7 +1356,7 @@ llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID,
new llvm::GlobalVariable(Init->getType(), false,
llvm::GlobalValue::InternalLinkage,
Init,
- std::string(Prefix) + ID->getName(),
+ Prefix + ID->getNameAsString(),
&CGM.getModule());
if (ForClass) {
GV->setSection("__OBJC,__cls_vars,regular,no_dead_strip");
@@ -2145,7 +2140,7 @@ void CGObjCMac::GetNameForMethod(const ObjCMethodDecl *D,
// FIXME: Find the mangling GCC uses.
NameOut = (D->isInstance() ? "-" : "+");
NameOut += '[';
- NameOut += D->getClassInterface()->getName();
+ NameOut += D->getClassInterface()->getNameAsString();
NameOut += ' ';
NameOut += D->getSelector().getAsString();
NameOut += ']';
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 2ff2beeb836..f0aa8b7d141 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -321,9 +321,7 @@ void CodeGenModule::EmitAliases() {
llvm::GlobalValue *GA =
new llvm::GlobalAlias(aliasee->getType(),
llvm::Function::ExternalLinkage,
- D->getName(),
- aliasee,
- &getModule());
+ D->getNameAsString(), aliasee, &getModule());
llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()];
if (Entry) {
@@ -482,7 +480,7 @@ void CodeGenModule::EmitGlobalDefinition(const ValueDecl *D) {
if (!Entry)
Entry = new llvm::GlobalVariable(Ty, false,
llvm::GlobalValue::ExternalLinkage,
- 0, D->getName(), &getModule(), 0,
+ 0, D->getNameAsString(), &getModule(), 0,
ASTTy.getAddressSpace());
// Make sure the result is of the correct type.
@@ -518,7 +516,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
if (!GV) {
GV = new llvm::GlobalVariable(InitType, false,
llvm::GlobalValue::ExternalLinkage,
- 0, D->getName(), &getModule(), 0,
+ 0, D->getNameAsString(), &getModule(), 0,
ASTTy.getAddressSpace());
} else if (GV->getType() !=
llvm::PointerType::get(InitType, ASTTy.getAddressSpace())) {
@@ -542,7 +540,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
// Make a new global with the correct type
GV = new llvm::GlobalVariable(InitType, false,
llvm::GlobalValue::ExternalLinkage,
- 0, D->getName(), &getModule(), 0,
+ 0, D->getNameAsString(), &getModule(), 0,
ASTTy.getAddressSpace());
// Steal the name of the old global
GV->takeName(OldGV);
@@ -630,7 +628,7 @@ CodeGenModule::EmitForwardFunctionDefinition(const FunctionDecl *D) {
const llvm::Type *Ty = getTypes().ConvertType(D->getType());
llvm::Function *F = llvm::Function::Create(cast<llvm::FunctionType>(Ty),
llvm::Function::ExternalLinkage,
- D->getName(), &getModule());
+ D->getNameAsString(),&getModule());
SetFunctionAttributes(D, F);
return F;
}
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index e49281dd685..18cfdeaff6e 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -291,7 +291,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
std::vector<const llvm::Type*> IvarTypes;
CollectObjCIvarTypes(OIT.getDecl(), IvarTypes);
llvm::Type *T = llvm::StructType::get(IvarTypes);
- TheModule.addTypeName(std::string("struct.") + OIT.getDecl()->getName(), T);
+ TheModule.addTypeName("struct." + OIT.getDecl()->getNameAsString(), T);
return T;
}
@@ -315,9 +315,9 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
// Name the codegen type after the typedef name
// if there is no tag type name available
if (TD->getIdentifier())
- TypeName += TD->getName();
+ TypeName += TD->getNameAsString();
else if (const TypedefType *TdT = dyn_cast<TypedefType>(T))
- TypeName += TdT->getDecl()->getName();
+ TypeName += TdT->getDecl()->getNameAsString();
else
TypeName += "anon";
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index 1b37051a7b9..4d0340bba39 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -776,7 +776,7 @@ public:
PerformInitializationByConstructor(QualType ClassType,
Expr **Args, unsigned NumArgs,
SourceLocation Loc, SourceRange Range,
- std::string InitEntity,
+ DeclarationName InitEntity,
InitializationKind Kind);
/// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
@@ -1262,7 +1262,7 @@ public:
/// type checking declaration initializers (C99 6.7.8)
friend class InitListChecker;
bool CheckInitializerTypes(Expr *&simpleInit_or_initList, QualType &declType,
- SourceLocation InitLoc, std::string InitEntity);
+ SourceLocation InitLoc,DeclarationName InitEntity);
bool CheckSingleInitializer(Expr *&simpleInit, QualType declType);
bool CheckForConstantInitializer(Expr *e, QualType t);
bool CheckArithmeticConstantExpression(const Expr* e);
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 8ffafadd3e9..4f71f068c5c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -492,7 +492,7 @@ Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, bool &Redeclaration) {
// TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope.
// TODO: This is totally simplistic. It should handle merging functions
// together etc, merging extern int X; int X; ...
- Diag(New->getLocation(), diag::err_conflicting_types) << New->getName();
+ Diag(New->getLocation(), diag::err_conflicting_types) << New->getDeclName();
Diag(Old->getLocation(), PrevDiag);
return New;
}
@@ -576,14 +576,14 @@ VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) {
if (New->getStorageClass() == VarDecl::Static &&
(Old->getStorageClass() == VarDecl::None ||
Old->getStorageClass() == VarDecl::Extern)) {
- Diag(New->getLocation(), diag::err_static_non_static) << New->getName();
+ Diag(New->getLocation(), diag::err_static_non_static) << New->getDeclName();
Diag(Old->getLocation(), diag::note_previous_definition);
return New;
}
// C99 6.2.2p4: Check if we have a non-static decl followed by a static.
if (New->getStorageClass() != VarDecl::Static &&
Old->getStorageClass() == VarDecl::Static) {
- Diag(New->getLocation(), diag::err_non_static_static) << New->getName();
+ Diag(New->getLocation(), diag::err_non_static_static) << New->getDeclName();
Diag(Old->getLocation(), diag::note_previous_definition);
return New;
}
@@ -611,7 +611,7 @@ bool Sema::CheckParmsForFunctionDef(FunctionDecl *FD) {
if (Param->getType()->isIncompleteType() &&
!Param->isInvalidDecl()) {
Diag(Param->getLocation(), diag::err_typecheck_decl_incomplete_type)
- << Param->getType().getAsString();
+ << Param->getType();
Param->setInvalidDecl();
HasInvalidParm = true;
}
@@ -676,9 +676,9 @@ StringLiteral *Sema::IsStringLiteralInit(Expr *Init, QualType DeclType) {
bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
SourceLocation InitLoc,
- std::string InitEntity) {
+ DeclarationName InitEntity) {
// C++ [dcl.init.ref]p1:
- // A variable declared to be a T&, that is “reference to type T”
+ // A variable declared to be a T&, that is "reference to type T"
// (8.3.2), shall be initialized by an object, or function, of
// type T or by an object that can be converted into a T.
if (DeclType->isReferenceType())
@@ -734,7 +734,7 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
return false;
return Diag(InitLoc, diag::err_typecheck_convert_incompatible)
- << DeclType.getAsString() << InitEntity << "initializing"
+ << DeclType << InitEntity << "initializing"
<< Init->getSourceRange();
}
@@ -859,7 +859,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
Diag(L, diag::err_invalid_declarator_in_function) << Name << R;
} else {
Diag(L, diag::err_invalid_declarator_scope)
- << Name.getAsString() << cast<NamedDecl>(DC)->getName() << R;
+ << Name << cast<NamedDecl>(DC)->getDeclName() << R;
}
}
}
@@ -1761,7 +1761,7 @@ void Sema::AddInitializerToDecl(DeclTy *dcl, ExprTy *init) {
VDecl->setInvalidDecl();
} else if (!VDecl->isInvalidDecl()) {
if (CheckInitializerTypes(Init, DclT, VDecl->getLocation(),
- VDecl->getName()))
+ VDecl->getDeclName()))
VDecl->setInvalidDecl();
// C++ 3.6.2p2, allow dynamic initialization of static initializers.
@@ -1775,7 +1775,7 @@ void Sema::AddInitializerToDecl(DeclTy *dcl, ExprTy *init) {
Diag(VDecl->getLocation(), diag::warn_extern_init);
if (!VDecl->isInvalidDecl())
if (CheckInitializerTypes(Init, DclT, VDecl->getLocation(),
- VDecl->getName()))
+ VDecl->getDeclName()))
VDecl->setInvalidDecl();
// C++ 3.6.2p2, allow dynamic initialization of static initializers.
@@ -1815,7 +1815,8 @@ void Sema::ActOnUninitializedDecl(DeclTy *dcl) {
// specifier is explicitly used.
if (Type->isReferenceType() && Var->getStorageClass() != VarDecl::Extern) {
Diag(Var->getLocation(), diag::err_reference_var_requires_init)
- << Var->getName() << SourceRange(Var->getLocation(), Var->getLocation());
+ << Var->getDeclName()
+ << SourceRange(Var->getLocation(), Var->getLocation());
Var->setInvalidDecl();
return;
}
@@ -1837,7 +1838,7 @@ void Sema::ActOnUninitializedDecl(DeclTy *dcl) {
Var->getLocation(),
SourceRange(Var->getLocation(),
Var->getLocation()),
- Var->getName(),
+ Var->getDeclName(),
IK_Default);
if (!Constructor)
Var->setInvalidDecl();
@@ -1918,8 +1919,7 @@ Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) {
if (IDecl->isBlockVarDecl() &&
IDecl->getStorageClass() != VarDecl::Extern) {
if (T->isIncompleteType() && !IDecl->isInvalidDecl()) {
- Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type)
- << T.getAsString();
+ Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type)<<T;
IDecl->setInvalidDecl();
}
}
@@ -1936,8 +1936,7 @@ Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) {
// C99 6.9.2p3: If the declaration of an identifier for an object is
// a tentative definition and has internal linkage (C99 6.2.2p3), the
// declared type shall not be an incomplete type.
- Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type)
- << T.getAsString();
+ Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type)<<T;
IDecl->setInvalidDecl();
}
}
@@ -2716,7 +2715,7 @@ void Sema::ActOnFields(Scope* S,
// We discover this when we complete the outer S. Reject and ignore the
// outer S.
Diag(DefRecord->getLocation(), diag::err_nested_redefinition)
- << DefRecord->getKindName();
+ << DefRecord->getDeclName();
Diag(RecLoc, diag::note_previous_definition);
Record->setInvalidDecl();
return;
@@ -2741,7 +2740,7 @@ void Sema::ActOnFields(Scope* S,
// C99 6.7.2.1p2 - A field may not be a function type.
if (FDTy->isFunctionType()) {
Diag(FD->getLocation(), diag::err_field_declared_as_function)
- << FD->getName();
+ << FD->getDeclName();
FD->setInvalidDecl();
EnclosingDecl->setInvalidDecl();
continue;
@@ -2749,7 +2748,7 @@ void Sema::ActOnFields(Scope* S,
// C99 6.7.2.1p2 - A field may not be an incomplete type except...
if (FDTy->isIncompleteType()) {
if (!Record) { // Incomplete ivar type is always an error.
- Diag(FD->getLocation(), diag::err_field_incomplete) << FD->getName();
+ Diag(FD->getLocation(), diag::err_field_incomplete) <<FD->getDeclName();
FD->setInvalidDecl();
EnclosingDecl->setInvalidDecl();
continue;
@@ -2757,14 +2756,14 @@ void Sema::ActOnFields(Scope* S,
if (i != NumFields-1 || // ... that the last member ...
!Record->isStruct() || // ... of a structure ...
!FDTy->isArrayType()) { //... may have incomplete array type.
- Diag(FD->getLocation(), diag::err_field_incomplete) << FD->getName();
+ Diag(FD->getLocation(), diag::err_field_incomplete) <<FD->getDeclName();
FD->setInvalidDecl();
EnclosingDecl->setInvalidDecl();
continue;
}
if (NumNamedMembers < 1) { //... must have more than named member ...
Diag(FD->getLocation(), diag::err_flexible_array_empty_struct)
- << FD->getName();
+ << FD->getDeclName();
FD->setInvalidDecl();
EnclosingDecl->setInvalidDecl();
continue;
@@ -2786,7 +2785,7 @@ void Sema::ActOnFields(Scope* S,
// structures.
if (i != NumFields-1) {
Diag(FD->getLocation(), diag::err_variable_sized_type_in_struct)
- << FD->getName();
+ << FD->getDeclName();
FD->setInvalidDecl();
EnclosingDecl->setInvalidDecl();
continue;
@@ -2794,7 +2793,7 @@ void Sema::ActOnFields(Scope* S,
// We support flexible arrays at the end of structs in other structs
// as an extension.
Diag(FD->getLocation(), diag::ext_flexible_array_in_struct)
- << FD->getName();
+ << FD->getDeclName();
if (Record)
Record->setHasFlexibleArrayMember(true);
}
@@ -2942,7 +2941,8 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDeclX,
// enum e0 {
// E0 = sizeof(enum e0 { E1 })
// };
- Diag(Enum->getLocation(), diag::err_nested_redefinition) << Enum->getName();
+ Diag(Enum->getLocation(), diag::err_nested_redefinition)
+ << Enum->getDeclName();
Diag(EnumLoc, diag::note_previous_definition);
Enum->setInvalidDecl();
return;
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index d9f3bc652e8..b99f2e0dc12 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -938,7 +938,7 @@ bool Sema::CheckDestructorDeclarator(Declarator &D, QualType &R,
TypeDecl *DeclaratorTypeD = (TypeDecl *)D.getDeclaratorIdType();
if (const TypedefDecl *TypedefD = dyn_cast<TypedefDecl>(DeclaratorTypeD)) {
Diag(D.getIdentifierLoc(), diag::err_destructor_typedef_name)
- << TypedefD->getName();
+ << TypedefD->getDeclName();
isInvalid = true;
}
@@ -1352,7 +1352,7 @@ void Sema::AddCXXDirectInitializerToDecl(DeclTy *Dcl, SourceLocation LParenLoc,
VDecl->getLocation(),
SourceRange(VDecl->getLocation(),
RParenLoc),
- VDecl->getName(),
+ VDecl->getDeclName(),
IK_Direct);
if (!Constructor) {
RealDecl->setInvalidDecl();
@@ -1400,7 +1400,7 @@ CXXConstructorDecl *
Sema::PerformInitializationByConstructor(QualType ClassType,
Expr **Args, unsigned NumArgs,
SourceLocation Loc, SourceRange Range,
- std::string InitEntity,
+ DeclarationName InitEntity,
InitializationKind Kind) {
const RecordType *ClassRec = ClassType->getAsRecordType();
assert(ClassRec && "Can only initialize a class type here");
@@ -1810,8 +1810,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
if (CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(FnDecl)) {
if (MethodDecl->isStatic())
return Diag(FnDecl->getLocation(),
- diag::err_operator_overload_static)
- << FnDecl->getName();
+ diag::err_operator_overload_static) << FnDecl->getDeclName();
} else {
bool ClassOrEnumParam = false;
for (FunctionDecl::param_iterator Param = FnDecl->param_begin(),
@@ -1827,7 +1826,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
if (!ClassOrEnumParam)
return Diag(FnDecl->getLocation(),
diag::err_operator_overload_needs_class_or_enum)
- << FnDecl->getName();
+ << FnDecl->getDeclName();
}
// C++ [over.oper]p8:
@@ -1842,7 +1841,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
if (Expr *DefArg = (*Param)->getDefaultArg())
return Diag((*Param)->getLocation(),
diag::err_operator_overload_default_arg)
- << FnDecl->getName() << DefArg->getSourceRange();
+ << FnDecl->getDeclName() << DefArg->getSourceRange();
}
}
@@ -1880,21 +1879,21 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
}
return Diag(FnDecl->getLocation(), diag::err_operator_overload_must_be)
- << FnDecl->getName() << NumParams << ErrorKind;
+ << FnDecl->getDeclName() << NumParams << ErrorKind;
}
// Overloaded operators other than operator() cannot be variadic.
if (Op != OO_Call &&
FnDecl->getType()->getAsFunctionTypeProto()->isVariadic()) {
return Diag(FnDecl->getLocation(), diag::err_operator_overload_variadic)
- << FnDecl->getName();
+ << FnDecl->getDeclName();
}
// Some operators must be non-static member functions.
if (MustBeMemberOperator && !isa<CXXMethodDecl>(FnDecl)) {
return Diag(FnDecl->getLocation(),
diag::err_operator_overload_must_be_member)
- << FnDecl->getName();
+ << FnDecl->getDeclName();
}
// C++ [over.inc]p1:
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 9141cb5b9e5..4d4c82be699 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -75,7 +75,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
if (IDecl) {
// Class already seen. Is it a forward declaration?
if (!IDecl->isForwardDecl()) {
- Diag(AtInterfaceLoc, diag::err_duplicate_class_def) << IDecl->getName();
+ Diag(AtInterfaceLoc, diag::err_duplicate_class_def)<<IDecl->getDeclName();
Diag(IDecl->getLocation(), diag::note_previous_definition);
// Return the previous class interface.
@@ -1264,7 +1264,7 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
// Look for this property declaration in the @implementation's @interface
property = IDecl->FindPropertyDeclaration(PropertyId);
if (!property) {
- Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getName();
+ Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName();
return 0;
}
}
@@ -1289,7 +1289,7 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
property = Category->FindPropertyDeclaration(PropertyId);
if (!property) {
Diag(PropertyLoc, diag::error_bad_category_property_decl)
- << Category->getName();
+ << Category->getDeclName();
return 0;
}
}
@@ -1316,7 +1316,7 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
if (PropType != IvarType) {
if (CheckAssignmentConstraints(PropType, IvarType) != Compatible) {
Diag(PropertyLoc, diag::error_property_ivar_type)
- << property->getName() << Ivar->getName();
+ << property->getDeclName() << Ivar->getDeclName();
return 0;
}
}
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index fd726511fd6..f81c2b877ce 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -431,11 +431,11 @@ Sema::ExprResult Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc,
if (MD->isStatic())
// "invalid use of member 'x' in static member function"
return Diag(Loc, diag::err_invalid_member_use_in_static_method)
- << FD->getName();
+ << FD->getDeclName();
if (cast<CXXRecordDecl>(MD->getParent()) != FD->getParent())
// "invalid use of nonstatic data member 'x'"
return Diag(Loc, diag::err_invalid_non_static_member_use)
- << FD->getName();
+ << FD->getDeclName();
if (FD->isInvalidDecl())
return true;
@@ -445,14 +445,15 @@ Sema::ExprResult Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc,
FD->getType().getWithAdditionalQualifiers(MD->getTypeQualifiers()),Loc);
}
- return Diag(Loc, diag::err_invalid_non_static_member_use) << FD->getName();
+ return Diag(Loc, diag::err_invalid_non_static_member_use)
+ << FD->getDeclName();
}
if (isa<TypedefDecl>(D))
- return Diag(Loc, diag::err_unexpected_typedef) << Name.getAsString();
+ return Diag(Loc, diag::err_unexpected_typedef) << Name;
if (isa<ObjCInterfaceDecl>(D))
- return Diag(Loc, diag::err_unexpected_interface) << Name.getAsString();
+ return Diag(Loc, diag::err_unexpected_interface) << Name;
if (isa<NamespaceDecl>(D))
- return Diag(Loc, diag::err_unexpected_namespace) << Name.getAsString();
+ return Diag(Loc, diag::err_unexpected_namespace) << Name;
// Make the DeclRefExpr or BlockDeclRefExpr for the decl.
if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D))
@@ -462,7 +463,7 @@ Sema::ExprResult Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc,
// check if referencing an identifier with __attribute__((deprecated)).
if (VD->getAttr<DeprecatedAttr>())
- Diag(Loc, diag::warn_deprecated) << VD->getName();
+ Diag(Loc, diag::warn_deprecated) << VD->getDeclName();
// Only create DeclRefExpr's for valid Decl's.
if (VD->isInvalidDecl())
@@ -1135,7 +1136,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
RecordDecl *RDecl = RTy->getDecl();
if (RTy->isIncompleteType())
return Diag(OpLoc, diag::err_typecheck_incomplete_tag)
- << RDecl->getName() << BaseExpr->getSourceRange();
+ << RDecl->getDeclName() << BaseExpr->getSourceRange();
// The record definition is complete, now make sure the member is valid.
FieldDecl *MemberDecl = RDecl->getMember(&Member);
if (!MemberDecl)
@@ -1164,7 +1165,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
return new ObjCIvarRefExpr(IV, IV->getType(), MemberLoc, BaseExpr,
OpKind == tok::arrow);
return Diag(MemberLoc, diag::err_typecheck_member_reference_ivar)
- << IFTy->getDecl()->getName() << &Member
+ << IFTy->getDecl()->getDeclName() << &Member
<< BaseExpr->getSourceRange();
}
@@ -1315,14 +1316,14 @@ ActOnCallExpr(ExprTy *fn, SourceLocation LParenLoc,
case OR_No_Viable_Function:
Diag(Fn->getSourceRange().getBegin(),
diag::err_ovl_no_viable_function_in_call)
- << Ovl->getName() << (unsigned)CandidateSet.size()
+ << Ovl->getDeclName() << (unsigned)CandidateSet.size()
<< Fn->getSourceRange();
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
return true;
case OR_Ambiguous:
Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_ambiguous_call)
- << Ovl->getName() << Fn->getSourceRange();
+ << Ovl->getDeclName() << Fn->getSourceRange();
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
return true;
}
@@ -1451,12 +1452,12 @@ ActOnCompoundLiteral(SourceLocation LParenLoc, TypeTy *Ty,
<< SourceRange(LParenLoc, literalExpr->getSourceRange().getEnd());
} else if (literalType->isIncompleteType()) {
return Diag(LParenLoc, diag::err_typecheck_decl_incomplete_type)
- << literalType.getAsString()
+ << literalType
<< SourceRange(LParenLoc, literalExpr->getSourceRange().getEnd());
}
if (CheckInitializerTypes(literalExpr, literalType, LParenLoc,
- "temporary"))
+ DeclarationName()))
return true;
bool isFileScope = !getCurFunctionDecl() && !getCurMethodDecl();
@@ -2399,8 +2400,7 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
} else {
if ((lType->isObjCQualifiedIdType() && rType->isObjCQualifiedIdType())) {
Diag(Loc, diag::warn_incompatible_qualified_id_operands)
- << lType.getAsString() << rType.getAsString()
- << lex->getSourceRange() << rex->getSourceRange();
+ << lType << rType << lex->getSourceRange() << rex->getSourceRange();
ImpCastExprToType(rex, lType);
return ResultTy;
}
@@ -3696,7 +3696,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
break;
}
- Diag(Loc, DiagKind) << DstType.getAsString() << SrcType.getAsString()
- << Flavor << SrcExpr->getSourceRange();
+ Diag(Loc, DiagKind) << DstType << SrcType << Flavor
+ << SrcExpr->getSourceRange();
return isInvalid;
}
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 80b5f200340..f5f05f243cf 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -189,9 +189,8 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
QualType CheckType = AllocType;
// To leverage the existing parser as much as possible, array types are
// parsed as VLAs. Unwrap for checking.
- if (const VariableArrayType *VLA = Context.getAsVariableArrayType(AllocType)){
+ if (const VariableArrayType *VLA = Context.getAsVariableArrayType(AllocType))
CheckType = VLA->getElementType();
- }
// Validate the type, and unwrap an array if any.
if (CheckAllocatedType(CheckType, StartLoc, SourceRange(TyStart, TyEnd)))
@@ -240,13 +239,13 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
// 2) Otherwise, the object is direct-initialized.
CXXConstructorDecl *Constructor = 0;
Expr **ConsArgs = (Expr**)ConstructorArgs;
- if (CheckType->isRecordType()) {
+ if (const RecordType *RT = CheckType->getAsRecordType()) {
// FIXME: This is incorrect for when there is an empty initializer and
// no user-defined constructor. Must zero-initialize, not default-construct.
Constructor = PerformInitializationByConstructor(
CheckType, ConsArgs, NumConsArgs,
TyStart, SourceRange(TyStart, ConstructorRParen),
- CheckType.getAsString(),
+ RT->getDecl()->getDeclName(),
NumConsArgs != 0 ? IK_Direct : IK_Default);
if (!Constructor)
return true;
@@ -262,8 +261,9 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
// Object is value-initialized. Do nothing.
} else if (NumConsArgs == 1) {
// Object is direct-initialized.
+ // FIXME: WHAT DeclarationName do we pass in here?
if (CheckInitializerTypes(ConsArgs[0], CheckType, StartLoc,
- CheckType.getAsString()))
+ DeclarationName() /*CheckType.getAsString()*/))
return true;
} else {
Diag(StartLoc, diag::err_builtin_direct_init_more_than_one_arg)
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 2225d6758f7..094f3ec4609 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -193,7 +193,7 @@ Sema::ExprResult Sema::ActOnClassMessage(
ClassDecl = getCurMethodDecl()->getClassInterface()->getSuperClass();
if (!ClassDecl)
return Diag(lbrac, diag::error_no_super_class)
- << getCurMethodDecl()->getClassInterface()->getName();
+ << getCurMethodDecl()->getClassInterface()->getDeclName();
if (getCurMethodDecl()->isInstance()) {
QualType superTy = Context.getObjCInterfaceType(ClassDecl);
superTy = Context.getPointerType(superTy);
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 3c2c0ab489f..976b4f78a9d 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -210,7 +210,7 @@ void UserDefinedConversionSequence::DebugPrint() const {
Before.DebugPrint();
fprintf(stderr, " -> ");
}
- fprintf(stderr, "'%s'", ConversionFunction->getName().c_str());
+ fprintf(stderr, "'%s'", ConversionFunction->getNameAsString().c_str());
if (After.First || After.Second || After.Third) {
fprintf(stderr, " -> ");
After.DebugPrint();
@@ -1401,17 +1401,17 @@ bool Sema::PerformCopyInitialization(Expr *&From, QualType ToType,
return DiagnoseAssignmentResult(ConvTy, From->getLocStart(), ToType,
FromType, From, Flavor);
- } else if (ToType->isReferenceType()) {
- return CheckReferenceInit(From, ToType);
- } else {
- if (PerformImplicitConversion(From, ToType))
- return Diag(From->getSourceRange().getBegin(),
- diag::err_typecheck_convert_incompatible)
- << ToType.getAsString() << From->getType().getAsString()
- << Flavor << From->getSourceRange();
- else
- return false;
}
+
+ if (ToType->isReferenceType())
+ return CheckReferenceInit(From, ToType);
+
+ if (!PerformImplicitConversion(From, ToType))
+ return false;
+
+ return Diag(From->getSourceRange().getBegin(),
+ diag::err_typecheck_convert_incompatible)
+ << ToType << From->getType() << Flavor << From->getSourceRange();
}
/// TryObjectArgumentInitialization - Try to initialize the object
OpenPOWER on IntegriCloud