22#define DEBUG_TYPE "Element"
25 {LVElementKind::Discarded, &LVElement::getIsDiscarded},
26 {LVElementKind::Global, &LVElement::getIsGlobalReference},
27 {LVElementKind::Optimized, &LVElement::getIsOptimized}};
48 if (
options().getAttributeArgument()) {
83 if (!
options().getAttributePathname()) {
86 size_t Pos = Basename.
rfind(
'/');
87 if (Pos != std::string::npos)
88 Basename = Basename.
substr(Pos + 1);
116 if (
options().getAttributeOffset()) {
139 case MemberAccess::Private:
141 case MemberAccess::Protected:
143 case MemberAccess::Public:
151 return getIsExternal() ?
"extern" :
StringRef();
158 return "not_inlined";
162 return "declared_not_inlined";
164 return "declared_inlined";
173 case dwarf::DW_VIRTUALITY_none:
175 case dwarf::DW_VIRTUALITY_virtual:
177 case dwarf::DW_VIRTUALITY_pure_virtual:
178 return "pure virtual";
185 switch (Virtuality) {
186 case MethodKind::Virtual:
187 return dwarf::DW_VIRTUALITY_virtual;
188 case MethodKind::PureVirtual:
189 return dwarf::DW_VIRTUALITY_pure_virtual;
190 case MethodKind::IntroducingVirtual:
191 case MethodKind::PureIntroducingVirtual:
193 return dwarf::DW_VIRTUALITY_virtual;
211void LVElement::setFileLine(
LVElement *Specification) {
216 setIsLineFromReference();
220 setIsFileFromReference();
226 if (
options().getAttributeQualified())
227 resolveQualifiedName();
238 if (Parent && !Parent->getIsCompileUnit())
263 setIsGeneratedName();
285 bool GetBaseTypename =
false;
286 bool UseBaseTypename =
true;
287 bool UseNameText =
true;
290 case dwarf::DW_TAG_pointer_type:
294 case dwarf::DW_TAG_const_type:
295 case dwarf::DW_TAG_ptr_to_member_type:
296 case dwarf::DW_TAG_rvalue_reference_type:
297 case dwarf::DW_TAG_reference_type:
298 case dwarf::DW_TAG_restrict_type:
299 case dwarf::DW_TAG_volatile_type:
302 case dwarf::DW_TAG_base_type:
303 case dwarf::DW_TAG_compile_unit:
304 case dwarf::DW_TAG_class_type:
305 case dwarf::DW_TAG_enumerator:
306 case dwarf::DW_TAG_namespace:
307 case dwarf::DW_TAG_skeleton_unit:
308 case dwarf::DW_TAG_structure_type:
309 case dwarf::DW_TAG_union_type:
310 case dwarf::DW_TAG_unspecified_type:
311 case dwarf::DW_TAG_GNU_template_parameter_pack:
312 GetBaseTypename =
true;
314 case dwarf::DW_TAG_array_type:
315 case dwarf::DW_TAG_call_site:
316 case dwarf::DW_TAG_entry_point:
317 case dwarf::DW_TAG_enumeration_type:
318 case dwarf::DW_TAG_GNU_call_site:
319 case dwarf::DW_TAG_imported_module:
320 case dwarf::DW_TAG_imported_declaration:
321 case dwarf::DW_TAG_inlined_subroutine:
322 case dwarf::DW_TAG_label:
323 case dwarf::DW_TAG_subprogram:
324 case dwarf::DW_TAG_subrange_type:
325 case dwarf::DW_TAG_subroutine_type:
326 case dwarf::DW_TAG_typedef:
327 GetBaseTypename =
true;
328 UseBaseTypename =
false;
330 case dwarf::DW_TAG_template_type_parameter:
331 case dwarf::DW_TAG_template_value_parameter:
332 UseBaseTypename =
false;
334 case dwarf::DW_TAG_GNU_template_template_param:
336 case dwarf::DW_TAG_catch_block:
337 case dwarf::DW_TAG_lexical_block:
338 case dwarf::DW_TAG_try_block:
349 if (
Name.empty() && GetBaseTypename)
354 std::string Fullname;
356 if (UseNameText &&
Name.size())
357 Fullname.append(std::string(
Name));
358 if (UseBaseTypename && BaseTypename.
size()) {
359 if (UseNameText &&
Name.size())
360 Fullname.append(
" ");
361 Fullname.append(std::string(BaseTypename));
366 assert((Fullname.find(
" ", 0) == std::string::npos) &&
367 "Extra double spaces in name.");
374 if (!
options().getAttributeAnySource())
401 if (getIsFileFromReference() &&
Reference) {
404 setInvalidFilename();
420 while (Parent && !(Parent->*GetFunction)())
434void LVElement::resolveQualifiedName() {
435 if (!getIsReferencedType() ||
isBase() || getQualifiedResolved() ||
436 !getIncludeInPrint())
443 if (Parent && !Parent->getIsRoot()) {
444 while (Parent && !Parent->getIsCompileUnit()) {
445 Name.insert(0,
"::");
451 Name.insert(0, Temp);
459 setQualifiedResolved();
470 return (getHasReference() &&
Element->getHasReference()) ||
471 (!getHasReference() && !
Element->getHasReference());
478 dbgs() <<
"\n[Element::equals]\n";
479 if (
options().getAttributeOffset()) {
483 dbgs() <<
"Reference: "
520 if (
options().getPrintFormatting() &&
options().getAttributeAnySource() &&
525 if (
options().changeFilenameIndex(Index)) {
531 if (getInvalidFilename())
541 if (
options().getPrintFormatting() &&
options().getAttributeReference())
549 if (
options().getPrintFormatting() &&
options().getAttributeLinkage()) {
557 if (
options().getPrintFormatting() &&
options().getAttributeLinkage()) {
static size_t getStringIndex(StringRef Name)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr size_t size() const
size - Get the string size.
size_t rfind(char C, size_t From=npos) const
Search for the last character C in the string.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static Twine utohexstr(const uint64_t &Val)
LLVM Value Representation.
size_t getNameIndex() const
std::string discriminatorAsString() const
LVScope * traverseParents(LVScopeGetFunction GetFunction) const
virtual bool isTemplateParam() const
virtual LVScope * getCompileUnitParent() const
StringRef getQualifiedName() const
void resolveFullname(LVElement *BaseType, StringRef Name=emptyString())
LVScope * getFunctionParent() const
virtual bool isRoot() const
virtual void updateLevel(LVScope *Parent, bool Moved=false)
virtual void resolveName()
StringRef virtualityString(uint32_t Virtuality=dwarf::DW_VIRTUALITY_none) const
bool isFiled() const override
uint32_t getInlineCode() const
StringRef typeAsString() const
virtual uint32_t getDiscriminator() const
virtual bool isBase() const
void setFilename(StringRef Filename)
void setQualifiedName(StringRef Name)
StringRef externalString() const
bool getIsKindScope() const
virtual StringRef getLinkageName() const
void setName(StringRef ElementName) override
void setGenericType(LVElement *Element)
virtual bool isCompileUnit() const
StringRef getName() const override
void generateName(std::string &Prefix) const
LVType * getTypeAsType() const
LVElement * getType() const
bool referenceMatch(const LVElement *Element) const
uint32_t getAccessibilityCode() const
void setFile(LVElement *Reference=nullptr)
void setType(LVElement *Element=nullptr)
StringRef getTypeName() const
void printLinkageName(raw_ostream &OS, bool Full, LVElement *Parent, LVScope *Scope) const
bool getIsKindType() const
StringRef accessibilityString(uint32_t Access=dwarf::DW_ACCESS_private) const
void setFilenameIndex(size_t Index)
bool equals(const LVElement *Element) const
StringRef inlineCodeString(uint32_t Code) const
uint32_t getVirtualityCode() const
size_t getFilenameIndex() const
std::string typeOffsetAsString() const
void printFileIndex(raw_ostream &OS, bool Full=true) const override
StringRef getPathname() const
size_t getQualifiedNameIndex() const
bool isNamed() const override
void printReference(raw_ostream &OS, bool Full, LVElement *Parent) const
virtual void resolveExtra()
LVScope * getTypeAsScope() const
virtual void resolveReferences()
std::string referenceAsString(uint32_t LineNumber, bool Spaces) const
virtual const char * kind() const
LVScope * getParentScope() const
dwarf::Tag getTag() const
void setLevel(LVLevel Level)
void printAttributes(raw_ostream &OS, bool Full=true) const
virtual std::string lineNumberAsString(bool ShowZero=false) const
uint32_t getLineNumber() const
LVOffset getOffset() const
void setLineNumber(uint32_t Number)
StringRef getFilename(LVObject *Object, size_t Index) const
virtual LVSectionIndex getSectionIndex(LVScope *Scope)
size_t getIndex(StringRef Key)
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
MethodKind
Part of member attribute flags. (CV_methodprop_e)
MemberAccess
Source-level access specifier. (CV_access_e)
@ DW_INL_declared_not_inlined
@ DW_INL_declared_inlined
constexpr Tag DW_TAG_unaligned
LVStringPool & getStringPool()
std::string formattedKind(StringRef Kind)
std::string hexSquareString(uint64_t Value)
bool(LVScope::*)() const LVScopeGetFunction
std::string transformPath(StringRef Path)
LVLexicalComponent getInnerComponent(StringRef Name)
std::string formattedName(StringRef Name)
std::map< LVElementKind, LVElementGetFunction > LVElementDispatch
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...