22#define DEBUG_TYPE "Symbol"
25const char *
const KindCallSiteParameter =
"CallSiteParameter";
26const char *
const KindConstant =
"Constant";
27const char *
const KindInherits =
"Inherits";
28const char *
const KindMember =
"Member";
29const char *
const KindParameter =
"Parameter";
30const char *
const KindUndefined =
"Undefined";
31const char *
const KindUnspecified =
"Unspecified";
32const char *
const KindVariable =
"Variable";
37 const char *
Kind = KindUndefined;
38 if (getIsCallSiteParameter())
39 Kind = KindCallSiteParameter;
40 else if (getIsConstant())
42 else if (getIsInheritance())
44 else if (getIsMember())
46 else if (getIsParameter())
48 else if (getIsUnspecified())
49 Kind = KindUnspecified;
50 else if (getIsVariable())
67 uint64_t LocDescOffset,
bool CallSiteLocation) {
69 Locations = std::make_unique<LVLocations>();
72 CurrentLocation =
getReader().createLocationSymbol();
76 CurrentLocation->setIsCallSite();
77 CurrentLocation->
addObject(LowPC, HighPC, SectionOffset, LocDescOffset);
78 Locations->push_back(CurrentLocation);
109 Gap->
setAttr(dwarf::DW_AT_location);
120 Gap->setIsGapEntry();
127 if (!getHasLocation() || !getFillGaps())
136 LVAddress ParentLowPC = Entry->getLowerAddress();
137 LVAddress ParentHighPC = Entry->getUpperAddress();
145 Iter != Locations->end(); ++Iter) {
147 LowPC =
Location->getLowerAddress();
148 if (LowPC != Marker) {
150 Iter = addLocationGap(Iter, Marker, LowPC - 1);
155 Marker =
Location->getUpperAddress() + 1;
159 if (Marker < ParentHighPC)
161 addLocationGap(Locations->end(), Marker, ParentHighPC);
173 if (!(
Location->*ValidLocation)() && RecordInvalid)
192 CoveragePercentage)) {
194 if (Parent->getIsInlinedFunction()) {
211 ? rint((
double(CoverageFactor) / CoverageParent) * 100.0 * 100.0) /
215 if (
options().getWarningCoverages() && CoveragePercentage > 100)
221 if (getIsResolvedName())
257 if (
Element->getIsTypedefReduced()) {
275 if (getHasReference() && !
isNamed())
283 if (!(References && Targets))
287 dbgs() <<
"\n[LVSymbol::markMissingParents]\n";
288 for (
const LVSymbol *Reference : *References)
289 dbgs() <<
"References: "
293 dbgs() <<
"Targets : "
298 for (
LVSymbol *Reference : *References) {
300 dbgs() <<
"Search Reference: Name = "
303 if (!Reference->findIn(Targets))
313 dbgs() <<
"\n[LVSymbol::findIn]\n"
319 dbgs() <<
"Target : "
320 <<
"Level = " <<
Target->getLevel() <<
", "
335 if (!References && !Targets)
337 if (References && Targets) {
351 if (
Symbol->getIsParameter())
352 Parameters->push_back(
Symbol);
370 if (!References && !Targets)
372 if (References && Targets && References->
size() == Targets->
size()) {
373 for (
const LVSymbol *Reference : *References)
374 if (!Reference->findIn(Targets))
392 if (getIncludeInPrint() &&
getReader().doPrintSymbol(
this)) {
402 if (getIsMember() || getIsInheritance())
408 Symbol->getIsCallSiteParameter()
415 if (
Symbol->getIsUnspecified())
418 if (
Symbol->getIsInheritance())
mir Rename Register Operands
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is an important base class in LLVM.
Pass interface - Implemented by all 'passes'.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
const char * getName() const
getName - Get the target name.
void printItem(LVElement *Element, LVComparePass Pass)
virtual void resolveName()
StringRef virtualityString(uint32_t Virtuality=dwarf::DW_VIRTUALITY_none) const
StringRef typeAsString() const
StringRef externalString() const
void setName(StringRef ElementName) override
void setGenericType(LVElement *Element)
StringRef getName() const override
LVElement * getType() const
bool referenceMatch(const LVElement *Element) const
void setFile(LVElement *Reference=nullptr)
void setType(LVElement *Element=nullptr)
void printLinkageName(raw_ostream &OS, bool Full, LVElement *Parent, LVScope *Scope) const
StringRef getTypeQualifiedName() const
StringRef accessibilityString(uint32_t Access=dwarf::DW_ACCESS_private) const
bool equals(const LVElement *Element) const
std::string typeOffsetAsString() const
bool isNamed() const override
void printReference(raw_ostream &OS, bool Full, LVElement *Parent) const
static bool calculateCoverage(LVLocations *Locations, unsigned &Factor, float &Percentage)
virtual void addObject(LVAddress LowPC, LVAddress HighPC, LVUnsigned SectionOffset, uint64_t LocDescOffset)
static void print(LVLocations *Locations, raw_ostream &OS, bool Full=true)
LVScope * getParentScope() const
virtual void print(raw_ostream &OS, bool Full=true) const
void setParent(LVScope *Scope)
void setAttr(dwarf::Attribute Attr)
void markBranchAsMissing()
void resolvePatternMatch(LVLine *Line)
void addInvalidCoverage(LVSymbol *Symbol)
void incrementPrintedSymbols()
LVScope * outermostParent(LVAddress Address)
unsigned getCoverageFactor() const
const LVLocations * getRanges() const
void resolveName() override
static void getParameters(const LVSymbols *Symbols, LVSymbols *Parameters)
void report(LVComparePass Pass) override
void printExtra(raw_ostream &OS, bool Full=true) const override
void addLocation(dwarf::Attribute Attr, LVAddress LowPC, LVAddress HighPC, LVUnsigned SectionOffset, uint64_t LocDescOffset, bool CallSiteLocation=false)
void resolveReferences() override
void print(raw_ostream &OS, bool Full=true) const override
void addLocationOperands(LVSmall Opcode, ArrayRef< uint64_t > Operands)
size_t getLinkageNameIndex() const override
void getLocations(LVLocations &LocationList, LVValidLocation ValidLocation, bool RecordInvalid=false)
static void markMissingParents(const LVSymbols *References, const LVSymbols *Targets)
void addLocationConstant(dwarf::Attribute Attr, LVUnsigned Constant, uint64_t LocDescOffset)
StringRef getValue() const override
bool equals(const LVSymbol *Symbol) const
uint32_t getBitSize() const override
const char * kind() const override
void printLocations(raw_ostream &OS, bool Full=true) const
static bool parametersMatch(const LVSymbols *References, const LVSymbols *Targets)
StringRef resolveReferencesChain()
LVSymbol * getReference() const
This class implements an extremely fast bulk output stream that can only output to a stream.
std::string formattedNames(StringRef Name1, StringRef Name2)
std::string formattedKind(StringRef Kind)
LVScopeCompileUnit * getReaderCompileUnit()
bool(LVLocation::*)() LVValidLocation
std::string formattedName(StringRef Name)
std::map< LVSymbolKind, LVSymbolGetFunction > LVSymbolDispatch
const LVSmall LVLocationMemberOffset
std::string formatAttributes(const StringRef First, Args... Others)
LVCompare & getComparator()
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.