mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Remove std::string uses from DebugInfo interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83083 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1e9a727f10
commit
5ccdd10b1a
@ -53,7 +53,7 @@ namespace llvm {
|
||||
/// not, the debug info is corrupt and we ignore it.
|
||||
DIDescriptor(MDNode *N, unsigned RequiredTag);
|
||||
|
||||
const std::string &getStringField(unsigned Elt, std::string &Result) const;
|
||||
const char *getStringField(unsigned Elt) const;
|
||||
unsigned getUnsignedField(unsigned Elt) const {
|
||||
return (unsigned)getUInt64Field(Elt);
|
||||
}
|
||||
@ -131,13 +131,8 @@ namespace llvm {
|
||||
}
|
||||
virtual ~DIScope() {}
|
||||
|
||||
virtual const std::string &getFilename(std::string &F) const {
|
||||
return F;
|
||||
}
|
||||
|
||||
virtual const std::string &getDirectory(std::string &D) const {
|
||||
return D;
|
||||
}
|
||||
virtual const char *getFilename() const { return NULL; }
|
||||
virtual const char *getDirectory() const { return NULL; }
|
||||
};
|
||||
|
||||
/// DICompileUnit - A wrapper for a compile unit.
|
||||
@ -149,15 +144,9 @@ namespace llvm {
|
||||
}
|
||||
|
||||
unsigned getLanguage() const { return getUnsignedField(2); }
|
||||
const std::string &getFilename(std::string &F) const {
|
||||
return getStringField(3, F);
|
||||
}
|
||||
const std::string &getDirectory(std::string &F) const {
|
||||
return getStringField(4, F);
|
||||
}
|
||||
const std::string &getProducer(std::string &F) const {
|
||||
return getStringField(5, F);
|
||||
}
|
||||
const char *getFilename() const { return getStringField(3); }
|
||||
const char *getDirectory() const { return getStringField(4); }
|
||||
const char *getProducer() const { return getStringField(5); }
|
||||
|
||||
/// isMain - Each input file is encoded as a separate compile unit in LLVM
|
||||
/// debugging information output. However, many target specific tool chains
|
||||
@ -170,9 +159,7 @@ namespace llvm {
|
||||
|
||||
bool isMain() const { return getUnsignedField(6); }
|
||||
bool isOptimized() const { return getUnsignedField(7); }
|
||||
const std::string &getFlags(std::string &F) const {
|
||||
return getStringField(8, F);
|
||||
}
|
||||
const char *getFlags() const { return getStringField(8); }
|
||||
unsigned getRunTimeVersion() const { return getUnsignedField(9); }
|
||||
|
||||
/// Verify - Verify that a compile unit is well formed.
|
||||
@ -190,10 +177,8 @@ namespace llvm {
|
||||
explicit DIEnumerator(MDNode *N = 0)
|
||||
: DIDescriptor(N, dwarf::DW_TAG_enumerator) {}
|
||||
|
||||
const std::string &getName(std::string &F) const {
|
||||
return getStringField(1, F);
|
||||
}
|
||||
uint64_t getEnumValue() const { return getUInt64Field(2); }
|
||||
const char *getName() const { return getStringField(1); }
|
||||
uint64_t getEnumValue() const { return getUInt64Field(2); }
|
||||
};
|
||||
|
||||
/// DIType - This is a wrapper for a type.
|
||||
@ -226,9 +211,7 @@ namespace llvm {
|
||||
virtual ~DIType() {}
|
||||
|
||||
DIDescriptor getContext() const { return getDescriptorField(1); }
|
||||
const std::string &getName(std::string &F) const {
|
||||
return getStringField(2, F);
|
||||
}
|
||||
const char *getName() const { return getStringField(2); }
|
||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
||||
unsigned getLineNumber() const { return getUnsignedField(4); }
|
||||
uint64_t getSizeInBits() const { return getUInt64Field(5); }
|
||||
@ -328,15 +311,9 @@ namespace llvm {
|
||||
virtual ~DIGlobal() {}
|
||||
|
||||
DIDescriptor getContext() const { return getDescriptorField(2); }
|
||||
const std::string &getName(std::string &F) const {
|
||||
return getStringField(3, F);
|
||||
}
|
||||
const std::string &getDisplayName(std::string &F) const {
|
||||
return getStringField(4, F);
|
||||
}
|
||||
const std::string &getLinkageName(std::string &F) const {
|
||||
return getStringField(5, F);
|
||||
}
|
||||
const char *getName() const { return getStringField(3); }
|
||||
const char *getDisplayName() const { return getStringField(4); }
|
||||
const char *getLinkageName() const { return getStringField(5); }
|
||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
|
||||
unsigned getLineNumber() const { return getUnsignedField(7); }
|
||||
DIType getType() const { return getFieldAs<DIType>(8); }
|
||||
@ -359,43 +336,32 @@ namespace llvm {
|
||||
}
|
||||
|
||||
DIDescriptor getContext() const { return getDescriptorField(2); }
|
||||
const std::string &getName(std::string &F) const {
|
||||
return getStringField(3, F);
|
||||
}
|
||||
const std::string &getDisplayName(std::string &F) const {
|
||||
return getStringField(4, F);
|
||||
}
|
||||
const std::string &getLinkageName(std::string &F) const {
|
||||
return getStringField(5, F);
|
||||
}
|
||||
const char *getName() const { return getStringField(3); }
|
||||
const char *getDisplayName() const { return getStringField(4); }
|
||||
const char *getLinkageName() const { return getStringField(5); }
|
||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(6); }
|
||||
unsigned getLineNumber() const { return getUnsignedField(7); }
|
||||
DICompositeType getType() const { return getFieldAs<DICompositeType>(8); }
|
||||
|
||||
/// getReturnTypeName - Subprogram return types are encoded either as
|
||||
/// DIType or as DICompositeType.
|
||||
const std::string &getReturnTypeName(std::string &F) const {
|
||||
const char *getReturnTypeName() const {
|
||||
DICompositeType DCT(getFieldAs<DICompositeType>(8));
|
||||
if (!DCT.isNull()) {
|
||||
DIArray A = DCT.getTypeArray();
|
||||
DIType T(A.getElement(0).getNode());
|
||||
return T.getName(F);
|
||||
return T.getName();
|
||||
}
|
||||
DIType T(getFieldAs<DIType>(8));
|
||||
return T.getName(F);
|
||||
return T.getName();
|
||||
}
|
||||
|
||||
/// isLocalToUnit - Return true if this subprogram is local to the current
|
||||
/// compile unit, like 'static' in C.
|
||||
unsigned isLocalToUnit() const { return getUnsignedField(9); }
|
||||
unsigned isDefinition() const { return getUnsignedField(10); }
|
||||
|
||||
const std::string &getFilename(std::string &F) const {
|
||||
return getCompileUnit().getFilename(F);
|
||||
}
|
||||
const std::string &getDirectory(std::string &F) const {
|
||||
return getCompileUnit().getDirectory(F);
|
||||
}
|
||||
unsigned isLocalToUnit() const { return getUnsignedField(9); }
|
||||
unsigned isDefinition() const { return getUnsignedField(10); }
|
||||
const char *getFilename() const { return getCompileUnit().getFilename();}
|
||||
const char *getDirectory() const { return getCompileUnit().getDirectory();}
|
||||
|
||||
/// Verify - Verify that a subprogram descriptor is well formed.
|
||||
bool Verify() const;
|
||||
@ -434,9 +400,7 @@ namespace llvm {
|
||||
}
|
||||
|
||||
DIDescriptor getContext() const { return getDescriptorField(1); }
|
||||
const std::string &getName(std::string &F) const {
|
||||
return getStringField(2, F);
|
||||
}
|
||||
const char *getName() const { return getStringField(2); }
|
||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
||||
unsigned getLineNumber() const { return getUnsignedField(4); }
|
||||
DIType getType() const { return getFieldAs<DIType>(5); }
|
||||
@ -462,14 +426,8 @@ namespace llvm {
|
||||
if (DbgNode && !isLexicalBlock())
|
||||
DbgNode = 0;
|
||||
}
|
||||
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
||||
|
||||
const std::string &getFilename(std::string &F) const {
|
||||
return getContext().getFilename(F);
|
||||
}
|
||||
const std::string &getDirectory(std::string &D) const {
|
||||
return getContext().getDirectory(D);
|
||||
}
|
||||
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
||||
const char *getFilename() const { return getContext().getFilename(); }
|
||||
};
|
||||
|
||||
/// DILocation - This object holds location information. This object
|
||||
@ -480,14 +438,10 @@ namespace llvm {
|
||||
|
||||
unsigned getLineNumber() const { return getUnsignedField(0); }
|
||||
unsigned getColumnNumber() const { return getUnsignedField(1); }
|
||||
DIScope getScope() const { return getFieldAs<DIScope>(3); }
|
||||
DILocation getOrigLocation() const { return getFieldAs<DILocation>(4); }
|
||||
std::string getFilename(std::string &F) const {
|
||||
return getScope().getFilename(F);
|
||||
}
|
||||
std::string getDirectory(std::string &D) const {
|
||||
return getScope().getDirectory(D);
|
||||
}
|
||||
DIScope getScope() const { return getFieldAs<DIScope>(2); }
|
||||
DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); }
|
||||
const char *getFilename() const { return getScope().getFilename(); }
|
||||
const char *getDirectory() const { return getScope().getDirectory(); }
|
||||
};
|
||||
|
||||
/// DIFactory - This object assists with the construction of the various
|
||||
@ -522,19 +476,19 @@ namespace llvm {
|
||||
/// CreateCompileUnit - Create a new descriptor for the specified compile
|
||||
/// unit.
|
||||
DICompileUnit CreateCompileUnit(unsigned LangID,
|
||||
const std::string &Filename,
|
||||
const std::string &Directory,
|
||||
const std::string &Producer,
|
||||
StringRef Filenae,
|
||||
StringRef Directory,
|
||||
StringRef Producer,
|
||||
bool isMain = false,
|
||||
bool isOptimized = false,
|
||||
const char *Flags = "",
|
||||
unsigned RunTimeVer = 0);
|
||||
|
||||
/// CreateEnumerator - Create a single enumerator value.
|
||||
DIEnumerator CreateEnumerator(const std::string &Name, uint64_t Val);
|
||||
DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
|
||||
|
||||
/// CreateBasicType - Create a basic type like int, float, etc.
|
||||
DIBasicType CreateBasicType(DIDescriptor Context, const std::string &Name,
|
||||
DIBasicType CreateBasicType(DIDescriptor Context, StringRef Name,
|
||||
DICompileUnit CompileUnit, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
@ -543,7 +497,7 @@ namespace llvm {
|
||||
/// CreateDerivedType - Create a derived type like const qualified type,
|
||||
/// pointer, typedef, etc.
|
||||
DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
|
||||
const std::string &Name,
|
||||
StringRef Name,
|
||||
DICompileUnit CompileUnit,
|
||||
unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
@ -552,7 +506,7 @@ namespace llvm {
|
||||
|
||||
/// CreateCompositeType - Create a composite type like array, struct, etc.
|
||||
DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
|
||||
const std::string &Name,
|
||||
StringRef Name,
|
||||
DICompileUnit CompileUnit,
|
||||
unsigned LineNumber,
|
||||
uint64_t SizeInBits,
|
||||
@ -564,25 +518,25 @@ namespace llvm {
|
||||
|
||||
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
|
||||
/// See comments in DISubprogram for descriptions of these fields.
|
||||
DISubprogram CreateSubprogram(DIDescriptor Context, const std::string &Name,
|
||||
const std::string &DisplayName,
|
||||
const std::string &LinkageName,
|
||||
DISubprogram CreateSubprogram(DIDescriptor Context, StringRef Name,
|
||||
StringRef DisplayName,
|
||||
StringRef LinkageName,
|
||||
DICompileUnit CompileUnit, unsigned LineNo,
|
||||
DIType Type, bool isLocalToUnit,
|
||||
bool isDefinition);
|
||||
|
||||
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
||||
DIGlobalVariable
|
||||
CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
|
||||
const std::string &DisplayName,
|
||||
const std::string &LinkageName,
|
||||
CreateGlobalVariable(DIDescriptor Context, StringRef Name,
|
||||
StringRef DisplayName,
|
||||
StringRef LinkageName,
|
||||
DICompileUnit CompileUnit,
|
||||
unsigned LineNo, DIType Type, bool isLocalToUnit,
|
||||
bool isDefinition, llvm::GlobalVariable *GV);
|
||||
|
||||
/// CreateVariable - Create a new descriptor for the specified variable.
|
||||
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
|
||||
const std::string &Name,
|
||||
StringRef Name,
|
||||
DICompileUnit CompileUnit, unsigned LineNo,
|
||||
DIType Type);
|
||||
|
||||
@ -633,9 +587,9 @@ namespace llvm {
|
||||
/// Find the debug info descriptor corresponding to this global variable.
|
||||
Value *findDbgGlobalDeclare(GlobalVariable *V);
|
||||
|
||||
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
||||
std::string &Type, unsigned &LineNo, std::string &File,
|
||||
std::string &Dir);
|
||||
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
||||
std::string &Type, unsigned &LineNo, std::string &File,
|
||||
std::string &Dir);
|
||||
|
||||
/// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
|
||||
/// info intrinsic.
|
||||
|
@ -91,9 +91,8 @@ void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI) {
|
||||
|
||||
void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) {
|
||||
DISubprogram Subprogram(FS->getSubprogram());
|
||||
std::string Res1, Res2;
|
||||
Out << "; fully qualified function name: " << Subprogram.getDisplayName(Res1)
|
||||
<< " return type: " << Subprogram.getReturnTypeName(Res2)
|
||||
Out << "; fully qualified function name: " << Subprogram.getDisplayName()
|
||||
<< " return type: " << Subprogram.getReturnTypeName()
|
||||
<< " at line " << Subprogram.getLineNumber()
|
||||
<< "\n\n";
|
||||
}
|
||||
|
@ -78,19 +78,16 @@ DIDescriptor::DIDescriptor(MDNode *N, unsigned RequiredTag) {
|
||||
}
|
||||
}
|
||||
|
||||
const std::string &
|
||||
DIDescriptor::getStringField(unsigned Elt, std::string &Result) const {
|
||||
Result.clear();
|
||||
const char *
|
||||
DIDescriptor::getStringField(unsigned Elt) const {
|
||||
if (DbgNode == 0)
|
||||
return Result;
|
||||
return NULL;
|
||||
|
||||
if (Elt < DbgNode->getNumElements())
|
||||
if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getElement(Elt))) {
|
||||
Result.assign(MDS->begin(), MDS->begin() + MDS->length());
|
||||
return Result;
|
||||
}
|
||||
if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getElement(Elt)))
|
||||
return MDS->getString().data();
|
||||
|
||||
return Result;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
|
||||
@ -284,8 +281,8 @@ void DIDerivedType::replaceAllUsesWith(DIDescriptor &D) {
|
||||
bool DICompileUnit::Verify() const {
|
||||
if (isNull())
|
||||
return false;
|
||||
std::string Res;
|
||||
if (getFilename(Res).empty())
|
||||
const char *N = getFilename();
|
||||
if (!N)
|
||||
return false;
|
||||
// It is possible that directory and produce string is empty.
|
||||
return true;
|
||||
@ -387,11 +384,10 @@ uint64_t DIDerivedType::getOriginalTypeSize() const {
|
||||
/// information for the function F.
|
||||
bool DISubprogram::describes(const Function *F) {
|
||||
assert (F && "Invalid function");
|
||||
std::string Name;
|
||||
getLinkageName(Name);
|
||||
if (Name.empty())
|
||||
getName(Name);
|
||||
if (F->getName() == Name)
|
||||
const char *Name = getLinkageName();
|
||||
if (!Name)
|
||||
Name = getName();
|
||||
if (strcmp(F->getName().data(), Name) == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -412,16 +408,14 @@ void DICompileUnit::dump() const {
|
||||
if (getLanguage())
|
||||
errs() << " [" << dwarf::LanguageString(getLanguage()) << "] ";
|
||||
|
||||
std::string Res1, Res2;
|
||||
errs() << " [" << getDirectory(Res1) << "/" << getFilename(Res2) << " ]";
|
||||
errs() << " [" << getDirectory() << "/" << getFilename() << " ]";
|
||||
}
|
||||
|
||||
/// dump - Print type.
|
||||
void DIType::dump() const {
|
||||
if (isNull()) return;
|
||||
|
||||
std::string Res;
|
||||
if (!getName(Res).empty())
|
||||
if (const char *Res = getName())
|
||||
errs() << " [" << Res << "] ";
|
||||
|
||||
unsigned Tag = getTag();
|
||||
@ -478,8 +472,7 @@ void DICompositeType::dump() const {
|
||||
|
||||
/// dump - Print global.
|
||||
void DIGlobal::dump() const {
|
||||
std::string Res;
|
||||
if (!getName(Res).empty())
|
||||
if (const char *Res = getName())
|
||||
errs() << " [" << Res << "] ";
|
||||
|
||||
unsigned Tag = getTag();
|
||||
@ -503,8 +496,7 @@ void DIGlobal::dump() const {
|
||||
|
||||
/// dump - Print subprogram.
|
||||
void DISubprogram::dump() const {
|
||||
std::string Res;
|
||||
if (!getName(Res).empty())
|
||||
if (const char *Res = getName())
|
||||
errs() << " [" << Res << "] ";
|
||||
|
||||
unsigned Tag = getTag();
|
||||
@ -532,8 +524,7 @@ void DIGlobalVariable::dump() const {
|
||||
|
||||
/// dump - Print variable.
|
||||
void DIVariable::dump() const {
|
||||
std::string Res;
|
||||
if (!getName(Res).empty())
|
||||
if (const char *Res = getName())
|
||||
errs() << " [" << Res << "] ";
|
||||
|
||||
getCompileUnit().dump();
|
||||
@ -594,9 +585,9 @@ DISubrange DIFactory::GetOrCreateSubrange(int64_t Lo, int64_t Hi) {
|
||||
/// CreateCompileUnit - Create a new descriptor for the specified compile
|
||||
/// unit. Note that this does not unique compile units within the module.
|
||||
DICompileUnit DIFactory::CreateCompileUnit(unsigned LangID,
|
||||
const std::string &Filename,
|
||||
const std::string &Directory,
|
||||
const std::string &Producer,
|
||||
StringRef Filename,
|
||||
StringRef Directory,
|
||||
StringRef Producer,
|
||||
bool isMain,
|
||||
bool isOptimized,
|
||||
const char *Flags,
|
||||
@ -618,7 +609,7 @@ DICompileUnit DIFactory::CreateCompileUnit(unsigned LangID,
|
||||
}
|
||||
|
||||
/// CreateEnumerator - Create a single enumerator value.
|
||||
DIEnumerator DIFactory::CreateEnumerator(const std::string &Name, uint64_t Val){
|
||||
DIEnumerator DIFactory::CreateEnumerator(StringRef Name, uint64_t Val){
|
||||
Value *Elts[] = {
|
||||
GetTagConstant(dwarf::DW_TAG_enumerator),
|
||||
MDString::get(VMContext, Name),
|
||||
@ -630,7 +621,7 @@ DIEnumerator DIFactory::CreateEnumerator(const std::string &Name, uint64_t Val){
|
||||
|
||||
/// CreateBasicType - Create a basic type like int, float, etc.
|
||||
DIBasicType DIFactory::CreateBasicType(DIDescriptor Context,
|
||||
const std::string &Name,
|
||||
StringRef Name,
|
||||
DICompileUnit CompileUnit,
|
||||
unsigned LineNumber,
|
||||
uint64_t SizeInBits,
|
||||
@ -656,7 +647,7 @@ DIBasicType DIFactory::CreateBasicType(DIDescriptor Context,
|
||||
/// pointer, typedef, etc.
|
||||
DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
|
||||
DIDescriptor Context,
|
||||
const std::string &Name,
|
||||
StringRef Name,
|
||||
DICompileUnit CompileUnit,
|
||||
unsigned LineNumber,
|
||||
uint64_t SizeInBits,
|
||||
@ -682,7 +673,7 @@ DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
|
||||
/// CreateCompositeType - Create a composite type like array, struct, etc.
|
||||
DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
|
||||
DIDescriptor Context,
|
||||
const std::string &Name,
|
||||
StringRef Name,
|
||||
DICompileUnit CompileUnit,
|
||||
unsigned LineNumber,
|
||||
uint64_t SizeInBits,
|
||||
@ -715,9 +706,9 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
|
||||
/// See comments in DISubprogram for descriptions of these fields. This
|
||||
/// method does not unique the generated descriptors.
|
||||
DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
||||
const std::string &Name,
|
||||
const std::string &DisplayName,
|
||||
const std::string &LinkageName,
|
||||
StringRef Name,
|
||||
StringRef DisplayName,
|
||||
StringRef LinkageName,
|
||||
DICompileUnit CompileUnit,
|
||||
unsigned LineNo, DIType Type,
|
||||
bool isLocalToUnit,
|
||||
@ -741,9 +732,9 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
||||
|
||||
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
||||
DIGlobalVariable
|
||||
DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
|
||||
const std::string &DisplayName,
|
||||
const std::string &LinkageName,
|
||||
DIFactory::CreateGlobalVariable(DIDescriptor Context, StringRef Name,
|
||||
StringRef DisplayName,
|
||||
StringRef LinkageName,
|
||||
DICompileUnit CompileUnit,
|
||||
unsigned LineNo, DIType Type,bool isLocalToUnit,
|
||||
bool isDefinition, llvm::GlobalVariable *Val) {
|
||||
@ -775,7 +766,7 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
|
||||
|
||||
/// CreateVariable - Create a new descriptor for the specified variable.
|
||||
DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
|
||||
const std::string &Name,
|
||||
StringRef Name,
|
||||
DICompileUnit CompileUnit, unsigned LineNo,
|
||||
DIType Type) {
|
||||
Value *Elts[] = {
|
||||
@ -1127,8 +1118,8 @@ namespace llvm {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
||||
std::string &Type, unsigned &LineNo, std::string &File,
|
||||
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
||||
std::string &Type, unsigned &LineNo, std::string &File,
|
||||
std::string &Dir) {
|
||||
DICompileUnit Unit;
|
||||
DIType TypeD;
|
||||
@ -1138,7 +1129,8 @@ namespace llvm {
|
||||
if (!DIGV) return false;
|
||||
DIGlobalVariable Var(cast<MDNode>(DIGV));
|
||||
|
||||
Var.getDisplayName(DisplayName);
|
||||
if (const char *D = Var.getDisplayName())
|
||||
DisplayName = D;
|
||||
LineNo = Var.getLineNumber();
|
||||
Unit = Var.getCompileUnit();
|
||||
TypeD = Var.getType();
|
||||
@ -1147,15 +1139,19 @@ namespace llvm {
|
||||
if (!DDI) return false;
|
||||
DIVariable Var(cast<MDNode>(DDI->getVariable()));
|
||||
|
||||
Var.getName(DisplayName);
|
||||
if (const char *D = Var.getName())
|
||||
DisplayName = D;
|
||||
LineNo = Var.getLineNumber();
|
||||
Unit = Var.getCompileUnit();
|
||||
TypeD = Var.getType();
|
||||
}
|
||||
|
||||
TypeD.getName(Type);
|
||||
Unit.getFilename(File);
|
||||
Unit.getDirectory(Dir);
|
||||
if (const char *T = TypeD.getName())
|
||||
Type = T;
|
||||
if (const char *F = Unit.getFilename())
|
||||
File = F;
|
||||
if (const char *D = Unit.getDirectory())
|
||||
Dir = D;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1750,9 +1750,8 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString() << " SrcLine ";
|
||||
if (DLT.CompileUnit) {
|
||||
std::string Str;
|
||||
DICompileUnit CU(DLT.CompileUnit);
|
||||
O << CU.getFilename(Str) << " ";
|
||||
O << CU.getFilename() << " ";
|
||||
}
|
||||
O << DLT.Line;
|
||||
if (DLT.Col != 0)
|
||||
|
@ -570,9 +570,7 @@ DIType DwarfDebug::GetBlockByrefType(DIType Ty, std::string Name) {
|
||||
for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
|
||||
DIDescriptor Element = Elements.getElement(i);
|
||||
DIDerivedType DT = DIDerivedType(Element.getNode());
|
||||
std::string Name2;
|
||||
DT.getName(Name2);
|
||||
if (Name == Name2)
|
||||
if (strcmp(Name.c_str(), DT.getName()) == 0)
|
||||
return (DT.getTypeDerivedFrom());
|
||||
}
|
||||
|
||||
@ -648,8 +646,7 @@ void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
||||
unsigned Tag = Ty.getTag();
|
||||
bool isPointer = false;
|
||||
|
||||
std::string varName;
|
||||
VD.getName(varName);
|
||||
const char *varName = VD.getName();
|
||||
|
||||
if (Tag == dwarf::DW_TAG_pointer_type) {
|
||||
DIDerivedType DTy = DIDerivedType (Ty.getNode());
|
||||
@ -659,9 +656,6 @@ void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
||||
|
||||
DICompositeType blockStruct = DICompositeType(TmpTy.getNode());
|
||||
|
||||
std::string typeName;
|
||||
blockStruct.getName(typeName);
|
||||
|
||||
// Find the __forwarding field and the variable field in the __Block_byref
|
||||
// struct.
|
||||
DIArray Fields = blockStruct.getTypeArray();
|
||||
@ -672,11 +666,10 @@ void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
||||
for (unsigned i = 0, N = Fields.getNumElements(); i < N; ++i) {
|
||||
DIDescriptor Element = Fields.getElement(i);
|
||||
DIDerivedType DT = DIDerivedType(Element.getNode());
|
||||
std::string fieldName;
|
||||
DT.getName(fieldName);
|
||||
if (fieldName == "__forwarding")
|
||||
const char *fieldName = DT.getName();
|
||||
if (strcmp(fieldName, "__forwarding") == 0)
|
||||
forwardingField = Element;
|
||||
else if (fieldName == varName)
|
||||
else if (strcmp(fieldName, varName) == 0)
|
||||
varField = Element;
|
||||
}
|
||||
|
||||
@ -823,14 +816,13 @@ void DwarfDebug::AddType(CompileUnit *DW_Unit, DIE *Entity, DIType Ty) {
|
||||
void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||
DIBasicType BTy) {
|
||||
// Get core information.
|
||||
std::string Name;
|
||||
BTy.getName(Name);
|
||||
const char *Name = BTy.getName();
|
||||
Buffer.setTag(dwarf::DW_TAG_base_type);
|
||||
AddUInt(&Buffer, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,
|
||||
BTy.getEncoding());
|
||||
|
||||
// Add name if not anonymous or intermediate type.
|
||||
if (!Name.empty())
|
||||
if (Name)
|
||||
AddString(&Buffer, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||
uint64_t Size = BTy.getSizeInBits() >> 3;
|
||||
AddUInt(&Buffer, dwarf::DW_AT_byte_size, 0, Size);
|
||||
@ -840,8 +832,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||
void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||
DIDerivedType DTy) {
|
||||
// Get core information.
|
||||
std::string Name;
|
||||
DTy.getName(Name);
|
||||
const char *Name = DTy.getName();
|
||||
uint64_t Size = DTy.getSizeInBits() >> 3;
|
||||
unsigned Tag = DTy.getTag();
|
||||
|
||||
@ -855,7 +846,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||
AddType(DW_Unit, &Buffer, FromTy);
|
||||
|
||||
// Add name if not anonymous or intermediate type.
|
||||
if (!Name.empty())
|
||||
if (Name)
|
||||
AddString(&Buffer, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||
|
||||
// Add size if non-zero (derived types might be zero-sized.)
|
||||
@ -871,8 +862,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||
void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||
DICompositeType CTy) {
|
||||
// Get core information.
|
||||
std::string Name;
|
||||
CTy.getName(Name);
|
||||
const char *Name = CTy.getName();
|
||||
|
||||
uint64_t Size = CTy.getSizeInBits() >> 3;
|
||||
unsigned Tag = CTy.getTag();
|
||||
@ -952,7 +942,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||
}
|
||||
|
||||
// Add name if not anonymous or intermediate type.
|
||||
if (!Name.empty())
|
||||
if (Name)
|
||||
AddString(&Buffer, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||
|
||||
if (Tag == dwarf::DW_TAG_enumeration_type ||
|
||||
@ -1018,8 +1008,7 @@ void DwarfDebug::ConstructArrayTypeDIE(CompileUnit *DW_Unit, DIE &Buffer,
|
||||
/// ConstructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
|
||||
DIE *DwarfDebug::ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) {
|
||||
DIE *Enumerator = new DIE(dwarf::DW_TAG_enumerator);
|
||||
std::string Name;
|
||||
ETy->getName(Name);
|
||||
const char *Name = ETy->getName();
|
||||
AddString(Enumerator, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||
int64_t Value = ETy->getEnumValue();
|
||||
AddSInt(Enumerator, dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, Value);
|
||||
@ -1030,12 +1019,11 @@ DIE *DwarfDebug::ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) {
|
||||
DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
|
||||
const DIGlobalVariable &GV) {
|
||||
DIE *GVDie = new DIE(dwarf::DW_TAG_variable);
|
||||
std::string Name;
|
||||
GV.getDisplayName(Name);
|
||||
AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||
std::string LinkageName;
|
||||
GV.getLinkageName(LinkageName);
|
||||
if (!LinkageName.empty()) {
|
||||
AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string,
|
||||
GV.getDisplayName());
|
||||
|
||||
const char *LinkageName = GV.getLinkageName();
|
||||
if (LinkageName) {
|
||||
// Skip special LLVM prefix that is used to inform the asm printer to not
|
||||
// emit usual symbol prefix before the symbol name. This happens for
|
||||
// Objective-C symbol names and symbol whose name is replaced using GCC's
|
||||
@ -1055,9 +1043,7 @@ DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
|
||||
/// CreateMemberDIE - Create new member DIE.
|
||||
DIE *DwarfDebug::CreateMemberDIE(CompileUnit *DW_Unit, const DIDerivedType &DT){
|
||||
DIE *MemberDie = new DIE(DT.getTag());
|
||||
std::string Name;
|
||||
DT.getName(Name);
|
||||
if (!Name.empty())
|
||||
if (const char *Name = DT.getName())
|
||||
AddString(MemberDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||
|
||||
AddType(DW_Unit, MemberDie, DT.getTypeDerivedFrom());
|
||||
@ -1106,13 +1092,11 @@ DIE *DwarfDebug::CreateSubprogramDIE(CompileUnit *DW_Unit,
|
||||
bool IsInlined) {
|
||||
DIE *SPDie = new DIE(dwarf::DW_TAG_subprogram);
|
||||
|
||||
std::string Name;
|
||||
SP.getName(Name);
|
||||
const char * Name = SP.getName();
|
||||
AddString(SPDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||
|
||||
std::string LinkageName;
|
||||
SP.getLinkageName(LinkageName);
|
||||
if (!LinkageName.empty()) {
|
||||
const char *LinkageName = SP.getLinkageName();
|
||||
if (LinkageName) {
|
||||
// Skip special LLVM prefix that is used to inform the asm printer to not emit
|
||||
// usual symbol prefix before the symbol name. This happens for Objective-C
|
||||
// symbol names and symbol whose name is replaced using GCC's __asm__ attribute.
|
||||
@ -1196,8 +1180,7 @@ DIE *DwarfDebug::CreateDbgScopeVariable(DbgVariable *DV, CompileUnit *Unit) {
|
||||
|
||||
// Define variable debug information entry.
|
||||
DIE *VariableDie = new DIE(Tag);
|
||||
std::string Name;
|
||||
VD.getName(Name);
|
||||
const char *Name = VD.getName();
|
||||
AddString(VariableDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
|
||||
|
||||
// Add source line info if available.
|
||||
@ -1398,8 +1381,8 @@ void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) {
|
||||
/// source file names. If none currently exists, create a new id and insert it
|
||||
/// in the SourceIds map. This can update DirectoryNames and SourceFileNames
|
||||
/// maps as well.
|
||||
unsigned DwarfDebug::GetOrCreateSourceID(const std::string &DirName,
|
||||
const std::string &FileName) {
|
||||
unsigned DwarfDebug::GetOrCreateSourceID(const char *DirName,
|
||||
const char *FileName) {
|
||||
unsigned DId;
|
||||
StringMap<unsigned>::iterator DI = DirectoryIdMap.find(DirName);
|
||||
if (DI != DirectoryIdMap.end()) {
|
||||
@ -1434,28 +1417,26 @@ unsigned DwarfDebug::GetOrCreateSourceID(const std::string &DirName,
|
||||
|
||||
void DwarfDebug::ConstructCompileUnit(MDNode *N) {
|
||||
DICompileUnit DIUnit(N);
|
||||
std::string Dir, FN, Prod;
|
||||
unsigned ID = GetOrCreateSourceID(DIUnit.getDirectory(Dir),
|
||||
DIUnit.getFilename(FN));
|
||||
const char *FN = DIUnit.getFilename();
|
||||
const char *Dir = DIUnit.getDirectory();
|
||||
unsigned ID = GetOrCreateSourceID(Dir, FN);
|
||||
|
||||
DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);
|
||||
AddSectionOffset(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
|
||||
DWLabel("section_line", 0), DWLabel("section_line", 0),
|
||||
false);
|
||||
AddString(Die, dwarf::DW_AT_producer, dwarf::DW_FORM_string,
|
||||
DIUnit.getProducer(Prod));
|
||||
DIUnit.getProducer());
|
||||
AddUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data1,
|
||||
DIUnit.getLanguage());
|
||||
AddString(Die, dwarf::DW_AT_name, dwarf::DW_FORM_string, FN);
|
||||
|
||||
if (!Dir.empty())
|
||||
if (Dir)
|
||||
AddString(Die, dwarf::DW_AT_comp_dir, dwarf::DW_FORM_string, Dir);
|
||||
if (DIUnit.isOptimized())
|
||||
AddUInt(Die, dwarf::DW_AT_APPLE_optimized, dwarf::DW_FORM_flag, 1);
|
||||
|
||||
std::string Flags;
|
||||
DIUnit.getFlags(Flags);
|
||||
if (!Flags.empty())
|
||||
if (const char *Flags = DIUnit.getFlags())
|
||||
AddString(Die, dwarf::DW_AT_APPLE_flags, dwarf::DW_FORM_string, Flags);
|
||||
|
||||
unsigned RVer = DIUnit.getRunTimeVersion();
|
||||
@ -1502,8 +1483,7 @@ void DwarfDebug::ConstructGlobalVariableDIE(MDNode *N) {
|
||||
ModuleCU->getDie()->AddChild(VariableDie);
|
||||
|
||||
// Expose as global. FIXME - need to check external flag.
|
||||
std::string Name;
|
||||
ModuleCU->AddGlobal(DI_GV.getName(Name), VariableDie);
|
||||
ModuleCU->AddGlobal(DI_GV.getName(), VariableDie);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1529,8 +1509,7 @@ void DwarfDebug::ConstructSubprogram(MDNode *N) {
|
||||
ModuleCU->getDie()->AddChild(SubprogramDie);
|
||||
|
||||
// Expose as global.
|
||||
std::string Name;
|
||||
ModuleCU->AddGlobal(SP.getName(Name), SubprogramDie);
|
||||
ModuleCU->AddGlobal(SP.getName(), SubprogramDie);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1801,9 +1780,8 @@ unsigned DwarfDebug::RecordSourceLine(unsigned Line, unsigned Col,
|
||||
if (TimePassesIsEnabled)
|
||||
DebugTimer->startTimer();
|
||||
|
||||
std::string Dir, Fn;
|
||||
unsigned Src = GetOrCreateSourceID(CU.getDirectory(Dir),
|
||||
CU.getFilename(Fn));
|
||||
unsigned Src = GetOrCreateSourceID(CU.getDirectory(),
|
||||
CU.getFilename());
|
||||
unsigned ID = MMI->NextLabelID();
|
||||
Lines.push_back(SrcLineInfo(Line, Col, Src, ID));
|
||||
|
||||
@ -1823,7 +1801,7 @@ unsigned DwarfDebug::getOrCreateSourceID(const std::string &DirName,
|
||||
if (TimePassesIsEnabled)
|
||||
DebugTimer->startTimer();
|
||||
|
||||
unsigned SrcId = GetOrCreateSourceID(DirName, FileName);
|
||||
unsigned SrcId = GetOrCreateSourceID(DirName.c_str(), FileName.c_str());
|
||||
|
||||
if (TimePassesIsEnabled)
|
||||
DebugTimer->stopTimer();
|
||||
@ -2708,13 +2686,10 @@ void DwarfDebug::EmitDebugInlineInfo() {
|
||||
MDNode *Node = I->first;
|
||||
SmallVector<unsigned, 4> &Labels = I->second;
|
||||
DISubprogram SP(Node);
|
||||
std::string Name;
|
||||
std::string LName;
|
||||
const char *LName = SP.getLinkageName();
|
||||
const char *Name = SP.getName();
|
||||
|
||||
SP.getLinkageName(LName);
|
||||
SP.getName(Name);
|
||||
|
||||
if (LName.empty())
|
||||
if (!LName)
|
||||
Asm->EmitString(Name);
|
||||
else {
|
||||
// Skip special LLVM prefix that is used to inform the asm printer to not
|
||||
|
@ -450,8 +450,8 @@ class VISIBILITY_HIDDEN DwarfDebug : public Dwarf {
|
||||
/// source file names. If none currently exists, create a new id and insert it
|
||||
/// in the SourceIds map. This can update DirectoryNames and SourceFileNames maps
|
||||
/// as well.
|
||||
unsigned GetOrCreateSourceID(const std::string &DirName,
|
||||
const std::string &FileName);
|
||||
unsigned GetOrCreateSourceID(const char *DirName,
|
||||
const char *FileName);
|
||||
|
||||
void ConstructCompileUnit(MDNode *N);
|
||||
|
||||
|
@ -1041,9 +1041,8 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM) const {
|
||||
const MachineFunction *MF = getParent()->getParent();
|
||||
DebugLocTuple DLT = MF->getDebugLocTuple(debugLoc);
|
||||
DICompileUnit CU(DLT.CompileUnit);
|
||||
std::string Dir, Fn;
|
||||
OS << " [dbg: "
|
||||
<< CU.getDirectory(Dir) << '/' << CU.getFilename(Fn) << ","
|
||||
<< CU.getDirectory() << '/' << CU.getFilename() << ","
|
||||
<< DLT.Line << ","
|
||||
<< DLT.Col << "]";
|
||||
}
|
||||
|
@ -44,8 +44,7 @@ void PIC16DbgInfo::PopulateDebugInfo (DIType Ty, unsigned short &TypeNo,
|
||||
/// PopulateBasicTypeInfo- Populate TypeNo for basic type from Ty.
|
||||
///
|
||||
void PIC16DbgInfo::PopulateBasicTypeInfo (DIType Ty, unsigned short &TypeNo) {
|
||||
std::string Name = "";
|
||||
Ty.getName(Name);
|
||||
std::string Name = Ty.getName();
|
||||
unsigned short BaseTy = GetTypeDebugNumber(Name);
|
||||
TypeNo = TypeNo << PIC16Dbg::S_BASIC;
|
||||
TypeNo = TypeNo | (0xffff & BaseTy);
|
||||
@ -117,7 +116,7 @@ void PIC16DbgInfo::PopulateStructOrUnionTypeInfo (DIType Ty,
|
||||
TypeNo = TypeNo | PIC16Dbg::T_STRUCT;
|
||||
else
|
||||
TypeNo = TypeNo | PIC16Dbg::T_UNION;
|
||||
CTy.getName(TagName);
|
||||
TagName = CTy.getName();
|
||||
// UniqueSuffix is .number where number is obtained from
|
||||
// llvm.dbg.composite<number>.
|
||||
// FIXME: This will break when composite type is not represented by
|
||||
@ -305,9 +304,8 @@ void PIC16DbgInfo::EmitCompositeTypeElements (DICompositeType CTy,
|
||||
bool HasAux = false;
|
||||
int ElementAux[PIC16Dbg::AuxSize] = { 0 };
|
||||
std::string TagName = "";
|
||||
std::string ElementName;
|
||||
DIDerivedType DITy(Element.getNode());
|
||||
DITy.getName(ElementName);
|
||||
const char *ElementName = DITy.getName();
|
||||
unsigned short ElementSize = DITy.getSizeInBits()/8;
|
||||
// Get mangleddd name for this structure/union element.
|
||||
std::string MangMemName = ElementName + SuffixNo;
|
||||
@ -338,8 +336,7 @@ void PIC16DbgInfo::EmitCompositeTypeDecls(Module &M) {
|
||||
continue;
|
||||
if (CTy.getTag() == dwarf::DW_TAG_union_type ||
|
||||
CTy.getTag() == dwarf::DW_TAG_structure_type ) {
|
||||
std::string Name;
|
||||
CTy.getName(Name);
|
||||
const char *Name = CTy.getName();
|
||||
// Get the number after llvm.dbg.composite and make UniqueSuffix from
|
||||
// it.
|
||||
std::string DIVar = CTy.getNode()->getNameStr();
|
||||
@ -468,9 +465,9 @@ void PIC16DbgInfo::EmitVarDebugInfo(Module &M) {
|
||||
void PIC16DbgInfo::SwitchToCU(MDNode *CU) {
|
||||
// Get the file path from CU.
|
||||
DICompileUnit cu(CU);
|
||||
std::string DirName, FileName;
|
||||
std::string FilePath = cu.getDirectory(DirName) + "/" +
|
||||
cu.getFilename(FileName);
|
||||
std::string DirName = cu.getDirectory();
|
||||
std::string FileName = cu.getFilename();
|
||||
std::string FilePath = DirName + "/" + FileName;
|
||||
|
||||
// Nothing to do if source file is still same.
|
||||
if ( FilePath == CurFile ) return;
|
||||
|
Loading…
Reference in New Issue
Block a user