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);
110 Gap->
setAttr(dwarf::DW_AT_location);
122 Gap->setIsGapEntry();
129 if (!getHasLocation() || !getFillGaps())
138 LVAddress ParentLowPC = Entry->getLowerAddress();
139 LVAddress ParentHighPC = Entry->getUpperAddress();
147 Iter != Locations->end(); ++Iter) {
149 LowPC =
Location->getLowerAddress();
150 if (LowPC != Marker) {
152 Iter = addLocationGap(Iter, Marker, LowPC - 1);
157 Marker =
Location->getUpperAddress() + 1;
161 if (Marker < ParentHighPC)
163 addLocationGap(Locations->end(), Marker, ParentHighPC);
175 if (!(
Location->*ValidLocation)() && RecordInvalid)
194 CoveragePercentage)) {
196 if (Parent->getIsInlinedFunction()) {
213 ? rint((
double(CoverageFactor) / CoverageParent) * 100.0 * 100.0) /
217 if (
options().getWarningCoverages() && CoveragePercentage > 100)
223 if (getIsResolvedName())
259 if (
Element->getIsTypedefReduced()) {
277 if (getHasReference() && !
isNamed())
289 dbgs() <<
"\n[LVSymbol::markMissingParents]\n";
290 for (
const LVSymbol *Reference : *References)
291 dbgs() <<
"References: "
295 dbgs() <<
"Targets : "
300 for (
LVSymbol *Reference : *References) {
302 dbgs() <<
"Search Reference: Name = "
305 if (!Reference->findIn(
Targets))
315 dbgs() <<
"\n[LVSymbol::findIn]\n"
321 dbgs() <<
"Target : "
322 <<
"Level = " <<
Target->getLevel() <<
", "
353 if (
Symbol->getIsParameter())
375 for (
const LVSymbol *Reference : *References)
376 if (!Reference->findIn(
Targets))
394 if (getIncludeInPrint() &&
getReader().doPrintSymbol(
this)) {
404 if (getIsMember() || getIsInheritance())
410 Symbol->getIsCallSiteParameter()
417 if (
Symbol->getIsUnspecified())
420 if (
Symbol->getIsInheritance())
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, uint64_t Operand1, uint64_t Operand2)
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.