static bool classofKind(Kind K) { return K >= NamedFirst && K <= NamedLast; }
};
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const NamedDecl *ND);
+
/// NamespaceDecl - Represent a C++ namespace.
class NamespaceDecl : public NamedDecl, public DeclContext {
SourceLocation LBracLoc, RBracLoc;
static bool classofKind(Kind K) { return K == ObjCCategoryImpl;}
};
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+ const ObjCCategoryImplDecl *CID);
+
/// ObjCImplementationDecl - Represents a class definition - this is where
/// method definitions are specified. For example:
///
static bool classofKind(Kind K) { return K == ObjCImplementation; }
};
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+ const ObjCImplementationDecl *ID);
+
/// ObjCCompatibleAliasDecl - Represents alias of a class. This alias is
/// declared as @compatibility_alias alias class.
class ObjCCompatibleAliasDecl : public NamedDecl {
return false;
}
+llvm::raw_ostream &clang::operator<<(llvm::raw_ostream &OS,
+ const NamedDecl *ND) {
+ OS << ND->getNameAsString();
+ return OS;
+}
+
//===----------------------------------------------------------------------===//
// DeclaratorDecl Implementation
//===----------------------------------------------------------------------===//
return 0;
}
+llvm::raw_ostream &clang::operator<<(llvm::raw_ostream &OS,
+ const ObjCCategoryImplDecl *CID) {
+ OS << CID->getName();
+ return OS;
+}
+
//===----------------------------------------------------------------------===//
// ObjCImplementationDecl
//===----------------------------------------------------------------------===//
return new (C) ObjCImplementationDecl(DC, L, ClassInterface, SuperDecl);
}
+llvm::raw_ostream &clang::operator<<(llvm::raw_ostream &OS,
+ const ObjCImplementationDecl *ID) {
+ OS << ID->getName();
+ return OS;
+}
+
//===----------------------------------------------------------------------===//
// ObjCCompatibleAliasDecl
//===----------------------------------------------------------------------===//
}
void DeclPrinter::VisitEnumDecl(EnumDecl *D) {
- Out << "enum " << D->getNameAsString() << " {\n";
+ Out << "enum " << D << " {\n";
VisitDeclContext(D);
Indent() << "}";
}
void DeclPrinter::VisitRecordDecl(RecordDecl *D) {
Out << D->getKindName();
- if (D->getIdentifier()) {
- Out << " ";
- Out << D->getNameAsString();
- }
+ if (D->getIdentifier())
+ Out << ' ' << D;
if (D->isDefinition()) {
Out << " {\n";
}
void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) {
- Out << D->getNameAsString();
+ Out << D;
if (Expr *Init = D->getInitExpr()) {
Out << " = ";
Init->printPretty(Out, Context, 0, Policy, Indentation);
Out << ", ";
if (BMInitializer->isMemberInitializer()) {
FieldDecl *FD = BMInitializer->getMember();
- Out << FD->getNameAsString();
+ Out << FD;
} else {
Out << QualType(BMInitializer->getBaseClass(), 0).getAsString();
}
// C++ declarations
//----------------------------------------------------------------------------
void DeclPrinter::VisitNamespaceDecl(NamespaceDecl *D) {
- Out << "namespace " << D->getNameAsString() << " {\n";
+ Out << "namespace " << D << " {\n";
VisitDeclContext(D);
Indent() << "}";
}
Out << "using namespace ";
if (D->getQualifier())
D->getQualifier()->print(Out, Policy);
- Out << D->getNominatedNamespaceAsWritten()->getNameAsString();
+ Out << D->getNominatedNamespaceAsWritten();
}
void DeclPrinter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
- Out << "namespace " << D->getNameAsString() << " = ";
+ Out << "namespace " << D << " = ";
if (D->getQualifier())
D->getQualifier()->print(Out, Policy);
- Out << D->getAliasedNamespace()->getNameAsString();
+ Out << D->getAliasedNamespace();
}
void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
Out << D->getKindName();
- if (D->getIdentifier()) {
- Out << " ";
- Out << D->getNameAsString();
- }
+ if (D->getIdentifier())
+ Out << ' ' << D;
if (D->isDefinition()) {
// Print the base classes
for (ObjCClassDecl::iterator I = D->begin(), E = D->end();
I != E; ++I) {
if (I != D->begin()) Out << ", ";
- Out << I->getInterface()->getNameAsString();
+ Out << I->getInterface();
}
}
// FIXME: selector is missing here!
pos = name.find_first_of(":", lastPos);
Out << " " << name.substr(lastPos, pos - lastPos);
- Out << ":(" << (*PI)->getType().getAsString(Policy) << ")"
- << (*PI)->getNameAsString();
+ Out << ":(" << (*PI)->getType().getAsString(Policy) << ')' << *PI;
lastPos = pos + 1;
}
ObjCInterfaceDecl *SID = OID->getSuperClass();
if (SID)
- Out << "@implementation " << I << " : " << SID->getNameAsString();
+ Out << "@implementation " << I << " : " << SID;
else
Out << "@implementation " << I;
Out << "\n";
ObjCInterfaceDecl *SID = OID->getSuperClass();
if (SID)
- Out << "@interface " << I << " : " << SID->getNameAsString();
+ Out << "@interface " << I << " : " << SID;
else
Out << "@interface " << I;
if (!Protocols.empty()) {
for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
E = Protocols.end(); I != E; ++I)
- Out << (I == Protocols.begin() ? '<' : ',') << (*I)->getNameAsString();
+ Out << (I == Protocols.begin() ? '<' : ',') << *I;
}
if (!Protocols.empty())
Indentation += Policy.Indentation;
for (ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin(),
E = OID->ivar_end(); I != E; ++I) {
- Indent() << (*I)->getType().getAsString(Policy)
- << ' ' << (*I)->getNameAsString() << ";\n";
+ Indent() << (*I)->getType().getAsString(Policy) << ' ' << *I << ";\n";
}
Indentation -= Policy.Indentation;
Out << "}\n";
E = D->protocol_end();
I != E; ++I) {
if (I != D->protocol_begin()) Out << ", ";
- Out << (*I)->getNameAsString();
+ Out << *I;
}
}
void DeclPrinter::VisitObjCProtocolDecl(ObjCProtocolDecl *PID) {
- Out << "@protocol " << PID->getNameAsString() << '\n';
+ Out << "@protocol " << PID << '\n';
VisitDeclContext(PID, false);
Out << "@end";
}
void DeclPrinter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *PID) {
- Out << "@implementation "
- << PID->getClassInterface()->getNameAsString()
- << '(' << PID->getNameAsString() << ")\n";
+ Out << "@implementation " << PID->getClassInterface() << '(' << PID << ")\n";
VisitDeclContext(PID, false);
Out << "@end";
}
void DeclPrinter::VisitObjCCategoryDecl(ObjCCategoryDecl *PID) {
- Out << "@interface "
- << PID->getClassInterface()->getNameAsString()
- << '(' << PID->getNameAsString() << ")\n";
+ Out << "@interface " << PID->getClassInterface() << '(' << PID << ")\n";
VisitDeclContext(PID, false);
Out << "@end";
}
void DeclPrinter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *AID) {
- Out << "@compatibility_alias " << AID->getNameAsString()
- << ' ' << AID->getClassInterface()->getNameAsString() << ";\n";
+ Out << "@compatibility_alias " << AID
+ << ' ' << AID->getClassInterface() << ";\n";
}
/// PrintObjCPropertyDecl - print a property declaration.
}
Out << " )";
}
- Out << ' ' << PDecl->getType().getAsString(Policy)
- << ' ' << PDecl->getNameAsString();
+ Out << ' ' << PDecl->getType().getAsString(Policy) << ' ' << PDecl;
}
void DeclPrinter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *PID) {
Out << "@synthesize ";
else
Out << "@dynamic ";
- Out << PID->getPropertyDecl()->getNameAsString();
+ Out << PID->getPropertyDecl();
if (PID->getPropertyIvarDecl())
- Out << "=" << PID->getPropertyIvarDecl()->getNameAsString();
+ Out << '=' << PID->getPropertyIvarDecl();
}
void DeclPrinter::VisitUsingDecl(UsingDecl *D) {
Out << "using ";
D->getTargetNestedNameDecl()->print(Out, Policy);
- Out << D->getNameAsString();
+ Out << D;
}
void
DeclPrinter::VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D) {
Out << "using typename ";
D->getTargetNestedNameSpecifier()->print(Out, Policy);
- Out << D->getDeclName().getAsString();
+ Out << D->getDeclName();
}
void DeclPrinter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
Out << "using ";
D->getTargetNestedNameSpecifier()->print(Out, Policy);
- Out << D->getDeclName().getAsString();
+ Out << D->getDeclName();
}
void DeclPrinter::VisitUsingShadowDecl(UsingShadowDecl *D) {
// For incorrect code, there might not be an ObjCInterfaceDecl. Do
// a null check to avoid a crash.
if (const ObjCInterfaceDecl *ID = MD->getClassInterface())
- Out << ID->getNameAsString();
+ Out << ID;
if (const ObjCCategoryImplDecl *CID =
- dyn_cast<ObjCCategoryImplDecl>(MD->getDeclContext())) {
- Out << '(';
- Out << CID->getNameAsString();
- Out << ')';
- }
+ dyn_cast<ObjCCategoryImplDecl>(MD->getDeclContext()))
+ Out << '(' << CID << ')';
+
Out << ' ';
Out << MD->getSelector().getAsString();
Out << ']';
// Vtable pointer.
if (RD->isDynamicClass() && !PrimaryBase) {
PrintOffset(OS, Offset, IndentLevel);
- OS << '(' << RD->getNameAsString() << " vtable pointer)\n";
+ OS << '(' << RD << " vtable pointer)\n";
}
// Dump (non-virtual) bases
for (CXXRecordDecl::base_class_const_iterator I = RD->bases_begin(),
}
PrintOffset(OS, FieldOffset, IndentLevel);
- OS << Field->getType().getAsString() << ' ';
- OS << Field->getNameAsString() << '\n';
+ OS << Field->getType().getAsString() << ' ' << Field << '\n';
}
if (!IncludeVirtualBases)
// nodes are where they need to be.
if (TypedefDecl *localType = dyn_cast<TypedefDecl>(D)) {
OS << "\"typedef " << localType->getUnderlyingType().getAsString()
- << " " << localType->getNameAsString() << "\"";
+ << ' ' << localType << '"';
} else if (ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
OS << "\"";
// Emit storage class for vardecls.
case Decl::ObjCClass: OS << "ObjCClass"; break;
}
- OS << "='" << Node->getDecl()->getNameAsString()
- << "' " << (void*)Node->getDecl();
+ OS << "='" << Node->getDecl() << "' " << (void*)Node->getDecl();
}
void StmtDumper::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *Node) {
DumpExpr(Node);
OS << " (";
if (!Node->requiresADL()) OS << "no ";
- OS << "ADL) = '" << Node->getName().getAsString() << "'";
+ OS << "ADL) = '" << Node->getName() << '\'';
UnresolvedLookupExpr::decls_iterator
I = Node->decls_begin(), E = Node->decls_end();
DumpExpr(Node);
OS << " " << Node->getDecl()->getDeclKindName()
- << "Decl='" << Node->getDecl()->getNameAsString()
+ << "Decl='" << Node->getDecl()
<< "' " << (void*)Node->getDecl();
if (Node->isFreeIvar())
OS << " isFreeIvar";
void StmtDumper::VisitMemberExpr(MemberExpr *Node) {
DumpExpr(Node);
OS << " " << (Node->isArrow() ? "->" : ".")
- << Node->getMemberDecl()->getNameAsString() << " "
+ << Node->getMemberDecl() << ' '
<< (void*)Node->getMemberDecl();
}
void StmtDumper::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
void StmtDumper::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
DumpExpr(Node);
- OS << " " << Node->getProtocol()->getNameAsString();
+ OS << ' ' << Node->getProtocol();
}
void StmtDumper::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
DumpExpr(Node);
- OS << " Kind=PropertyRef Property=\""
- << Node->getProperty()->getNameAsString() << "\"";
+ OS << " Kind=PropertyRef Property=\"" << Node->getProperty() << '"';
}
void StmtDumper::VisitObjCImplicitSetterGetterRefExpr(
void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
if (NestedNameSpecifier *Qualifier = Node->getQualifier())
Qualifier->print(OS, Policy);
- OS << Node->getDecl()->getNameAsString();
+ OS << Node->getDecl();
if (Node->hasExplicitTemplateArgumentList())
OS << TemplateSpecializationType::PrintTemplateArgumentList(
Node->getTemplateArgs(),
PrintExpr(Node->getBase());
OS << (Node->isArrow() ? "->" : ".");
}
- OS << Node->getDecl()->getNameAsString();
+ OS << Node->getDecl();
}
void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
OS << ".";
}
if (Node->getGetterMethod())
- OS << Node->getGetterMethod()->getNameAsString();
+ OS << Node->getGetterMethod();
}
} else {
MemberExpr *ME = cast<MemberExpr>(E);
bool IsFirst = PrintOffsetOfDesignator(ME->getBase());
- OS << (IsFirst ? "" : ".") << ME->getMemberDecl()->getNameAsString();
+ OS << (IsFirst ? "" : ".") << ME->getMemberDecl();
return false;
}
}
if (NestedNameSpecifier *Qualifier = Node->getQualifier())
Qualifier->print(OS, Policy);
- OS << Node->getMemberDecl()->getNameAsString();
+ OS << Node->getMemberDecl();
if (Node->hasExplicitTemplateArgumentList())
OS << TemplateSpecializationType::PrintTemplateArgumentList(
}
void StmtPrinter::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
- OS << "@protocol(" << Node->getProtocol()->getNameAsString() << ')';
+ OS << "@protocol(" << Node->getProtocol() << ')';
}
void StmtPrinter::VisitObjCMessageExpr(ObjCMessageExpr *Mess) {
}
void StmtPrinter::VisitBlockDeclRefExpr(BlockDeclRefExpr *Node) {
- OS << Node->getDecl()->getNameAsString();
+ OS << Node->getDecl();
}
//===----------------------------------------------------------------------===//
// Stmt method implementations
TemplateName::print(llvm::raw_ostream &OS, const PrintingPolicy &Policy,
bool SuppressNNS) const {
if (TemplateDecl *Template = Storage.dyn_cast<TemplateDecl *>())
- OS << Template->getNameAsString();
+ OS << Template;
else if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName()) {
if (!SuppressNNS)
QTN->getQualifier()->print(OS, Policy);
if (QTN->hasTemplateKeyword())
OS << "template ";
- OS << QTN->getDecl()->getNameAsString();
+ OS << QTN->getDecl();
} else if (DependentTemplateName *DTN = getAsDependentTemplateName()) {
if (!SuppressNNS && DTN->getQualifier())
DTN->getQualifier()->print(OS, Policy);
if (D) {
GetRawInt = false;
- os << D->getNameAsString();
+ os << D;
}
}
if (const DeclStmt *DS = PS->getStmtAs<DeclStmt>()) {
if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {
- os << "Variable '" << VR->getDecl()->getNameAsString() << "' ";
+ os << "Variable '" << VR->getDecl() << "' ";
}
else
return NULL;
return NULL;
if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {
- os << '\'' << VR->getDecl()->getNameAsString() << '\'';
+ os << '\'' << VR->getDecl() << '\'';
}
else
return NULL;
// Get the name of the callee (if it is available).
SVal X = CurrSt->getSValAsScalarOrLoc(CE->getCallee());
if (const FunctionDecl* FD = X.getAsFunctionDecl())
- os << "Call to function '" << FD->getNameAsString() <<'\'';
+ os << "Call to function '" << FD << '\'';
else
os << "function call";
}
os << "Passed-by-value struct argument contains uninitialized data";
if (F.FieldChain.size() == 1)
- os << " (e.g., field: '" << F.FieldChain[0]->getNameAsString()
- << "')";
+ os << " (e.g., field: '" << F.FieldChain[0] << "')";
else {
os << " (e.g., via the field chain: '";
bool first = true;
first = false;
else
os << '.';
- os << (*DI)->getNameAsString();
+ os << *DI;
}
os << "')";
}
std::string buf;
llvm::raw_string_ostream os(buf);
- os << "Objective-C class '" << D->getNameAsString()
- << "' lacks a 'dealloc' instance method";
+ os << "Objective-C class '" << D << "' lacks a 'dealloc' instance method";
BR.EmitBasicReport(name, os.str(), D->getLocStart());
return;
std::string buf;
llvm::raw_string_ostream os(buf);
- os << "The 'dealloc' instance method in Objective-C class '"
- << D->getNameAsString()
+ os << "The 'dealloc' instance method in Objective-C class '" << D
<< "' does not send a 'dealloc' message to its super class"
" (missing [super dealloc])";
? "missing ivar release (leak)"
: "missing ivar release (Hybrid MM, non-GC)";
- os << "The '" << ID->getNameAsString()
+ os << "The '" << ID
<< "' instance variable was retained by a synthesized property but "
"wasn't released in 'dealloc'";
} else {
? "extra ivar release (use-after-release)"
: "extra ivar release (Hybrid MM, non-GC)";
- os << "The '" << ID->getNameAsString()
+ os << "The '" << ID
<< "' instance variable was not retained by a synthesized property "
"but was released in 'dealloc'";
}
llvm::raw_string_ostream os(sbuf);
os << "The Objective-C class '"
- << MethDerived->getClassInterface()->getNameAsString()
+ << MethDerived->getClassInterface()
<< "', which is derived from class '"
- << MethAncestor->getClassInterface()->getNameAsString()
+ << MethAncestor->getClassInterface()
<< "', 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()->getNameAsString()
+ << MethAncestor->getClassInterface()
<< "' and has a return type of '"
<< ResAncestor.getAsString()
<< "'. These two types are incompatible, and may result in undefined "
// Issue a warning.
llvm::SmallString<256> buf1;
llvm::raw_svector_ostream os1(buf1);
- os1 << "'" << FD->getNameAsString() << "' is a poor random number generator";
+ os1 << '\'' << FD << "' is a poor random number generator";
llvm::SmallString<256> buf2;
llvm::raw_svector_ostream os2(buf2);
- os2 << "Function '" << FD->getNameAsString()
+ os2 << "Function '" << FD
<< "' is obsolete because it implements a poor random number generator."
<< " Use 'arc4random' instead";
// Issue a warning.
llvm::SmallString<256> buf1;
llvm::raw_svector_ostream os1(buf1);
- os1 << "Return value is not checked in call to '" << FD->getNameAsString()
- << "'";
+ os1 << "Return value is not checked in call to '" << FD << '\'';
llvm::SmallString<256> buf2;
llvm::raw_svector_ostream os2(buf2);
- os2 << "The return value from the call to '" << FD->getNameAsString()
- << "' is not checked. If an error occurs in '"
- << FD->getNameAsString()
+ os2 << "The return value from the call to '" << FD
+ << "' is not checked. If an error occurs in '" << FD
<< "', the following code may execute with unexpected privileges";
SourceRange R = CE->getCallee()->getSourceRange();
}
void FieldRegion::dumpToStream(llvm::raw_ostream& os) const {
- os << superRegion << "->" << getDecl()->getNameAsString();
+ os << superRegion << "->" << getDecl();
}
void ObjCIvarRegion::dumpToStream(llvm::raw_ostream& os) const {
- os << "ivar{" << superRegion << ',' << getDecl()->getNameAsString() << '}';
+ os << "ivar{" << superRegion << ',' << getDecl() << '}';
}
void StringRegion::dumpToStream(llvm::raw_ostream& os) const {
}
void VarRegion::dumpToStream(llvm::raw_ostream& os) const {
- os << cast<VarDecl>(D)->getNameAsString();
+ os << cast<VarDecl>(D);
}
void RegionRawOffset::dump() const {
else
os << "documented in CoreFoundation/CFError.h the parameter '";
- os << Param->getNameAsString() << "' may be null.";
+ os << Param << "' may be null.";
BugReport *report = new BugReport(*this, os.str(), *I);
// FIXME: Notable symbols are now part of the report. We should
if (I->second == Unused) {
std::string sbuf;
llvm::raw_string_ostream os(sbuf);
- os << "Instance variable '" << I->first->getNameAsString()
- << "' in class '" << ID->getNameAsString()
+ os << "Instance variable '" << I->first << "' in class '" << ID
<< "' is never used by the methods in its @implementation "
"(although it may be used by category methods).";
<< '[' << CD->getName();
if (const ObjCCategoryImplDecl *CID =
dyn_cast<ObjCCategoryImplDecl>(D->getDeclContext()))
- OS << '(' << CID->getNameAsString() << ')';
+ OS << '(' << CID << ')';
OS << ' ' << D->getSelector().getAsString() << ']';
}
assert (CD && "Missing container decl in GetNameForMethod");
OS << (MD->isInstanceMethod() ? '-' : '+') << '[' << CD->getName();
if (const ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(CD))
- OS << '(' << CID->getNameAsString() << ')';
+ OS << '(' << CID << ')';
OS << ' ' << MD->getSelector().getAsString() << ']';
Out << OS.str().size() << OS.str();
case Decl::Namespace: {
Out << "[namespace] ";
const NamespaceDecl* ND = cast<NamespaceDecl>(DC);
- Out << ND->getNameAsString();
+ Out << ND;
break;
}
case Decl::Enum: {
Out << "[enum] ";
else
Out << "<enum> ";
- Out << ED->getNameAsString();
+ Out << ED;
break;
}
case Decl::Record: {
Out << "[struct] ";
else
Out << "<struct> ";
- Out << RD->getNameAsString();
+ Out << RD;
break;
}
case Decl::CXXRecord: {
Out << "[class] ";
else
Out << "<class> ";
- Out << RD->getNameAsString() << " " << DC;
+ Out << RD << ' ' << DC;
break;
}
case Decl::ObjCMethod:
Out << "[function] ";
else
Out << "<function> ";
- Out << FD->getNameAsString();
+ Out << FD;
// Print the parameters.
Out << "(";
bool PrintComma = false;
Out << ", ";
else
PrintComma = true;
- Out << (*I)->getNameAsString();
+ Out << *I;
}
Out << ")";
break;
Out << "(c++ method) ";
else
Out << "<c++ method> ";
- Out << D->getNameAsString();
+ Out << D;
// Print the parameters.
Out << "(";
bool PrintComma = false;
Out << ", ";
else
PrintComma = true;
- Out << (*I)->getNameAsString();
+ Out << *I;
}
Out << ")";
Out << "(c++ ctor) ";
else
Out << "<c++ ctor> ";
- Out << D->getNameAsString();
+ Out << D;
// Print the parameters.
Out << "(";
bool PrintComma = false;
Out << ", ";
else
PrintComma = true;
- Out << (*I)->getNameAsString();
+ Out << *I;
}
Out << ")";
Out << "(c++ dtor) ";
else
Out << "<c++ dtor> ";
- Out << D->getNameAsString();
+ Out << D;
// Check the semantic DC.
const DeclContext* SemaDC = D->getDeclContext();
const DeclContext* LexicalDC = D->getLexicalDeclContext();
Out << "(c++ conversion) ";
else
Out << "<c++ conversion> ";
- Out << D->getNameAsString();
+ Out << D;
// Check the semantic DC.
const DeclContext* SemaDC = D->getDeclContext();
const DeclContext* LexicalDC = D->getLexicalDeclContext();
}
case Decl::Field: {
FieldDecl* FD = cast<FieldDecl>(*I);
- Out << "<field> " << FD->getNameAsString() << "\n";
+ Out << "<field> " << FD << '\n';
break;
}
case Decl::Typedef: {
TypedefDecl* TD = cast<TypedefDecl>(*I);
- Out << "<typedef> " << TD->getNameAsString() << "\n";
+ Out << "<typedef> " << TD << '\n';
break;
}
case Decl::EnumConstant: {
EnumConstantDecl* ECD = cast<EnumConstantDecl>(*I);
- Out << "<enum constant> " << ECD->getNameAsString() << "\n";
+ Out << "<enum constant> " << ECD << '\n';
break;
}
case Decl::Var: {
VarDecl* VD = cast<VarDecl>(*I);
- Out << "<var> " << VD->getNameAsString() << "\n";
+ Out << "<var> " << VD << '\n';
break;
}
case Decl::ImplicitParam: {
ImplicitParamDecl* IPD = cast<ImplicitParamDecl>(*I);
- Out << "<implicit parameter> " << IPD->getNameAsString() << "\n";
+ Out << "<implicit parameter> " << IPD << '\n';
break;
}
case Decl::ParmVar: {
ParmVarDecl* PVD = cast<ParmVarDecl>(*I);
- Out << "<parameter> " << PVD->getNameAsString() << "\n";
+ Out << "<parameter> " << PVD << '\n';
break;
}
case Decl::ObjCProperty: {
ObjCPropertyDecl* OPD = cast<ObjCPropertyDecl>(*I);
- Out << "<objc property> " << OPD->getNameAsString() << "\n";
+ Out << "<objc property> " << OPD << '\n';
break;
}
case Decl::FunctionTemplate: {
FunctionTemplateDecl* FTD = cast<FunctionTemplateDecl>(*I);
- Out << "<function template> " << FTD->getNameAsString() << "\n";
+ Out << "<function template> " << FTD << '\n';
break;
}
case Decl::FileScopeAsm: {
}
case Decl::NamespaceAlias: {
NamespaceAliasDecl* NAD = cast<NamespaceAliasDecl>(*I);
- Out << "<namespace alias> " << NAD->getNameAsString() << "\n";
+ Out << "<namespace alias> " << NAD << '\n';
break;
}
case Decl::ClassTemplate: {
ClassTemplateDecl *CTD = cast<ClassTemplateDecl>(*I);
- Out << "<class template> " << CTD->getNameAsString() << '\n';
+ Out << "<class template> " << CTD << '\n';
break;
}
default:
- Out << "DeclKind: " << DK << '"' << I->getDeclKindName() << "\"\n";
+ Out << "DeclKind: " << DK << '"' << *I << "\"\n";
assert(0 && "decl unhandled");
}
}
if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
const NamedDecl *ND = cast<NamedDecl>(D);
- llvm::errs() << ' ' << ND->getNameAsString() << '\n';
+ llvm::errs() << ' ' << ND << '\n';
}
else if (isa<BlockDecl>(D)) {
llvm::errs() << ' ' << "block(line:" << Loc.getLine() << ",col:"
case N_Decl:
OS << "[Decl: " << AsDecl()->getDeclKindName() << " ";
if (const NamedDecl *ND = dyn_cast<NamedDecl>(AsDecl()))
- OS << ND->getNameAsString();
+ OS << ND;
break;
case N_Stmt:
case N_NamedRef:
OS << "[NamedRef: " << AsNamedRef().ND->getDeclKindName() << " ";
- OS << AsNamedRef().ND->getNameAsString();
+ OS << AsNamedRef().ND;
break;
case N_Type: {
OS << "COMPLETION: ";
switch (Results[I].Kind) {
case Result::RK_Declaration:
- OS << Results[I].Declaration->getNameAsString() ;
+ OS << Results[I].Declaration;
if (Results[I].Hidden)
OS << " (Hidden)";
if (CodeCompletionString *CCS
break;
case SK_UserConversion:
- OS << "user-defined conversion via "
- << S->Function.Function->getNameAsString();
+ OS << "user-defined conversion via " << S->Function.Function;
break;
case SK_QualificationConversionRValue:
Before.DebugPrint();
OS << " -> ";
}
- OS << "'" << ConversionFunction->getNameAsString() << "'";
+ OS << '\'' << ConversionFunction << '\'';
if (After.First || After.Second || After.Third) {
OS << " -> ";
After.DebugPrint();
void USRGenerator::VisitFunctionDecl(FunctionDecl *D) {
VisitDeclContext(D->getDeclContext());
- Out << "@F@" << D->getNameAsString();
+ Out << "@F@" << D;
}
void USRGenerator::VisitNamedDecl(NamedDecl *D) {
void USRGenerator::VisitNamespaceDecl(NamespaceDecl *D) {
VisitDeclContext(D->getDeclContext());
- Out << "@N@" << D->getNameAsString();
+ Out << "@N@" << D;
}
void USRGenerator::VisitObjCMethodDecl(ObjCMethodDecl *D) {
if (s.empty()) {
if (TD)
- Out << '@' << TD->getNameAsString();
+ Out << '@' << TD;
}
else
Out << '@' << s;