Migrate some stuff from NamedDecl::getName() to

NamedDecl::getNameAsString() to make it more explicit.

llvm-svn: 59937
This commit is contained in:
Chris Lattner 2008-11-24 04:00:27 +00:00
parent 86d7d91366
commit 1cbaacc4a0
8 changed files with 28 additions and 28 deletions

View File

@ -1589,7 +1589,7 @@ void ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD,
if (SynthesizePID) {
const ObjCIvarDecl *OID = SynthesizePID->getPropertyIvarDecl();
S += ",V";
S += OID->getName();
S += OID->getNameAsString();
}
// FIXME: OBJCGC: weak & strong
@ -1695,7 +1695,7 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
FieldDecl *FD = RDecl->getMember(i);
if (NameFields) {
S += '"';
S += FD->getName();
S += FD->getNameAsString();
S += '"';
}

View File

@ -125,7 +125,7 @@ std::string DeclarationName::getAsString() const {
case CXXConstructorName: {
QualType ClassType = getCXXNameType();
if (const RecordType *ClassRec = ClassType->getAsRecordType())
return ClassRec->getDecl()->getName();
return ClassRec->getDecl()->getNameAsString();
return ClassType.getAsString();
}
@ -133,7 +133,7 @@ std::string DeclarationName::getAsString() const {
std::string Result = "~";
QualType Type = getCXXNameType();
if (const RecordType *Rec = Type->getAsRecordType())
Result += Rec->getDecl()->getName();
Result += Rec->getDecl()->getNameAsString();
else
Result += Type.getAsString();
return Result;
@ -160,7 +160,7 @@ std::string DeclarationName::getAsString() const {
std::string Result = "operator ";
QualType Type = getCXXNameType();
if (const RecordType *Rec = Type->getAsRecordType())
Result += Rec->getDecl()->getName();
Result += Rec->getDecl()->getNameAsString();
else
Result += Type.getAsString();
return Result;

View File

@ -218,7 +218,7 @@ void StmtDumper::DumpDeclarator(Decl *D) {
}
}
std::string Name = VD->getName();
std::string Name = VD->getNameAsString();
VD->getType().getAsStringInternal(Name);
fprintf(F, "%s", Name.c_str());
@ -296,7 +296,7 @@ void StmtDumper::VisitDeclRefExpr(DeclRefExpr *Node) {
default: fprintf(F,"Decl"); break;
}
fprintf(F, "='%s' %p", Node->getDecl()->getName().c_str(),
fprintf(F, "='%s' %p", Node->getDecl()->getNameAsString().c_str(),
(void*)Node->getDecl());
}

View File

@ -106,7 +106,7 @@ void StmtPrinter::PrintRawDecl(Decl *D) {
// nodes are where they need to be.
if (TypedefDecl *localType = dyn_cast<TypedefDecl>(D)) {
OS << "typedef " << localType->getUnderlyingType().getAsString();
OS << " " << localType->getName();
OS << " " << localType->getNameAsString();
} else if (ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
// Emit storage class for vardecls.
if (VarDecl *V = dyn_cast<VarDecl>(VD)) {
@ -120,7 +120,7 @@ void StmtPrinter::PrintRawDecl(Decl *D) {
}
}
std::string Name = VD->getName();
std::string Name = VD->getNameAsString();
VD->getType().getAsStringInternal(Name);
OS << Name;
@ -483,7 +483,7 @@ void StmtPrinter::VisitExpr(Expr *Node) {
}
void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
OS << Node->getDecl()->getName();
OS << Node->getDecl()->getNameAsString();
}
void StmtPrinter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
@ -491,7 +491,7 @@ void StmtPrinter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
PrintExpr(Node->getBase());
OS << (Node->isArrow() ? "->" : ".");
}
OS << Node->getDecl()->getName();
OS << Node->getDecl()->getNameAsString();
}
void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
@ -658,7 +658,7 @@ bool StmtPrinter::PrintOffsetOfDesignator(Expr *E) {
} else {
MemberExpr *ME = cast<MemberExpr>(E);
bool IsFirst = PrintOffsetOfDesignator(ME->getBase());
OS << (IsFirst ? "" : ".") << ME->getMemberDecl()->getName();
OS << (IsFirst ? "" : ".") << ME->getMemberDecl()->getNameAsString();
return false;
}
}
@ -705,7 +705,7 @@ void StmtPrinter::VisitMemberExpr(MemberExpr *Node) {
FieldDecl *Field = Node->getMemberDecl();
assert(Field && "MemberExpr should alway reference a field!");
OS << Field->getName();
OS << Field->getNameAsString();
}
void StmtPrinter::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
PrintExpr(Node->getBase());
@ -984,15 +984,15 @@ void StmtPrinter::VisitObjCStringLiteral(ObjCStringLiteral *Node) {
}
void StmtPrinter::VisitObjCEncodeExpr(ObjCEncodeExpr *Node) {
OS << "@encode(" << Node->getEncodedType().getAsString() << ")";
OS << "@encode(" << Node->getEncodedType().getAsString() << ')';
}
void StmtPrinter::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
OS << "@selector(" << Node->getSelector().getAsString() << ")";
OS << "@selector(" << Node->getSelector().getAsString() << ')';
}
void StmtPrinter::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
OS << "@protocol(" << Node->getProtocol()->getName() << ")";
OS << "@protocol(" << Node->getProtocol()->getNameAsString() << ')';
}
void StmtPrinter::VisitObjCMessageExpr(ObjCMessageExpr *Mess) {
@ -1009,7 +1009,7 @@ void StmtPrinter::VisitObjCMessageExpr(ObjCMessageExpr *Mess) {
if (i < selector.getNumArgs()) {
if (i > 0) OS << ' ';
if (selector.getIdentifierInfoForSlot(i))
OS << selector.getIdentifierInfoForSlot(i)->getName() << ":";
OS << selector.getIdentifierInfoForSlot(i)->getName() << ':';
else
OS << ":";
}
@ -1039,7 +1039,7 @@ void StmtPrinter::VisitBlockExpr(BlockExpr *Node) {
for (BlockDecl::param_iterator AI = BD->param_begin(),
E = BD->param_end(); AI != E; ++AI) {
if (AI != BD->param_begin()) OS << ", ";
ParamStr = (*AI)->getName();
ParamStr = (*AI)->getNameAsString();
(*AI)->getType().getAsStringInternal(ParamStr);
OS << ParamStr;
}
@ -1054,7 +1054,7 @@ void StmtPrinter::VisitBlockExpr(BlockExpr *Node) {
}
void StmtPrinter::VisitBlockDeclRefExpr(BlockDeclRefExpr *Node) {
OS << Node->getDecl()->getName();
OS << Node->getDecl()->getNameAsString();
}
//===----------------------------------------------------------------------===//
// Stmt method implementations

View File

@ -1012,7 +1012,7 @@ void ObjCQualifiedInterfaceType::getAsStringInternal(
std::string &InnerString) const {
if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'.
InnerString = ' ' + InnerString;
std::string ObjCQIString = getDecl()->getName();
std::string ObjCQIString = getDecl()->getNameAsString();
ObjCQIString += '<';
bool isFirst = true;
for (qual_iterator I = qual_begin(), E = qual_end(); I != E; ++I) {
@ -1020,7 +1020,7 @@ void ObjCQualifiedInterfaceType::getAsStringInternal(
isFirst = false;
else
ObjCQIString += ',';
ObjCQIString += (*I)->getName();
ObjCQIString += (*I)->getNameAsString();
}
ObjCQIString += '>';
InnerString = ObjCQIString + InnerString;
@ -1033,7 +1033,7 @@ void ObjCQualifiedIdType::getAsStringInternal(std::string &InnerString) const {
ObjCQIString += '<';
int num = getNumProtocols();
for (int i = 0; i < num; i++) {
ObjCQIString += getProtocols(i)->getName();
ObjCQIString += getProtocols(i)->getNameAsString();
if (i < num-1)
ObjCQIString += ',';
}

View File

@ -433,7 +433,7 @@ void BasicStoreManager::print(Store store, std::ostream& Out,
if (isFirst) isFirst = false;
else Out << nl;
Out << ' ' << I.getKey()->getName() << " : ";
Out << ' ' << I.getKey()->getNameAsString() << " : ";
I.getData().print(Out);
}
}

View File

@ -716,7 +716,7 @@ void CodeGenFunction::EmitFunctionProlog(llvm::Function *Fn,
// If this was structure was expand into multiple arguments then
// we need to create a temporary and reconstruct it from the
// arguments.
std::string Name(Arg->getName());
std::string Name = Arg->getNameAsString();
llvm::Value *Temp = CreateTempAlloca(ConvertType(Ty),
(Name + ".addr").c_str());
// FIXME: What are the right qualifiers here?

View File

@ -91,7 +91,7 @@ CodeGenFunction::GenerateStaticBlockVarDecl(const VarDecl &D,
std::string ContextName;
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurFuncDecl))
ContextName = FD->getName();
ContextName = FD->getNameAsString();
else if (isa<ObjCMethodDecl>(CurFuncDecl))
ContextName = std::string(CurFn->getNameStart(),
CurFn->getNameStart() + CurFn->getNameLen());
@ -101,7 +101,7 @@ CodeGenFunction::GenerateStaticBlockVarDecl(const VarDecl &D,
llvm::GlobalValue *GV =
new llvm::GlobalVariable(Init->getType(), false,
llvm::GlobalValue::InternalLinkage,
Init, ContextName + Separator + D.getName(),
Init, ContextName + Separator +D.getNameAsString(),
&CGM.getModule(), 0, Ty.getAddressSpace());
return GV;
@ -212,7 +212,7 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, llvm::Value *Arg) {
const llvm::Type *LTy = ConvertType(Ty);
if (LTy->isSingleValueType()) {
// TODO: Alignment
std::string Name(D.getName());
std::string Name = D.getNameAsString();
Name += ".addr";
DeclPtr = CreateTempAlloca(LTy, Name.c_str());
@ -222,7 +222,7 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, llvm::Value *Arg) {
// Otherwise, if this is an aggregate, just use the input pointer.
DeclPtr = Arg;
}
Arg->setName(D.getName());
Arg->setName(D.getNameAsString());
}
llvm::Value *&DMEntry = LocalDeclMap[&D];