aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-24 03:54:41 +0000
committerChris Lattner <sabre@nondot.org>2008-11-24 03:54:41 +0000
commit8ec03f58c33c33a917f54bb7f2cd61b6d7ffe0ca (patch)
treeab82837deaf7ca40831de4b7467d2d3c1982c9ff /lib/CodeGen/CGDebugInfo.cpp
parentbb49c3ee5d270485f4b273691fd14bc97403fa5d (diff)
Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier. Update callers to do the right thing and avoid this method in unsafe cases. This also fixes an objc warning that was missing a space, and migrates a couple more to taking IdentifierInfo and QualTypes instead of std::strings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59936 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 55ce237e14..444ee7c400 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -152,7 +152,7 @@ llvm::DIType CGDebugInfo::CreateType(const TypedefType *Ty,
// We don't set size information, but do specify where the typedef was
// declared.
- const char *TyName = Ty->getDecl()->getIdentifierName();
+ std::string TyName = Ty->getDecl()->getNameAsString();
SourceLocation DefLoc = Ty->getDecl()->getLocation();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
@@ -206,8 +206,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
SourceManager &SM = M->getContext().getSourceManager();
// Get overall information about the record type for the debug info.
- const char *Name = Decl->getIdentifierName();
- if (Name == 0) Name = "";
+ std::string Name = Decl->getNameAsString();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(Decl->getLocation());
uint64_t Line = SM.getLogicalLineNumber(Decl->getLocation());
@@ -241,9 +240,8 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
E = Decl->field_end(); I != E; ++I, ++FieldNo) {
FieldDecl *Field = *I;
llvm::DIType FieldTy = getOrCreateType(Field->getType(), Unit);
-
- const char *FieldName = Field->getIdentifierName();
- if (FieldName == 0) FieldName = "";
+
+ std::string FieldName = Field->getNameAsString();
// Get the location for the field.
SourceLocation FieldDefLoc = Field->getLocation();
@@ -301,8 +299,7 @@ llvm::DIType CGDebugInfo::CreateType(const EnumType *Ty,
llvm::DIArray EltArray =
DebugFactory.GetOrCreateArray(&Enumerators[0], Enumerators.size());
- const char *EnumName
- = Decl->getIdentifierName() ? Decl->getIdentifierName() : "";
+ std::string EnumName = Decl->getNameAsString();
SourceLocation DefLoc = Decl->getLocation();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
SourceManager &SM = M->getContext().getSourceManager();
@@ -516,7 +513,8 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
SourceManager &SM = M->getContext().getSourceManager();
uint64_t LineNo = SM.getLogicalLineNumber(Decl->getLocation());
- const char *Name = Decl->getIdentifierName();
+
+ std::string Name = Decl->getNameAsString();
DebugFactory.CreateGlobalVariable(Unit, Name, Name, "", Unit, LineNo,
getOrCreateType(Decl->getType(), Unit),