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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59947 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 0074a93..905c697 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -400,8 +400,8 @@
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 @@
EnumConstantDecl* D = dyn_cast<EnumConstantDecl>(DR->getDecl());
if (D) {
GetRawInt = false;
- os << D->getName();
+ os << D->getNameAsString();
}
}
diff --git a/lib/Analysis/CheckDeadStores.cpp b/lib/Analysis/CheckDeadStores.cpp
index 2afc7e0..51943d50 100644
--- a/lib/Analysis/CheckDeadStores.cpp
+++ b/lib/Analysis/CheckDeadStores.cpp
@@ -41,7 +41,7 @@
void Report(VarDecl* V, DeadStoreKind dsk, SourceLocation L, SourceRange R) {
- std::string name(V->getName());
+ std::string name = V->getNameAsString();
const char* BugType = 0;
std::string msg;
diff --git a/lib/Analysis/CheckNSError.cpp b/lib/Analysis/CheckNSError.cpp
index f76b601..919c17d 100644
--- a/lib/Analysis/CheckNSError.cpp
+++ b/lib/Analysis/CheckNSError.cpp
@@ -251,7 +251,7 @@
else
os << "documented in CoreFoundation/CFError.h the parameter '";
- os << Param->getName() << "' may be null.";
+ os << Param->getNameAsString() << "' may be null.";
desc = os.str().c_str();
BR.addNotableSymbol(SV->getSymbol());
diff --git a/lib/Analysis/CheckObjCDealloc.cpp b/lib/Analysis/CheckObjCDealloc.cpp
index 6fba9ae..a9e5675 100644
--- a/lib/Analysis/CheckObjCDealloc.cpp
+++ b/lib/Analysis/CheckObjCDealloc.cpp
@@ -149,7 +149,7 @@
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 @@
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 @@
? "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 @@
? "extra ivar release (use-after-release)"
: "extra ivar release (Hybrid MM, non-GC)";
- os << "The '" << ID->getName()
+ os << "The '" << ID->getNameAsString()
<< "' instance variable was not retained by a synthesized property "
"but was released in 'dealloc'";
}
diff --git a/lib/Analysis/CheckObjCInstMethSignature.cpp b/lib/Analysis/CheckObjCInstMethSignature.cpp
index 00dbe9f..2d10079 100644
--- a/lib/Analysis/CheckObjCInstMethSignature.cpp
+++ b/lib/Analysis/CheckObjCInstMethSignature.cpp
@@ -49,16 +49,16 @@
std::ostringstream os;
os << "The Objective-C class '"
- << MethDerived->getClassInterface()->getName()
+ << MethDerived->getClassInterface()->getNameAsString()
<< "', which is derived from class '"
- << MethAncestor->getClassInterface()->getName()
+ << MethAncestor->getClassInterface()->getNameAsString()
<< "', defines the instance method '"
<< MethDerived->getSelector().getAsString()
<< "' whose return type is '"
<< ResDerived.getAsString()
<< "'. A method with the same name (same selector) is also defined in "
"class '"
- << MethAncestor->getClassInterface()->getName()
+ << MethAncestor->getClassInterface()->getNameAsString()
<< "' and has a return type of '"
<< ResAncestor.getAsString()
<< "'. These two types are incompatible, and may result in undefined "
diff --git a/lib/Analysis/CheckObjCUnusedIVars.cpp b/lib/Analysis/CheckObjCUnusedIVars.cpp
index c2deeef..ef7b318 100644
--- a/lib/Analysis/CheckObjCUnusedIVars.cpp
+++ b/lib/Analysis/CheckObjCUnusedIVars.cpp
@@ -98,8 +98,8 @@
if (I->second == Unused) {
std::ostringstream os;
- os << "Instance variable '" << I->first->getName()
- << "' in class '" << ID->getName()
+ os << "Instance variable '" << I->first->getNameAsString()
+ << "' in class '" << ID->getNameAsString()
<< "' is never used by the methods in its @implementation "
"(although it may be used by category methods).";
diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp
index 28a27b0..86f8571 100644
--- a/lib/Analysis/MemRegion.cpp
+++ b/lib/Analysis/MemRegion.cpp
@@ -145,7 +145,7 @@
}
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 FieldRegion::print(llvm::raw_ostream& os) const {
superRegion->print(os);
- os << "->" << getDecl()->getName();
+ os << "->" << getDecl()->getNameAsString();
}
void ElementRegion::print(llvm::raw_ostream& os) const {