forked from OSchip/llvm-project
Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName(). This upgrades a bunch of diags to take DeclNames instead of std::strings. This also tweaks a couple of diagnostics to be cleaner and changes CheckInitializerTypes/PerformInitializationByConstructor to pass around DeclarationNames instead of std::strings. llvm-svn: 59947
This commit is contained in:
parent
a7c5eb72a0
commit
f3d3faeca6
clang
Driver
include/clang
lib
Analysis
BugReporter.cppCheckDeadStores.cppCheckNSError.cppCheckObjCDealloc.cppCheckObjCInstMethSignature.cppCheckObjCUnusedIVars.cppMemRegion.cpp
CodeGen
Sema
test/SemaObjC
|
@ -83,7 +83,7 @@ void DeclPrinter:: PrintDecl(Decl *D) {
|
|||
for (unsigned i = 0, e = OFPD->getNumForwardDecls(); i != e; ++i) {
|
||||
const ObjCProtocolDecl *D = OFPD->getForwardProtocolDecl(i);
|
||||
if (i) Out << ", ";
|
||||
Out << D->getName();
|
||||
Out << D->getNameAsString();
|
||||
}
|
||||
Out << ";\n";
|
||||
} else if (ObjCImplementationDecl *OID =
|
||||
|
@ -104,13 +104,13 @@ void DeclPrinter:: PrintDecl(Decl *D) {
|
|||
for (unsigned i = 0, e = OFCD->getNumForwardDecls(); i != e; ++i) {
|
||||
const ObjCInterfaceDecl *D = ForwardDecls[i];
|
||||
if (i) Out << ", ";
|
||||
Out << D->getName();
|
||||
Out << D->getNameAsString();
|
||||
}
|
||||
Out << ";\n";
|
||||
} else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
|
||||
Out << "Read top-level tag decl: '" << TD->getName() << "'\n";
|
||||
Out << "Read top-level tag decl: '" << TD->getNameAsString() << "'\n";
|
||||
} else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) {
|
||||
Out << "Read top-level variable decl: '" << SD->getName() << "'\n";
|
||||
Out << "Read top-level variable decl: '" << SD->getNameAsString() << "'\n";
|
||||
} else if (LinkageSpecDecl *LSD = dyn_cast<LinkageSpecDecl>(D)) {
|
||||
PrintLinkageSpec(LSD);
|
||||
} else if (FileScopeAsmDecl *AD = dyn_cast<FileScopeAsmDecl>(D)) {
|
||||
|
@ -138,7 +138,7 @@ void DeclPrinter::PrintFunctionDeclStart(FunctionDecl *FD) {
|
|||
if (FD->isInline())
|
||||
Out << "inline ";
|
||||
|
||||
std::string Proto = FD->getName();
|
||||
std::string Proto = FD->getNameAsString();
|
||||
const FunctionType *AFT = FD->getType()->getAsFunctionType();
|
||||
|
||||
if (const FunctionTypeProto *FT = dyn_cast<FunctionTypeProto>(AFT)) {
|
||||
|
@ -146,7 +146,7 @@ void DeclPrinter::PrintFunctionDeclStart(FunctionDecl *FD) {
|
|||
for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) {
|
||||
if (i) Proto += ", ";
|
||||
std::string ParamStr;
|
||||
if (HasBody) ParamStr = FD->getParamDecl(i)->getName();
|
||||
if (HasBody) ParamStr = FD->getParamDecl(i)->getNameAsString();
|
||||
|
||||
FT->getArgType(i).getAsStringInternal(ParamStr);
|
||||
Proto += ParamStr;
|
||||
|
@ -171,7 +171,7 @@ void DeclPrinter::PrintFunctionDeclStart(FunctionDecl *FD) {
|
|||
}
|
||||
|
||||
void DeclPrinter::PrintTypeDefDecl(TypedefDecl *TD) {
|
||||
std::string S = TD->getName();
|
||||
std::string S = TD->getNameAsString();
|
||||
TD->getUnderlyingType().getAsStringInternal(S);
|
||||
Out << "typedef " << S << ";\n";
|
||||
}
|
||||
|
@ -205,7 +205,8 @@ void DeclPrinter::PrintObjCMethodDecl(ObjCMethodDecl *OMD) {
|
|||
// FIXME: selector is missing here!
|
||||
pos = name.find_first_of(":", lastPos);
|
||||
Out << " " << name.substr(lastPos, pos - lastPos);
|
||||
Out << ":(" << PDecl->getType().getAsString() << ")" << PDecl->getName();
|
||||
Out << ":(" << PDecl->getType().getAsString() << ")"
|
||||
<< PDecl->getNameAsString();
|
||||
lastPos = pos + 1;
|
||||
}
|
||||
|
||||
|
@ -219,11 +220,11 @@ void DeclPrinter::PrintObjCMethodDecl(ObjCMethodDecl *OMD) {
|
|||
}
|
||||
|
||||
void DeclPrinter::PrintObjCImplementationDecl(ObjCImplementationDecl *OID) {
|
||||
std::string I = OID->getName();
|
||||
std::string I = OID->getNameAsString();
|
||||
ObjCInterfaceDecl *SID = OID->getSuperClass();
|
||||
|
||||
if (SID)
|
||||
Out << "@implementation " << I << " : " << SID->getName();
|
||||
Out << "@implementation " << I << " : " << SID->getNameAsString();
|
||||
else
|
||||
Out << "@implementation " << I;
|
||||
|
||||
|
@ -258,11 +259,11 @@ void DeclPrinter::PrintObjCImplementationDecl(ObjCImplementationDecl *OID) {
|
|||
|
||||
|
||||
void DeclPrinter::PrintObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
|
||||
std::string I = OID->getName();
|
||||
std::string I = OID->getNameAsString();
|
||||
ObjCInterfaceDecl *SID = OID->getSuperClass();
|
||||
|
||||
if (SID)
|
||||
Out << "@interface " << I << " : " << SID->getName();
|
||||
Out << "@interface " << I << " : " << SID->getNameAsString();
|
||||
else
|
||||
Out << "@interface " << I;
|
||||
|
||||
|
@ -271,7 +272,7 @@ void DeclPrinter::PrintObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
|
|||
if (!Protocols.empty()) {
|
||||
for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
|
||||
E = Protocols.end(); I != E; ++I)
|
||||
Out << (I == Protocols.begin() ? '<' : ',') << (*I)->getName();
|
||||
Out << (I == Protocols.begin() ? '<' : ',') << (*I)->getNameAsString();
|
||||
}
|
||||
|
||||
if (!Protocols.empty())
|
||||
|
@ -283,7 +284,7 @@ void DeclPrinter::PrintObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
|
|||
for (ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin(),
|
||||
E = OID->ivar_end(); I != E; ++I) {
|
||||
Out << '\t' << (*I)->getType().getAsString()
|
||||
<< ' ' << (*I)->getName() << ";\n";
|
||||
<< ' ' << (*I)->getNameAsString() << ";\n";
|
||||
}
|
||||
Out << "}\n";
|
||||
}
|
||||
|
@ -305,7 +306,7 @@ void DeclPrinter::PrintObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
|
|||
}
|
||||
|
||||
void DeclPrinter::PrintObjCProtocolDecl(ObjCProtocolDecl *PID) {
|
||||
Out << "@protocol " << PID->getName() << '\n';
|
||||
Out << "@protocol " << PID->getNameAsString() << '\n';
|
||||
|
||||
for (ObjCProtocolDecl::classprop_iterator I = PID->classprop_begin(),
|
||||
E = PID->classprop_end(); I != E; ++I)
|
||||
|
@ -316,8 +317,8 @@ void DeclPrinter::PrintObjCProtocolDecl(ObjCProtocolDecl *PID) {
|
|||
|
||||
void DeclPrinter::PrintObjCCategoryImplDecl(ObjCCategoryImplDecl *PID) {
|
||||
Out << "@implementation "
|
||||
<< PID->getClassInterface()->getName()
|
||||
<< '(' << PID->getName() << ");\n";
|
||||
<< PID->getClassInterface()->getNameAsString()
|
||||
<< '(' << PID->getNameAsString() << ");\n";
|
||||
for (ObjCCategoryImplDecl::propimpl_iterator I = PID->propimpl_begin(),
|
||||
E = PID->propimpl_end(); I != E; ++I)
|
||||
PrintObjCPropertyImplDecl(*I);
|
||||
|
@ -327,8 +328,8 @@ void DeclPrinter::PrintObjCCategoryImplDecl(ObjCCategoryImplDecl *PID) {
|
|||
|
||||
void DeclPrinter::PrintObjCCategoryDecl(ObjCCategoryDecl *PID) {
|
||||
Out << "@interface "
|
||||
<< PID->getClassInterface()->getName()
|
||||
<< '(' << PID->getName() << ");\n";
|
||||
<< PID->getClassInterface()->getNameAsString()
|
||||
<< '(' << PID->getNameAsString() << ");\n";
|
||||
// Output property declarations.
|
||||
for (ObjCCategoryDecl::classprop_iterator I = PID->classprop_begin(),
|
||||
E = PID->classprop_end(); I != E; ++I)
|
||||
|
@ -339,8 +340,8 @@ void DeclPrinter::PrintObjCCategoryDecl(ObjCCategoryDecl *PID) {
|
|||
}
|
||||
|
||||
void DeclPrinter::PrintObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *AID) {
|
||||
Out << "@compatibility_alias " << AID->getName()
|
||||
<< ' ' << AID->getClassInterface()->getName() << ";\n";
|
||||
Out << "@compatibility_alias " << AID->getNameAsString()
|
||||
<< ' ' << AID->getClassInterface()->getNameAsString() << ";\n";
|
||||
}
|
||||
|
||||
/// PrintObjCPropertyDecl - print a property declaration.
|
||||
|
@ -401,7 +402,7 @@ void DeclPrinter::PrintObjCPropertyDecl(ObjCPropertyDecl *PDecl) {
|
|||
Out << " )";
|
||||
}
|
||||
Out << ' ' << PDecl->getType().getAsString()
|
||||
<< ' ' << PDecl->getName();
|
||||
<< ' ' << PDecl->getNameAsString();
|
||||
|
||||
Out << ";\n";
|
||||
}
|
||||
|
@ -414,9 +415,9 @@ void DeclPrinter::PrintObjCPropertyImplDecl(ObjCPropertyImplDecl *PID) {
|
|||
Out << "\n@synthesize ";
|
||||
else
|
||||
Out << "\n@dynamic ";
|
||||
Out << PID->getPropertyDecl()->getName();
|
||||
Out << PID->getPropertyDecl()->getNameAsString();
|
||||
if (PID->getPropertyIvarDecl())
|
||||
Out << "=" << PID->getPropertyIvarDecl()->getName();
|
||||
Out << "=" << PID->getPropertyIvarDecl()->getNameAsString();
|
||||
Out << ";\n";
|
||||
}
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -463,13 +464,14 @@ namespace {
|
|||
} else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
|
||||
PrintTypeDefDecl(TD);
|
||||
} else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) {
|
||||
Out << "Read top-level variable decl: '" << SD->getName() << "'\n";
|
||||
Out << "Read top-level variable decl: '" << SD->getNameAsString()
|
||||
<< "'\n";
|
||||
} else if (ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(D)) {
|
||||
Out << "Read objc interface '" << OID->getName() << "'\n";
|
||||
Out << "Read objc interface '" << OID->getNameAsString() << "'\n";
|
||||
} else if (ObjCProtocolDecl *OPD = dyn_cast<ObjCProtocolDecl>(D)) {
|
||||
Out << "Read objc protocol '" << OPD->getName() << "'\n";
|
||||
Out << "Read objc protocol '" << OPD->getNameAsString() << "'\n";
|
||||
} else if (ObjCCategoryDecl *OCD = dyn_cast<ObjCCategoryDecl>(D)) {
|
||||
Out << "Read objc category '" << OCD->getName() << "'\n";
|
||||
Out << "Read objc category '" << OCD->getNameAsString() << "'\n";
|
||||
} else if (isa<ObjCForwardProtocolDecl>(D)) {
|
||||
Out << "Read objc fwd protocol decl\n";
|
||||
} else if (isa<ObjCClassDecl>(D)) {
|
||||
|
@ -550,7 +552,7 @@ public:
|
|||
CXXRecordDecl* D = T->getDecl();
|
||||
// FIXME: This lookup needs to be generalized to handle namespaces and
|
||||
// (when we support them) templates.
|
||||
if (D->getName() == clsname) {
|
||||
if (D->getNameAsString() == clsname) {
|
||||
D->viewInheritance(C);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -384,7 +384,7 @@ std::string RewriteBlocks::SynthesizeBlockFunc(BlockExpr *CE, int i,
|
|||
for (BlockDecl::param_iterator AI = BD->param_begin(),
|
||||
E = BD->param_end(); AI != E; ++AI) {
|
||||
if (AI != BD->param_begin()) S += ", ";
|
||||
ParamStr = (*AI)->getName();
|
||||
ParamStr = (*AI)->getNameAsString();
|
||||
(*AI)->getType().getAsStringInternal(ParamStr);
|
||||
S += ParamStr;
|
||||
}
|
||||
|
@ -401,15 +401,15 @@ std::string RewriteBlocks::SynthesizeBlockFunc(BlockExpr *CE, int i,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
|
||||
E = BlockByRefDecls.end(); I != E; ++I) {
|
||||
S += " ";
|
||||
std::string Name = (*I)->getName();
|
||||
std::string Name = (*I)->getNameAsString();
|
||||
Context->getPointerType((*I)->getType()).getAsStringInternal(Name);
|
||||
S += Name + " = __cself->" + (*I)->getName() + "; // bound by ref\n";
|
||||
S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n";
|
||||
}
|
||||
// Next, emit a declaration for all "by copy" declarations.
|
||||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
|
||||
E = BlockByCopyDecls.end(); I != E; ++I) {
|
||||
S += " ";
|
||||
std::string Name = (*I)->getName();
|
||||
std::string Name = (*I)->getNameAsString();
|
||||
// Handle nested closure invocation. For example:
|
||||
//
|
||||
// void (^myImportedClosure)(void);
|
||||
|
@ -424,7 +424,7 @@ std::string RewriteBlocks::SynthesizeBlockFunc(BlockExpr *CE, int i,
|
|||
S += "struct __block_impl *";
|
||||
else
|
||||
(*I)->getType().getAsStringInternal(Name);
|
||||
S += Name + " = __cself->" + (*I)->getName() + "; // bound by copy\n";
|
||||
S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by copy\n";
|
||||
}
|
||||
std::string RewrittenStr = RewrittenBlockExprs[CE];
|
||||
const char *cstr = RewrittenStr.c_str();
|
||||
|
@ -448,9 +448,9 @@ std::string RewriteBlocks::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
|
||||
E = ImportedBlockDecls.end(); I != E; ++I) {
|
||||
S += "_Block_copy_assign(&dst->";
|
||||
S += (*I)->getName();
|
||||
S += (*I)->getNameAsString();
|
||||
S += ", src->";
|
||||
S += (*I)->getName();
|
||||
S += (*I)->getNameAsString();
|
||||
S += ");}";
|
||||
}
|
||||
S += "\nstatic void __";
|
||||
|
@ -461,7 +461,7 @@ std::string RewriteBlocks::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
|
||||
E = ImportedBlockDecls.end(); I != E; ++I) {
|
||||
S += "_Block_destroy(src->";
|
||||
S += (*I)->getName();
|
||||
S += (*I)->getNameAsString();
|
||||
S += ");";
|
||||
}
|
||||
S += "}\n";
|
||||
|
@ -488,7 +488,7 @@ std::string RewriteBlocks::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
|
||||
E = BlockByCopyDecls.end(); I != E; ++I) {
|
||||
S += " ";
|
||||
std::string FieldName = (*I)->getName();
|
||||
std::string FieldName = (*I)->getNameAsString();
|
||||
std::string ArgName = "_" + FieldName;
|
||||
// Handle nested closure invocation. For example:
|
||||
//
|
||||
|
@ -514,7 +514,7 @@ std::string RewriteBlocks::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
|
||||
E = BlockByRefDecls.end(); I != E; ++I) {
|
||||
S += " ";
|
||||
std::string FieldName = (*I)->getName();
|
||||
std::string FieldName = (*I)->getNameAsString();
|
||||
std::string ArgName = "_" + FieldName;
|
||||
// Handle nested closure invocation. For example:
|
||||
//
|
||||
|
@ -548,7 +548,7 @@ std::string RewriteBlocks::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
|
|||
// Initialize all "by copy" arguments.
|
||||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
|
||||
E = BlockByCopyDecls.end(); I != E; ++I) {
|
||||
std::string Name = (*I)->getName();
|
||||
std::string Name = (*I)->getNameAsString();
|
||||
Constructor += " ";
|
||||
if (isBlockPointerType((*I)->getType()))
|
||||
Constructor += Name + " = (struct __block_impl *)_";
|
||||
|
@ -559,7 +559,7 @@ std::string RewriteBlocks::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
|
|||
// Initialize all "by ref" arguments.
|
||||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
|
||||
E = BlockByRefDecls.end(); I != E; ++I) {
|
||||
std::string Name = (*I)->getName();
|
||||
std::string Name = (*I)->getNameAsString();
|
||||
Constructor += " ";
|
||||
if (isBlockPointerType((*I)->getType()))
|
||||
Constructor += Name + " = (struct __block_impl *)_";
|
||||
|
@ -918,7 +918,7 @@ std::string RewriteBlocks::SynthesizeBlockInitExpr(BlockExpr *Exp, VarDecl *VD)
|
|||
std::string FuncName;
|
||||
|
||||
if (CurFunctionDef)
|
||||
FuncName = std::string(CurFunctionDef->getName());
|
||||
FuncName = std::string(CurFunctionDef->getNameAsString());
|
||||
else if (CurMethodDef) {
|
||||
FuncName = CurMethodDef->getSelector().getAsString();
|
||||
// Convert colons to underscores.
|
||||
|
@ -926,7 +926,7 @@ std::string RewriteBlocks::SynthesizeBlockInitExpr(BlockExpr *Exp, VarDecl *VD)
|
|||
while ((loc = FuncName.find(":", loc)) != std::string::npos)
|
||||
FuncName.replace(loc, 1, "_");
|
||||
} else if (VD)
|
||||
FuncName = std::string(VD->getName());
|
||||
FuncName = std::string(VD->getNameAsString());
|
||||
|
||||
std::string BlockNumber = utostr(Blocks.size()-1);
|
||||
|
||||
|
@ -961,20 +961,20 @@ std::string RewriteBlocks::SynthesizeBlockInitExpr(BlockExpr *Exp, VarDecl *VD)
|
|||
Init += ",";
|
||||
if (isObjCType((*I)->getType())) {
|
||||
Init += "[[";
|
||||
Init += (*I)->getName();
|
||||
Init += (*I)->getNameAsString();
|
||||
Init += " retain] autorelease]";
|
||||
} else if (isBlockPointerType((*I)->getType())) {
|
||||
Init += "(void *)";
|
||||
Init += (*I)->getName();
|
||||
Init += (*I)->getNameAsString();
|
||||
} else {
|
||||
Init += (*I)->getName();
|
||||
Init += (*I)->getNameAsString();
|
||||
}
|
||||
}
|
||||
// Output all "by ref" declarations.
|
||||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
|
||||
E = BlockByRefDecls.end(); I != E; ++I) {
|
||||
Init += ",&";
|
||||
Init += (*I)->getName();
|
||||
Init += (*I)->getNameAsString();
|
||||
}
|
||||
}
|
||||
Init += ")";
|
||||
|
|
|
@ -605,13 +605,13 @@ void RewriteObjC::RewriteForwardClassDecl(ObjCClassDecl *ClassDecl) {
|
|||
for (int i = 0; i < numDecls; i++) {
|
||||
ObjCInterfaceDecl *ForwardDecl = ForwardDecls[i];
|
||||
typedefString += "#ifndef _REWRITER_typedef_";
|
||||
typedefString += ForwardDecl->getName();
|
||||
typedefString += ForwardDecl->getNameAsString();
|
||||
typedefString += "\n";
|
||||
typedefString += "#define _REWRITER_typedef_";
|
||||
typedefString += ForwardDecl->getName();
|
||||
typedefString += ForwardDecl->getNameAsString();
|
||||
typedefString += "\n";
|
||||
typedefString += "typedef struct objc_object ";
|
||||
typedefString += ForwardDecl->getName();
|
||||
typedefString += ForwardDecl->getNameAsString();
|
||||
typedefString += ";\n#endif\n";
|
||||
}
|
||||
|
||||
|
@ -739,13 +739,13 @@ void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD,
|
|||
else
|
||||
NameStr += "_C_";
|
||||
|
||||
NameStr += OMD->getClassInterface()->getName();
|
||||
NameStr += OMD->getClassInterface()->getNameAsString();
|
||||
NameStr += "_";
|
||||
|
||||
NamedDecl *MethodContext = OMD->getMethodContext();
|
||||
if (ObjCCategoryImplDecl *CID =
|
||||
dyn_cast<ObjCCategoryImplDecl>(MethodContext)) {
|
||||
NameStr += CID->getName();
|
||||
NameStr += CID->getNameAsString();
|
||||
NameStr += "_";
|
||||
}
|
||||
// Append selector names, replacing ':' with '_'
|
||||
|
@ -773,7 +773,7 @@ void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD,
|
|||
ResultStr += "struct ";
|
||||
}
|
||||
// When rewriting for Microsoft, explicitly omit the structure name.
|
||||
ResultStr += OMD->getClassInterface()->getName();
|
||||
ResultStr += OMD->getClassInterface()->getNameAsString();
|
||||
ResultStr += " *";
|
||||
}
|
||||
else
|
||||
|
@ -789,9 +789,9 @@ void RewriteObjC::RewriteObjCMethodDecl(ObjCMethodDecl *OMD,
|
|||
ResultStr += ", ";
|
||||
if (PDecl->getType()->isObjCQualifiedIdType()) {
|
||||
ResultStr += "id ";
|
||||
ResultStr += PDecl->getName();
|
||||
ResultStr += PDecl->getNameAsString();
|
||||
} else {
|
||||
std::string Name = PDecl->getName();
|
||||
std::string Name = PDecl->getNameAsString();
|
||||
if (isBlockPointerType(PDecl->getType())) {
|
||||
// Make sure we convert "t (^)(...)" to "t (*)(...)".
|
||||
const BlockPointerType *BPT = PDecl->getType()->getAsBlockPointerType();
|
||||
|
@ -875,13 +875,13 @@ void RewriteObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) {
|
|||
if (!ObjCForwardDecls.count(ClassDecl)) {
|
||||
// we haven't seen a forward decl - generate a typedef.
|
||||
ResultStr = "#ifndef _REWRITER_typedef_";
|
||||
ResultStr += ClassDecl->getName();
|
||||
ResultStr += ClassDecl->getNameAsString();
|
||||
ResultStr += "\n";
|
||||
ResultStr += "#define _REWRITER_typedef_";
|
||||
ResultStr += ClassDecl->getName();
|
||||
ResultStr += ClassDecl->getNameAsString();
|
||||
ResultStr += "\n";
|
||||
ResultStr += "typedef struct objc_object ";
|
||||
ResultStr += ClassDecl->getName();
|
||||
ResultStr += ClassDecl->getNameAsString();
|
||||
ResultStr += ";\n#endif\n";
|
||||
// Mark this typedef as having been generated.
|
||||
ObjCForwardDecls.insert(ClassDecl);
|
||||
|
@ -1355,7 +1355,7 @@ Stmt *RewriteObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) {
|
|||
cls = dyn_cast<ObjCInterfaceType>(pType->getPointeeType().getTypePtr());
|
||||
if (cls) {
|
||||
buf += "objc_exception_match((struct objc_class *)objc_getClass(\"";
|
||||
buf += cls->getDecl()->getName();
|
||||
buf += cls->getDecl()->getNameAsString();
|
||||
buf += "\"), (struct objc_object *)_caught)) { ";
|
||||
ReplaceText(startLoc, lParenLoc-startBuf+1, buf.c_str(), buf.size());
|
||||
}
|
||||
|
@ -2377,7 +2377,7 @@ void RewriteObjC::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl,
|
|||
// FIXME: This has potential of causing problem. If
|
||||
// SynthesizeObjCInternalStruct is ever called recursively.
|
||||
Result += "\nstruct ";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
if (LangOpts.Microsoft)
|
||||
Result += "_IMPL";
|
||||
|
||||
|
@ -2419,9 +2419,9 @@ void RewriteObjC::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl,
|
|||
}
|
||||
if (RCDecl && ObjCSynthesizedStructs.count(RCDecl)) {
|
||||
Result = "\n struct ";
|
||||
Result += RCDecl->getName();
|
||||
Result += RCDecl->getNameAsString();
|
||||
Result += "_IMPL ";
|
||||
Result += RCDecl->getName();
|
||||
Result += RCDecl->getNameAsString();
|
||||
Result += "_IVARS;\n";
|
||||
|
||||
// insert the super class structure definition.
|
||||
|
@ -2468,9 +2468,9 @@ void RewriteObjC::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl,
|
|||
} else { // we don't have any instance variables - insert super struct.
|
||||
endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
|
||||
Result += " {\n struct ";
|
||||
Result += RCDecl->getName();
|
||||
Result += RCDecl->getNameAsString();
|
||||
Result += "_IMPL ";
|
||||
Result += RCDecl->getName();
|
||||
Result += RCDecl->getNameAsString();
|
||||
Result += "_IVARS;\n};\n";
|
||||
ReplaceText(LocStart, endBuf-startBuf, Result.c_str(), Result.size());
|
||||
}
|
||||
|
@ -2593,7 +2593,7 @@ RewriteObjCProtocolsMetaData(const ObjCList<ObjCProtocolDecl> &Protocols,
|
|||
Result += "\tstruct protocol_methods protocols[";
|
||||
Result += utostr(NumMethods);
|
||||
Result += "];\n} _OBJC_PROTOCOL_INSTANCE_METHODS_";
|
||||
Result += PDecl->getName();
|
||||
Result += PDecl->getNameAsString();
|
||||
Result += " __attribute__ ((used, section (\"__OBJC, __cat_inst_meth\")))= "
|
||||
"{\n\t" + utostr(NumMethods) + "\n";
|
||||
|
||||
|
@ -2627,7 +2627,7 @@ RewriteObjCProtocolsMetaData(const ObjCList<ObjCProtocolDecl> &Protocols,
|
|||
Result += "\tstruct protocol_methods protocols[";
|
||||
Result += utostr(NumMethods);
|
||||
Result += "];\n} _OBJC_PROTOCOL_CLASS_METHODS_";
|
||||
Result += PDecl->getName();
|
||||
Result += PDecl->getNameAsString();
|
||||
Result += " __attribute__ ((used, section (\"__OBJC, __cat_cls_meth\")))= "
|
||||
"{\n\t";
|
||||
Result += utostr(NumMethods);
|
||||
|
@ -2674,21 +2674,21 @@ RewriteObjCProtocolsMetaData(const ObjCList<ObjCProtocolDecl> &Protocols,
|
|||
}
|
||||
|
||||
Result += "\nstatic struct _objc_protocol _OBJC_PROTOCOL_";
|
||||
Result += PDecl->getName();
|
||||
Result += PDecl->getNameAsString();
|
||||
Result += " __attribute__ ((used, section (\"__OBJC, __protocol\")))= "
|
||||
"{\n\t0, \"";
|
||||
Result += PDecl->getName();
|
||||
Result += PDecl->getNameAsString();
|
||||
Result += "\", 0, ";
|
||||
if (PDecl->instmeth_begin() != PDecl->instmeth_end()) {
|
||||
Result += "(struct _objc_protocol_method_list *)&_OBJC_PROTOCOL_INSTANCE_METHODS_";
|
||||
Result += PDecl->getName();
|
||||
Result += PDecl->getNameAsString();
|
||||
Result += ", ";
|
||||
}
|
||||
else
|
||||
Result += "0, ";
|
||||
if (PDecl->getNumClassMethods() > 0) {
|
||||
Result += "(struct _objc_protocol_method_list *)&_OBJC_PROTOCOL_CLASS_METHODS_";
|
||||
Result += PDecl->getName();
|
||||
Result += PDecl->getNameAsString();
|
||||
Result += "\n";
|
||||
}
|
||||
else
|
||||
|
@ -2721,12 +2721,12 @@ RewriteObjCProtocolsMetaData(const ObjCList<ObjCProtocolDecl> &Protocols,
|
|||
Result += "\n";
|
||||
|
||||
Result += "\t,{&_OBJC_PROTOCOL_";
|
||||
Result += Protocols[0]->getName();
|
||||
Result += Protocols[0]->getNameAsString();
|
||||
Result += " \n";
|
||||
|
||||
for (unsigned i = 1; i != Protocols.size(); i++) {
|
||||
Result += "\t ,&_OBJC_PROTOCOL_";
|
||||
Result += Protocols[i]->getName();
|
||||
Result += Protocols[i]->getNameAsString();
|
||||
Result += "\n";
|
||||
}
|
||||
Result += "\t }\n};\n";
|
||||
|
@ -2744,9 +2744,9 @@ void RewriteObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl,
|
|||
if (CDecl->getIdentifier() == IDecl->getIdentifier())
|
||||
break;
|
||||
|
||||
std::string FullCategoryName = ClassDecl->getName();
|
||||
std::string FullCategoryName = ClassDecl->getNameAsString();
|
||||
FullCategoryName += '_';
|
||||
FullCategoryName += IDecl->getName();
|
||||
FullCategoryName += IDecl->getNameAsString();
|
||||
|
||||
// Build _objc_method_list for class's instance methods if needed
|
||||
RewriteObjCMethodsMetaData(IDecl->instmeth_begin(), IDecl->instmeth_end(),
|
||||
|
@ -2793,9 +2793,9 @@ void RewriteObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl,
|
|||
Result += "\nstatic struct _objc_category _OBJC_CATEGORY_";
|
||||
Result += FullCategoryName;
|
||||
Result += " __attribute__ ((used, section (\"__OBJC, __category\")))= {\n\t\"";
|
||||
Result += IDecl->getName();
|
||||
Result += IDecl->getNameAsString();
|
||||
Result += "\"\n\t, \"";
|
||||
Result += ClassDecl->getName();
|
||||
Result += ClassDecl->getNameAsString();
|
||||
Result += "\"\n";
|
||||
|
||||
if (IDecl->getNumInstanceMethods() > 0) {
|
||||
|
@ -2836,11 +2836,11 @@ void RewriteObjC::SynthesizeIvarOffsetComputation(ObjCImplementationDecl *IDecl,
|
|||
Result += "0";
|
||||
} else {
|
||||
Result += "__OFFSETOFIVAR__(struct ";
|
||||
Result += IDecl->getName();
|
||||
Result += IDecl->getNameAsString();
|
||||
if (LangOpts.Microsoft)
|
||||
Result += "_IMPL";
|
||||
Result += ", ";
|
||||
Result += ivar->getName();
|
||||
Result += ivar->getNameAsString();
|
||||
Result += ")";
|
||||
}
|
||||
}
|
||||
|
@ -2892,7 +2892,7 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
|
|||
Result += "\tstruct _objc_ivar ivar_list[";
|
||||
Result += utostr(NumIvars);
|
||||
Result += "];\n} _OBJC_INSTANCE_VARIABLES_";
|
||||
Result += IDecl->getName();
|
||||
Result += IDecl->getNameAsString();
|
||||
Result += " __attribute__ ((used, section (\"__OBJC, __instance_vars\")))= "
|
||||
"{\n\t";
|
||||
Result += utostr(NumIvars);
|
||||
|
@ -2907,7 +2907,7 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
|
|||
IVE = CDecl->ivar_end();
|
||||
}
|
||||
Result += "\t,{{\"";
|
||||
Result += (*IVI)->getName();
|
||||
Result += (*IVI)->getNameAsString();
|
||||
Result += "\", \"";
|
||||
std::string StrEncoding;
|
||||
Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding);
|
||||
|
@ -2917,7 +2917,7 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
|
|||
Result += "}\n";
|
||||
for (++IVI; IVI != IVE; ++IVI) {
|
||||
Result += "\t ,{\"";
|
||||
Result += (*IVI)->getName();
|
||||
Result += (*IVI)->getNameAsString();
|
||||
Result += "\", \"";
|
||||
std::string StrEncoding;
|
||||
Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding);
|
||||
|
@ -2988,22 +2988,22 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
|
|||
SuperClass = CDecl->getSuperClass();
|
||||
|
||||
Result += "\nstatic struct _objc_class _OBJC_METACLASS_";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += " __attribute__ ((used, section (\"__OBJC, __meta_class\")))= "
|
||||
"{\n\t(struct _objc_class *)\"";
|
||||
Result += (RootClass ? RootClass->getName() : CDecl->getName());
|
||||
Result += (RootClass ? RootClass->getNameAsString() : CDecl->getNameAsString());
|
||||
Result += "\"";
|
||||
|
||||
if (SuperClass) {
|
||||
Result += ", \"";
|
||||
Result += SuperClass->getName();
|
||||
Result += SuperClass->getNameAsString();
|
||||
Result += "\", \"";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += "\"";
|
||||
}
|
||||
else {
|
||||
Result += ", 0, \"";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += "\"";
|
||||
}
|
||||
// Set 'ivars' field for root class to 0. ObjC1 runtime does not use it.
|
||||
|
@ -3011,14 +3011,14 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
|
|||
Result += ", 0,2, sizeof(struct _objc_class), 0";
|
||||
if (IDecl->getNumClassMethods() > 0) {
|
||||
Result += "\n\t, (struct _objc_method_list *)&_OBJC_CLASS_METHODS_";
|
||||
Result += IDecl->getName();
|
||||
Result += IDecl->getNameAsString();
|
||||
Result += "\n";
|
||||
}
|
||||
else
|
||||
Result += ", 0\n";
|
||||
if (!CDecl->getReferencedProtocols().empty()) {
|
||||
Result += "\t,0, (struct _objc_protocol_list *)&_OBJC_CLASS_PROTOCOLS_";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += ",0,0\n";
|
||||
}
|
||||
else
|
||||
|
@ -3027,20 +3027,20 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
|
|||
|
||||
// class metadata generation.
|
||||
Result += "\nstatic struct _objc_class _OBJC_CLASS_";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += " __attribute__ ((used, section (\"__OBJC, __class\")))= "
|
||||
"{\n\t&_OBJC_METACLASS_";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
if (SuperClass) {
|
||||
Result += ", \"";
|
||||
Result += SuperClass->getName();
|
||||
Result += SuperClass->getNameAsString();
|
||||
Result += "\", \"";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += "\"";
|
||||
}
|
||||
else {
|
||||
Result += ", 0, \"";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += "\"";
|
||||
}
|
||||
// 'info' field is initialized to CLS_CLASS(1) for class
|
||||
|
@ -3050,28 +3050,28 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
|
|||
else {
|
||||
// class has size. Must synthesize its size.
|
||||
Result += ",sizeof(struct ";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
if (LangOpts.Microsoft)
|
||||
Result += "_IMPL";
|
||||
Result += ")";
|
||||
}
|
||||
if (NumIvars > 0) {
|
||||
Result += ", (struct _objc_ivar_list *)&_OBJC_INSTANCE_VARIABLES_";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += "\n\t";
|
||||
}
|
||||
else
|
||||
Result += ",0";
|
||||
if (IDecl->getNumInstanceMethods() > 0) {
|
||||
Result += ", (struct _objc_method_list *)&_OBJC_INSTANCE_METHODS_";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += ", 0\n\t";
|
||||
}
|
||||
else
|
||||
Result += ",0,0";
|
||||
if (!CDecl->getReferencedProtocols().empty()) {
|
||||
Result += ", (struct _objc_protocol_list*)&_OBJC_CLASS_PROTOCOLS_";
|
||||
Result += CDecl->getName();
|
||||
Result += CDecl->getNameAsString();
|
||||
Result += ", 0,0\n";
|
||||
}
|
||||
else
|
||||
|
@ -3134,15 +3134,15 @@ void RewriteObjC::SynthesizeMetaDataIntoBuffer(std::string &Result) {
|
|||
+ ", " + utostr(CatDefCount) + "\n";
|
||||
for (int i = 0; i < ClsDefCount; i++) {
|
||||
Result += "\t,&_OBJC_CLASS_";
|
||||
Result += ClassImplementation[i]->getName();
|
||||
Result += ClassImplementation[i]->getNameAsString();
|
||||
Result += "\n";
|
||||
}
|
||||
|
||||
for (int i = 0; i < CatDefCount; i++) {
|
||||
Result += "\t,&_OBJC_CATEGORY_";
|
||||
Result += CategoryImplementation[i]->getClassInterface()->getName();
|
||||
Result += CategoryImplementation[i]->getClassInterface()->getNameAsString();
|
||||
Result += "_";
|
||||
Result += CategoryImplementation[i]->getName();
|
||||
Result += CategoryImplementation[i]->getNameAsString();
|
||||
Result += "\n";
|
||||
}
|
||||
|
||||
|
@ -3205,7 +3205,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
|
|||
for (BlockDecl::param_iterator AI = BD->param_begin(),
|
||||
E = BD->param_end(); AI != E; ++AI) {
|
||||
if (AI != BD->param_begin()) S += ", ";
|
||||
ParamStr = (*AI)->getName();
|
||||
ParamStr = (*AI)->getNameAsString();
|
||||
(*AI)->getType().getAsStringInternal(ParamStr);
|
||||
S += ParamStr;
|
||||
}
|
||||
|
@ -3222,15 +3222,15 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
|
||||
E = BlockByRefDecls.end(); I != E; ++I) {
|
||||
S += " ";
|
||||
std::string Name = (*I)->getName();
|
||||
std::string Name = (*I)->getNameAsString();
|
||||
Context->getPointerType((*I)->getType()).getAsStringInternal(Name);
|
||||
S += Name + " = __cself->" + (*I)->getName() + "; // bound by ref\n";
|
||||
S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n";
|
||||
}
|
||||
// Next, emit a declaration for all "by copy" declarations.
|
||||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
|
||||
E = BlockByCopyDecls.end(); I != E; ++I) {
|
||||
S += " ";
|
||||
std::string Name = (*I)->getName();
|
||||
std::string Name = (*I)->getNameAsString();
|
||||
// Handle nested closure invocation. For example:
|
||||
//
|
||||
// void (^myImportedClosure)(void);
|
||||
|
@ -3245,7 +3245,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
|
|||
S += "struct __block_impl *";
|
||||
else
|
||||
(*I)->getType().getAsStringInternal(Name);
|
||||
S += Name + " = __cself->" + (*I)->getName() + "; // bound by copy\n";
|
||||
S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by copy\n";
|
||||
}
|
||||
std::string RewrittenStr = RewrittenBlockExprs[CE];
|
||||
const char *cstr = RewrittenStr.c_str();
|
||||
|
@ -3269,9 +3269,9 @@ std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
|
||||
E = ImportedBlockDecls.end(); I != E; ++I) {
|
||||
S += "_Block_copy_assign(&dst->";
|
||||
S += (*I)->getName();
|
||||
S += (*I)->getNameAsString();
|
||||
S += ", src->";
|
||||
S += (*I)->getName();
|
||||
S += (*I)->getNameAsString();
|
||||
S += ");}";
|
||||
}
|
||||
S += "\nstatic void __";
|
||||
|
@ -3282,7 +3282,7 @@ std::string RewriteObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
|
||||
E = ImportedBlockDecls.end(); I != E; ++I) {
|
||||
S += "_Block_destroy(src->";
|
||||
S += (*I)->getName();
|
||||
S += (*I)->getNameAsString();
|
||||
S += ");";
|
||||
}
|
||||
S += "}\n";
|
||||
|
@ -3309,7 +3309,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
|
||||
E = BlockByCopyDecls.end(); I != E; ++I) {
|
||||
S += " ";
|
||||
std::string FieldName = (*I)->getName();
|
||||
std::string FieldName = (*I)->getNameAsString();
|
||||
std::string ArgName = "_" + FieldName;
|
||||
// Handle nested closure invocation. For example:
|
||||
//
|
||||
|
@ -3335,7 +3335,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
|
|||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
|
||||
E = BlockByRefDecls.end(); I != E; ++I) {
|
||||
S += " ";
|
||||
std::string FieldName = (*I)->getName();
|
||||
std::string FieldName = (*I)->getNameAsString();
|
||||
std::string ArgName = "_" + FieldName;
|
||||
// Handle nested closure invocation. For example:
|
||||
//
|
||||
|
@ -3369,7 +3369,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
|
|||
// Initialize all "by copy" arguments.
|
||||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
|
||||
E = BlockByCopyDecls.end(); I != E; ++I) {
|
||||
std::string Name = (*I)->getName();
|
||||
std::string Name = (*I)->getNameAsString();
|
||||
Constructor += " ";
|
||||
if (isBlockPointerType((*I)->getType()))
|
||||
Constructor += Name + " = (struct __block_impl *)_";
|
||||
|
@ -3380,7 +3380,7 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
|
|||
// Initialize all "by ref" arguments.
|
||||
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
|
||||
E = BlockByRefDecls.end(); I != E; ++I) {
|
||||
std::string Name = (*I)->getName();
|
||||
std::string Name = (*I)->getNameAsString();
|
||||
Constructor += " ";
|
||||
if (isBlockPointerType((*I)->getType()))
|
||||
Constructor += Name + " = (struct __block_impl *)_";
|
||||
|
@ -3773,7 +3773,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp) {
|
|||
while ((loc = FuncName.find(":", loc)) != std::string::npos)
|
||||
FuncName.replace(loc, 1, "_");
|
||||
} else if (GlobalVarDecl)
|
||||
FuncName = std::string(GlobalVarDecl->getName());
|
||||
FuncName = std::string(GlobalVarDecl->getNameAsString());
|
||||
|
||||
std::string BlockNumber = utostr(Blocks.size()-1);
|
||||
|
||||
|
|
|
@ -91,13 +91,11 @@ public:
|
|||
/// which may be a special name.
|
||||
DeclarationName getDeclName() const { return Name; }
|
||||
|
||||
/// getName - 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 some
|
||||
/// expensive string manipulation, so it should be called only when
|
||||
/// absolutely critical. For simple declarations, @c
|
||||
/// getIdentifierName() should suffice.
|
||||
std::string getName() const { return Name.getAsString(); }
|
||||
/// 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
|
||||
/// manipulation, so it should be called only when performance doesn't matter.
|
||||
/// For simple declarations, getNameAsCString() should suffice.
|
||||
std::string getNameAsString() const { return Name.getAsString(); }
|
||||
|
||||
static bool classof(const Decl *D) {
|
||||
|
|
|
@ -420,7 +420,7 @@ DIAG(err_unexpected_at, ERROR,
|
|||
|
||||
/// Objective-C parser diagnostics
|
||||
DIAG(err_unexpected_interface, ERROR,
|
||||
"unexpected interface name '%0': expected expression")
|
||||
"unexpected interface name %0: expected expression")
|
||||
DIAG(err_objc_no_attributes_on_category, ERROR,
|
||||
"attributes may not be specified on a category")
|
||||
DIAG(err_objc_missing_end, ERROR,
|
||||
|
@ -463,7 +463,7 @@ DIAG(err_objc_concat_string, ERROR,
|
|||
DIAG(err_undef_superclass, ERROR,
|
||||
"cannot find interface declaration for %0, superclass of %1")
|
||||
DIAG(err_duplicate_class_def, ERROR,
|
||||
"duplicate interface definition for class '%0'")
|
||||
"duplicate interface definition for class %0")
|
||||
DIAG(warn_undef_protocolref, WARNING,
|
||||
"cannot find protocol definition for %0")
|
||||
DIAG(err_duplicate_protocol_def, ERROR,
|
||||
|
@ -529,15 +529,15 @@ DIAG(error_missing_method_context, ERROR,
|
|||
DIAG(error_bad_receiver_type, ERROR,
|
||||
"bad receiver type '%0'")
|
||||
DIAG(error_no_super_class, ERROR,
|
||||
"no super class declared in @interface for '%0'")
|
||||
"no super class declared in @interface for %0")
|
||||
DIAG(error_missing_property_context, ERROR,
|
||||
"missing context for property implementation declaration")
|
||||
DIAG(error_bad_property_context, ERROR,
|
||||
"property implementation must be in a class or category implementation")
|
||||
DIAG(error_bad_property_decl, ERROR,
|
||||
"property implementation must have its declaration in interface '%0'")
|
||||
"property implementation must have its declaration in interface %0")
|
||||
DIAG(error_bad_category_property_decl, ERROR,
|
||||
"property implementation must have its declaration in the category '%0'")
|
||||
"property implementation must have its declaration in the category %0")
|
||||
DIAG(error_property_ivar_decl, ERROR,
|
||||
"property synthesize requires specification of an ivar")
|
||||
DIAG(error_dynamic_property_ivar_decl, ERROR,
|
||||
|
@ -550,7 +550,7 @@ DIAG(error_missing_property_ivar_decl, ERROR,
|
|||
DIAG(error_synthesize_category_decl, ERROR,
|
||||
"@synthesize not allowed in a category's implementation")
|
||||
DIAG(error_property_ivar_type, ERROR,
|
||||
"type of property '%0' does not match type of ivar '%1'")
|
||||
"type of property %0 does not match type of ivar %1")
|
||||
DIAG(error_readonly_property_assignment, ERROR,
|
||||
"assigning to property with 'readonly' attribute not allowed")
|
||||
DIAG(error_nosetter_property_assignment, ERROR,
|
||||
|
@ -736,7 +736,7 @@ DIAG(err_destructor_with_params, ERROR,
|
|||
DIAG(err_destructor_variadic, ERROR,
|
||||
"destructor cannot be variadic")
|
||||
DIAG(err_destructor_typedef_name, ERROR,
|
||||
"destructor cannot be declared using a typedef '%0' of the class name")
|
||||
"destructor cannot be declared using a typedef %0 of the class name")
|
||||
|
||||
// C++ initialization
|
||||
DIAG(err_not_reference_to_const_init, ERROR,
|
||||
|
@ -744,7 +744,7 @@ DIAG(err_not_reference_to_const_init, ERROR,
|
|||
DIAG(err_reference_init_drops_quals, ERROR,
|
||||
"initialization of reference to type '%0' with a %1 of type '%2' drops qualifiers")
|
||||
DIAG(err_reference_var_requires_init, ERROR,
|
||||
"declaration of reference variable '%0' requires an initializer")
|
||||
"declaration of reference variable %0 requires an initializer")
|
||||
DIAG(err_const_var_requires_init, ERROR,
|
||||
"declaration of const variable '%0' requires an initializer")
|
||||
DIAG(err_init_non_aggr_init_list, ERROR,
|
||||
|
@ -887,35 +887,35 @@ DIAG(err_ovl_static_nonstatic_member, ERROR,
|
|||
"static and non-static member functions with the same parameter types "
|
||||
"cannot be overloaded")
|
||||
DIAG(err_ovl_no_viable_function_in_call, ERROR,
|
||||
"no matching function for call to '%0'"
|
||||
"%plural{0:.|1:; candidate is|:; candidates are:}1")
|
||||
"no matching function for call to %0"
|
||||
"%plural{0:|1:; candidate is|:; candidates are:}1")
|
||||
DIAG(err_ovl_ambiguous_call, ERROR,
|
||||
"call to '%0' is ambiguous; candidates are:")
|
||||
"call to %0 is ambiguous; candidates are:")
|
||||
DIAG(err_ovl_candidate, NOTE,
|
||||
"candidate function")
|
||||
DIAG(err_ovl_builtin_candidate, NOTE,
|
||||
"built-in candidate function '%0'")
|
||||
DIAG(err_ovl_no_viable_function_in_init, ERROR,
|
||||
"no matching constructor for initialization of '%0'"
|
||||
"%plural{0:.|1:; candidate is|:; candidates are:}1")
|
||||
"no matching constructor for initialization of %0"
|
||||
"%plural{0:|1:; candidate is|:; candidates are:}1")
|
||||
DIAG(err_ovl_ambiguous_init, ERROR,
|
||||
"call to constructor of '%0' is ambiguous; candidates are:")
|
||||
"call to constructor of %0 is ambiguous; candidates are:")
|
||||
DIAG(err_ovl_ambiguous_oper, ERROR,
|
||||
"use of overloaded operator '%0' is ambiguous; candidates are:")
|
||||
DIAG(err_ovl_no_viable_oper, ERROR,
|
||||
"no viable overloaded '%0'; candidate%plural{1: is|:s are}1:")
|
||||
DIAG(err_ovl_no_viable_object_call, ERROR,
|
||||
"no matching function for call to object of type '%0'"
|
||||
"%plural{0:.|1:; candidate is|:; candidates are:}1")
|
||||
"%plural{0:|1:; candidate is|:; candidates are:}1")
|
||||
DIAG(err_ovl_ambiguous_object_call, ERROR,
|
||||
"call to object of type '%0' is ambiguous; candidates are:")
|
||||
DIAG(err_ovl_surrogate_cand, NOTE,
|
||||
"conversion candidate of type '%0'")
|
||||
|
||||
DIAG(err_unexpected_typedef, ERROR,
|
||||
"unexpected type name '%0': expected expression")
|
||||
"unexpected type name %0: expected expression")
|
||||
DIAG(err_unexpected_namespace, ERROR,
|
||||
"unexpected namespace name '%0': expected expression")
|
||||
"unexpected namespace name %0: expected expression")
|
||||
DIAG(err_unexpected_typedef_ident, ERROR,
|
||||
"unexpected type name %0: expected identifier")
|
||||
DIAG(err_undeclared_var_use, ERROR,
|
||||
|
@ -923,21 +923,21 @@ DIAG(err_undeclared_var_use, ERROR,
|
|||
DIAG(err_undeclared_use, ERROR,
|
||||
"use of undeclared '%0'")
|
||||
DIAG(warn_deprecated, WARNING,
|
||||
"'%0' is deprecated")
|
||||
"%0 is deprecated")
|
||||
DIAG(err_redefinition, ERROR,
|
||||
"redefinition of %0")
|
||||
DIAG(err_static_non_static, ERROR,
|
||||
"static declaration of '%0' follows non-static declaration")
|
||||
"static declaration of %0 follows non-static declaration")
|
||||
DIAG(err_non_static_static, ERROR,
|
||||
"non-static declaration of '%0' follows static declaration")
|
||||
"non-static declaration of %0 follows static declaration")
|
||||
DIAG(err_redefinition_different_kind, ERROR,
|
||||
"redefinition of %0 as different kind of symbol")
|
||||
DIAG(err_redefinition_different_typedef, ERROR,
|
||||
"typedef redefinition with different types ('%0' vs '%1')")
|
||||
DIAG(err_conflicting_types, ERROR,
|
||||
"conflicting types for '%0'")
|
||||
"conflicting types for %0")
|
||||
DIAG(err_nested_redefinition, ERROR,
|
||||
"nested redefinition of '%0'")
|
||||
"nested redefinition of %0")
|
||||
DIAG(err_use_with_wrong_tag, ERROR,
|
||||
"use of %0 with tag type that does not match previous declaration")
|
||||
DIAG(ext_forward_ref_enum, EXTENSION,
|
||||
|
@ -1016,15 +1016,15 @@ DIAG(ext_implicit_function_decl, EXTENSION,
|
|||
DIAG(err_func_returning_array_function, ERROR,
|
||||
"function cannot return array or function type '%0'")
|
||||
DIAG(err_field_declared_as_function, ERROR,
|
||||
"field '%0' declared as a function")
|
||||
"field %0 declared as a function")
|
||||
DIAG(err_field_incomplete, ERROR,
|
||||
"field '%0' has incomplete type")
|
||||
"field %0 has incomplete type")
|
||||
DIAG(err_variable_sized_type_in_struct, EXTENSION,
|
||||
"variable sized type '%0' must be at end of struct or class")
|
||||
"variable sized type %0 must be at end of struct or class")
|
||||
DIAG(err_flexible_array_empty_struct, ERROR,
|
||||
"flexible array '%0' not allowed in otherwise empty struct")
|
||||
"flexible array %0 not allowed in otherwise empty struct")
|
||||
DIAG(ext_flexible_array_in_struct, EXTENSION,
|
||||
"'%0' may not be nested in a struct due to flexible array member")
|
||||
"%0 may not be nested in a struct due to flexible array member")
|
||||
DIAG(err_flexible_array_in_array, ERROR,
|
||||
"'%0' may not be used as an array element due to flexible array member")
|
||||
DIAG(err_illegal_decl_array_of_functions, ERROR,
|
||||
|
@ -1107,7 +1107,7 @@ DIAG(err_typecheck_member_reference_ivar, ERROR,
|
|||
DIAG(err_typecheck_member_reference_arrow, ERROR,
|
||||
"member reference type '%0' is not a pointer")
|
||||
DIAG(err_typecheck_incomplete_tag, ERROR,
|
||||
"incomplete definition of type '%0'")
|
||||
"incomplete definition of type %0")
|
||||
DIAG(err_typecheck_no_member, ERROR,
|
||||
"no member named %0")
|
||||
DIAG(err_typecheck_illegal_increment_decrement, ERROR,
|
||||
|
@ -1115,7 +1115,7 @@ DIAG(err_typecheck_illegal_increment_decrement, ERROR,
|
|||
DIAG(err_typecheck_arithmetic_incomplete_type, ERROR,
|
||||
"arithmetic on pointer to incomplete type '%0'")
|
||||
DIAG(err_typecheck_decl_incomplete_type, ERROR,
|
||||
"variable has incomplete type '%0'")
|
||||
"variable has incomplete type %0")
|
||||
DIAG(err_realimag_invalid_type, ERROR,
|
||||
"invalid type '%0' to __real or __imag operator")
|
||||
DIAG(err_typecheck_sclass_fscope, ERROR,
|
||||
|
@ -1146,14 +1146,14 @@ DIAG(err_typecheck_assign_const, ERROR,
|
|||
DIAG(err_invalid_this_use, ERROR,
|
||||
"invalid use of 'this' outside of a nonstatic member function")
|
||||
DIAG(err_invalid_member_use_in_static_method, ERROR,
|
||||
"invalid use of member '%0' in static member function")
|
||||
"invalid use of member %0 in static member function")
|
||||
DIAG(err_invalid_qualified_function_type, ERROR,
|
||||
"type qualifier is not allowed on this function")
|
||||
DIAG(err_invalid_qualified_typedef_function_type_use, ERROR,
|
||||
"a qualified function type cannot be used to declare a nonmember function "
|
||||
"or a static member function")
|
||||
DIAG(err_invalid_non_static_member_use, ERROR,
|
||||
"invalid use of nonstatic data member '%0'")
|
||||
"invalid use of nonstatic data member %0")
|
||||
DIAG(err_invalid_incomplete_type_use, ERROR,
|
||||
"invalid use of incomplete type '%0'")
|
||||
DIAG(err_builtin_func_cast_more_than_one_arg, ERROR,
|
||||
|
@ -1224,7 +1224,7 @@ DIAG(err_typecheck_bool_condition, ERROR,
|
|||
DIAG(err_expected_class_or_namespace, ERROR,
|
||||
"expected a class or namespace")
|
||||
DIAG(err_invalid_declarator_scope, ERROR,
|
||||
"definition or redeclaration of '%0' not in a namespace enclosing '%1'")
|
||||
"definition or redeclaration of %0 not in a namespace enclosing %1")
|
||||
DIAG(err_invalid_declarator_in_function, ERROR,
|
||||
"definition or redeclaration of %0 not allowed inside a function")
|
||||
DIAG(err_not_tag_in_scope, ERROR,
|
||||
|
@ -1232,30 +1232,31 @@ DIAG(err_not_tag_in_scope, ERROR,
|
|||
|
||||
|
||||
// assignment related diagnostics (also for argument passing, returning, etc).
|
||||
// FIXME: %2 is an english string here.
|
||||
DIAG(err_typecheck_convert_incompatible, ERROR,
|
||||
"incompatible type %2 '%1', expected '%0'")
|
||||
"incompatible type %2 %1, expected %0")
|
||||
DIAG(warn_incompatible_qualified_id, WARNING,
|
||||
"incompatible type %2 '%1', expected '%0'")
|
||||
"incompatible type %2 %1, expected %0")
|
||||
DIAG(warn_incompatible_qualified_id_operands, WARNING,
|
||||
"invalid operands to binary expression ('%0' and '%1')")
|
||||
"invalid operands to binary expression (%0 and %1)")
|
||||
DIAG(ext_typecheck_convert_pointer_int, EXTWARN,
|
||||
"incompatible pointer to integer conversion %2 '%1', expected '%0'")
|
||||
"incompatible pointer to integer conversion %2 %1, expected %0")
|
||||
DIAG(ext_typecheck_convert_int_pointer, EXTWARN,
|
||||
"incompatible integer to pointer conversion %2 '%1', expected '%0'")
|
||||
"incompatible integer to pointer conversion %2 %1, expected %0")
|
||||
DIAG(ext_typecheck_convert_pointer_void_func, EXTENSION,
|
||||
"%2 '%1' converts between void* and function pointer, expected '%0'")
|
||||
"%2 %1 converts between void* and function pointer, expected %0")
|
||||
DIAG(ext_typecheck_convert_incompatible_pointer, EXTWARN,
|
||||
"incompatible pointer types %2 '%1', expected '%0'")
|
||||
"incompatible pointer types %2 %1, expected %0")
|
||||
DIAG(ext_typecheck_convert_discards_qualifiers, EXTWARN,
|
||||
"%2 '%1' discards qualifiers, expected '%0'")
|
||||
"%2 %1 discards qualifiers, expected %0")
|
||||
DIAG(err_int_to_block_pointer, ERROR,
|
||||
"invalid conversion %2 integer '%1', expected block pointer '%0'")
|
||||
"invalid conversion %2 integer %1, expected block pointer %0")
|
||||
DIAG(err_typecheck_comparison_of_distinct_blocks, ERROR,
|
||||
"comparison of distinct block types ('%0' and '%1')")
|
||||
DIAG(ext_typecheck_convert_incompatible_block_pointer, EXTWARN,
|
||||
"incompatible block pointer types %2 '%1', expected '%0'")
|
||||
"incompatible block pointer types %2 %1, expected %0")
|
||||
DIAG(ext_typecheck_convert_pointer_void_block, EXTENSION,
|
||||
"%2 '%1' converts between void* and block pointer, expected '%0'")
|
||||
"%2 %1 converts between void* and block pointer, expected %0")
|
||||
|
||||
DIAG(err_typecheck_array_not_modifiable_lvalue, ERROR,
|
||||
"array type '%0' is not assignable")
|
||||
|
@ -1364,19 +1365,19 @@ DIAG(err_ambiguous_derived_to_base_conv, ERROR,
|
|||
|
||||
// C++ operator overloading
|
||||
DIAG(err_operator_overload_needs_class_or_enum, ERROR,
|
||||
"overloaded '%0' must have at least one parameter of class "
|
||||
"overloaded %0 must have at least one parameter of class "
|
||||
"or enumeration type")
|
||||
DIAG(err_operator_overload_variadic, ERROR,
|
||||
"overloaded '%0' cannot be variadic")
|
||||
"overloaded %0 cannot be variadic")
|
||||
DIAG(err_operator_overload_static, ERROR,
|
||||
"overloaded '%0' cannot be a static member function")
|
||||
"overloaded %0 cannot be a static member function")
|
||||
DIAG(err_operator_overload_default_arg, ERROR,
|
||||
"parameter of overloaded '%0' cannot have a default argument")
|
||||
"parameter of overloaded %0 cannot have a default argument")
|
||||
DIAG(err_operator_overload_must_be, ERROR,
|
||||
"overloaded '%0' must be a %select{unary|binary|unary or binary}2 operator"
|
||||
"overloaded %0 must be a %select{unary|binary|unary or binary}2 operator"
|
||||
" (has %1 parameter%s1)")
|
||||
DIAG(err_operator_overload_must_be_member, ERROR,
|
||||
"overloaded '%0' must be a non-static member function")
|
||||
"overloaded %0 must be a non-static member function")
|
||||
DIAG(err_operator_overload_post_incdec_must_be_int, ERROR,
|
||||
"parameter of overloaded post-%select{increment|decrement}1 operator must"
|
||||
" have type 'int' (not '%0')")
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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'";
|
||||
}
|
||||
|
|
|
@ -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 "
|
||||
|
|
|
@ -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).";
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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 += ']';
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -9,7 +9,7 @@ typedef int FOO();
|
|||
int arr[]; // expected-error {{field 'arr' has incomplete type}}
|
||||
struct S IC; // expected-error {{field 'IC' has incomplete type}}
|
||||
struct T { // expected-note {{previous definition is here}}
|
||||
struct T {} X; // expected-error {{nested redefinition of 'struct'}}
|
||||
struct T {} X; // expected-error {{nested redefinition of 'T'}}
|
||||
}YYY;
|
||||
FOO BADFUNC; // expected-error {{field 'BADFUNC' declared as a function}}
|
||||
int kaka; // expected-note {{previous definition is here}}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@synthesize d1; // expected-error {{synthesized property 'd1' must either be named the same as}}
|
||||
@dynamic bad; // expected-error {{property implementation must have its declaration in interface 'I'}}
|
||||
@synthesize prop_id; // expected-error {{synthesized property 'prop_id' must either be named the same}}
|
||||
@synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' does not match type of ivar 'IVAR'}}
|
||||
@synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' does not match type of ivar 'IVAR'}}
|
||||
@synthesize name; // OK! property with same name as an accessible ivar of same name
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in New Issue