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();
 
   73  CurrentLocation->setParent(
this);
 
   74  CurrentLocation->setAttr(
Attr);
 
   76    CurrentLocation->setIsCallSite();
 
   77  CurrentLocation->addObject(LowPC, HighPC, SectionOffset, LocDescOffset);
 
   78  Locations->push_back(CurrentLocation);
 
 
   88    CurrentLocation->addObject(
Opcode, Operands);
 
 
  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)
 
 
  191                                     CoveragePercentage)) {
 
  193    if (Parent->getIsInlinedFunction()) {
 
  201          Parent->outermostParent(Locations->front()->getLowerAddress());
 
  205    unsigned CoverageParent = Parent->getCoverageFactor();
 
  210            ? rint((
double(CoverageFactor) / CoverageParent) * 100.0 * 100.0) /
 
  214    if (
options().getWarningCoverages() && CoveragePercentage > 100)
 
 
  220  if (getIsResolvedName())
 
 
  243    Reference->resolve();
 
  256    if (
Element->getIsTypedefReduced()) {
 
 
  274  if (getHasReference() && !
isNamed())
 
 
  282  if (!(References && Targets))
 
  286    dbgs() << 
"\n[LVSymbol::markMissingParents]\n";
 
  287    for (
const LVSymbol *Reference : *References)
 
  288      dbgs() << 
"References: " 
  292      dbgs() << 
"Targets   : " 
  297  for (
LVSymbol *Reference : *References) {
 
  299      dbgs() << 
"Search Reference: Name = " 
  302    if (!Reference->findIn(Targets))
 
  303      Reference->markBranchAsMissing();
 
 
  312    dbgs() << 
"\n[LVSymbol::findIn]\n" 
  318      dbgs() << 
"Target   : " 
  319             << 
"Level = " << 
Target->getLevel() << 
", " 
  334  if (!References && !Targets)
 
  336  if (References && Targets) {
 
 
  350      if (
Symbol->getIsParameter())
 
  351        Parameters->push_back(
Symbol);
 
 
  369  if (!References && !Targets)
 
  371  if (References && Targets && References->
size() == Targets->
size()) {
 
  372    for (
const LVSymbol *Reference : *References)
 
  373      if (!Reference->findIn(Targets))
 
 
  391  if (getIncludeInPrint() && 
getReader().doPrintSymbol(
this)) {
 
 
  401  if (getIsMember() || getIsInheritance())
 
  406  std::string Attributes =
 
  407      Symbol->getIsCallSiteParameter()
 
  410                             Symbol->accessibilityString(AccessCode),
 
  414  if (
Symbol->getIsUnspecified())
 
  417    if (
Symbol->getIsInheritance())
 
  418      OS << 
Symbol->typeOffsetAsString()
 
  426      OS << 
" -> " << 
Symbol->typeOffsetAsString()
 
  441      Reference->printReference(OS, 
Full, 
const_cast<LVSymbol *
>(
this));
 
 
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)
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.
LLVM_ABI void printItem(LVElement *Element, LVComparePass Pass)
LVElement(LVSubclassID ID)
virtual void resolveName()
StringRef virtualityString(uint32_t Virtuality=dwarf::DW_VIRTUALITY_none) 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
bool equals(const LVElement *Element) const
bool isNamed() const override
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 resolvePatternMatch(LVLine *Line)
void addInvalidCoverage(LVSymbol *Symbol)
void incrementPrintedSymbols()
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::map< LVSymbolKind, LVSymbolGetFunction > LVSymbolDispatch
std::string formattedKind(StringRef Kind)
LVScopeCompileUnit * getReaderCompileUnit()
bool(LVLocation::*)() LVValidLocation
SmallVector< LVSymbol *, 8 > LVSymbols
std::string formattedName(StringRef Name)
const LVSmall LVLocationMemberOffset
std::string formatAttributes(const StringRef First, Args... Others)
LVCompare & getComparator()
SmallVector< LVLocation *, 8 > LVLocations
This is an optimization pass for GlobalISel generic memory operations.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.