14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
26namespace logicalview {
97 unsigned CoverageFactor = 0;
100 void calculateCoverage() {
101 float CoveragePercentage = 0;
108 bool resolvePrinting()
const;
200 bool isRoot()
const override {
return getIsRoot(); }
202 const char *
kind()
const override;
242 bool RecordInvalid =
false);
244 bool RecordInvalid =
false);
250 bool Full =
true)
const override;
289 bool TraverseChildren);
320#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
328 size_t EncodedArgsIndex = 0;
367 setIsTemplateAlias();
399 std::vector<size_t> Filenames;
408 size_t ProducerIndex = 0;
411 size_t CompilationDirectoryIndex = 0;
430 using LVAddressToLine = std::map<LVAddress, LVLine *>;
453 using LVSizesMap = std::map<const LVScope *, LVOffset>;
462 addItem<LVOffsetLocationsMap, LVOffset, LVLocation *>(Map,
Offset,
468 const size_t TotalInitialSize = 8;
469 using LVTotalsEntry = std::pair<unsigned, float>;
507 PublicNames.emplace(std::piecewise_construct, std::forward_as_tuple(
Scope),
508 std::forward_as_tuple(LowPC, HighPC - LowPC));
511 LVPublicNames::iterator Iter = PublicNames.find(
Scope);
512 return (Iter != PublicNames.end()) ? Iter->second :
NameNone;
562 return InvalidLocations;
565 return InvalidCoverages;
584 const char *Header)
const;
648 size_t LinkageNameIndex = 0;
649 size_t EncodedArgsIndex = 0;
699 size_t CallFilenameIndex = 0;
712 setHasDiscriminator();
719 CallFilenameIndex =
Index;
783 size_t FileFormatNameIndex = 0;
811 bool UseMatchedElements)
const;
Lightweight error class with error context and mandatory checking.
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.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
virtual LVScope * getCompileUnitParent() const
StringRef getQualifiedName() const
LVSubclassID getSubclassID() const
static bool calculateCoverage(LVLocations *Locations, unsigned &Factor, float &Percentage)
std::string lineAsString(uint32_t LineNumber, LVHalf Discriminator, bool ShowZero) const
LVOffset getOffset() const
LVScopeAggregate & operator=(const LVScopeAggregate &)=delete
void setEncodedArgs(StringRef EncodedArgs) override
void printExtra(raw_ostream &OS, bool Full=true) const override
~LVScopeAggregate()=default
StringRef getEncodedArgs() const override
void setReference(LVScope *Scope) override
LVScope * getReference() const override
LVScopeAggregate(const LVScopeAggregate &)=delete
bool equals(const LVScope *Scope) const override
LVScope * findEqualScope(const LVScopes *Scopes) const override
void setReference(LVElement *Element) override
LVScopeAlias(const LVScopeAlias &)=delete
bool equals(const LVScope *Scope) const override
void printExtra(raw_ostream &OS, bool Full=true) const override
LVScopeAlias & operator=(const LVScopeAlias &)=delete
void resolveExtra() override
LVScopeArray(const LVScopeArray &)=delete
bool equals(const LVScope *Scope) const override
void printExtra(raw_ostream &OS, bool Full=true) const override
LVScopeArray & operator=(const LVScopeArray &)=delete
const LVScopes & getMatchedScopes() const
void propagatePatternMatch()
void addDebugTag(dwarf::Tag Target, LVOffset Offset)
void printSummary(raw_ostream &OS) const override
void addedElement(LVLine *Line)
const LVOffsetElementMap & getWarningOffsets() const
void addFilename(StringRef Name)
void printExtra(raw_ostream &OS, bool Full=true) const override
void printMatchedElements(raw_ostream &OS, bool UseMatchedElements) override
void setProducer(StringRef ProducerName) override
LVLineRange lineRange(LVLocation *Location) const
void addMapping(LVLine *Line, LVSectionIndex SectionIndex)
codeview::CPUType getCPUType()
void addMatched(LVElement *Element)
void addInvalidLocation(LVLocation *Location)
void incrementPrintedScopes()
void increment(LVLine *Line)
LVScopeCompileUnit & operator=(const LVScopeCompileUnit &)=delete
~LVScopeCompileUnit()=default
const LVOffsetLocationsMap & getInvalidRanges() const
const LVTagOffsetsMap & getDebugTags() const
void addLineZero(LVLine *Line)
LVScopeCompileUnit(const LVScopeCompileUnit &)=delete
void addMatched(LVScope *Scope)
const LVOffsetSymbolMap & getInvalidCoverages() const
const LVPublicNames & getPublicNames() const
void setCPUType(codeview::CPUType Type)
void addInvalidOffset(LVOffset Offset, LVElement *Element)
void setCompilationDirectory(StringRef CompilationDirectory)
LVAddress getBaseAddress() const
const LVElements & getMatchedElements() const
const LVOffsetLinesMap & getLinesZero() const
void addInvalidCoverage(LVSymbol *Symbol)
void addSize(LVScope *Scope, LVOffset Lower, LVOffset Upper)
void processRangeLocationCoverage(LVValidLocation ValidLocation=&LVLocation::validateRanges)
void incrementPrintedLines()
StringRef getCompilationDirectory() const
void addPublicName(LVScope *Scope, LVAddress LowPC, LVAddress HighPC)
StringRef getFilename(size_t Index) const
const LVOffsetLocationsMap & getInvalidLocations() const
void print(raw_ostream &OS, bool Full=true) const override
bool equals(const LVScope *Scope) const override
void printSizes(raw_ostream &OS) const override
void addInvalidRange(LVLocation *Location)
void printLocalNames(raw_ostream &OS, bool Full=true) const
StringRef getProducer() const override
const LVNameInfo & findPublicName(LVScope *Scope)
void incrementPrintedSymbols()
void incrementPrintedTypes()
void printWarnings(raw_ostream &OS, bool Full=true) const override
LVScope * getCompileUnitParent() const override
void printExtra(raw_ostream &OS, bool Full=true) const override
LVScopeEnumeration(const LVScopeEnumeration &)=delete
~LVScopeEnumeration()=default
LVScopeEnumeration & operator=(const LVScopeEnumeration &)=delete
bool equals(const LVScope *Scope) const override
LVScope * findEqualScope(const LVScopes *Scopes) const override
LVScopeFunctionInlined(const LVScopeFunctionInlined &)=delete
void setDiscriminator(uint32_t Value) override
LVScopeFunctionInlined & operator=(const LVScopeFunctionInlined &)=delete
uint32_t getCallLineNumber() const override
void setCallLineNumber(uint32_t Number) override
void resolveExtra() override
bool equals(const LVScope *Scope) const override
uint32_t getDiscriminator() const override
std::string lineNumberAsString(bool ShowZero=false) const override
size_t getCallFilenameIndex() const override
void printExtra(raw_ostream &OS, bool Full=true) const override
~LVScopeFunctionInlined()=default
void setCallFilenameIndex(size_t Index) override
LVScopeFunctionType(const LVScopeFunctionType &)=delete
void resolveExtra() override
LVScopeFunctionType & operator=(const LVScopeFunctionType &)=delete
~LVScopeFunctionType()=default
virtual ~LVScopeFunction()=default
void setLinkageName(StringRef LinkageName) override
void setName(StringRef ObjectName) override
LVScope * getReference() const override
void setEncodedArgs(StringRef EncodedArgs) override
LVScope * findEqualScope(const LVScopes *Scopes) const override
size_t getLinkageNameIndex() const override
LVScopeFunction(const LVScopeFunction &)=delete
void setReference(LVScope *Scope) override
StringRef getEncodedArgs() const override
LVScopeFunction & operator=(const LVScopeFunction &)=delete
void printExtra(raw_ostream &OS, bool Full=true) const override
StringRef getLinkageName() const override
bool equals(const LVScope *Scope) const override
void resolveReferences() override
void setReference(LVElement *Element) override
void resolveExtra() override
LVScopeNamespace & operator=(const LVScopeNamespace &)=delete
LVScopeNamespace(const LVScopeNamespace &)=delete
void printExtra(raw_ostream &OS, bool Full=true) const override
bool equals(const LVScope *Scope) const override
LVScope * findEqualScope(const LVScopes *Scopes) const override
~LVScopeNamespace()=default
LVScope * getReference() const override
void setReference(LVScope *Scope) override
void setReference(LVElement *Element) override
void processRangeInformation()
void transformScopedName()
LVScopeRoot & operator=(const LVScopeRoot &)=delete
void printExtra(raw_ostream &OS, bool Full=true) const override
StringRef getFileFormatName() const
Error doPrintMatches(bool Split, raw_ostream &OS, bool UseMatchedElements) const
void print(raw_ostream &OS, bool Full=true) const override
void setFileFormatName(StringRef FileFormatName)
bool equals(const LVScope *Scope) const override
LVScopeRoot(const LVScopeRoot &)=delete
void printExtra(raw_ostream &OS, bool Full=true) const override
bool equals(const LVScope *Scope) const override
~LVScopeTemplatePack()=default
LVScopeTemplatePack(const LVScopeTemplatePack &)=delete
LVScopeTemplatePack & operator=(const LVScopeTemplatePack &)=delete
virtual LVScope * getReference() const
void addElement(LVElement *Element)
void traverseParentsAndChildren(LVObjectGetFunction GetFunction, LVObjectSetFunction SetFunction)
LVScope & operator=(const LVScope &)=delete
static LVScopeDispatch & getDispatch()
const LVLines * getLines() const
virtual void printSummary(raw_ostream &OS) const
PROPERTY(Property, CanHaveLines)
StringRef resolveReferencesChain()
KIND_2(LVScopeKind, IsBlock, CanHaveRanges, CanHaveLines)
KIND_1(LVScopeKind, IsLexicalBlock, IsBlock)
bool isCompileUnit() const override
KIND(LVScopeKind, IsEnumeration)
void printExtra(raw_ostream &OS, bool Full=true) const override
void report(LVComparePass Pass) override
static bool classof(const LVElement *Element)
KIND(LVScopeKind, IsTemplatePack)
virtual ~LVScope()=default
const char * kind() const override
virtual LVScope * findEqualScope(const LVScopes *Scopes) const
PROPERTY(Property, HasLines)
PROPERTY(Property, HasTypes)
const LVScopes * getScopes() const
KIND_1(LVScopeKind, IsSubprogram, IsFunction)
void print(raw_ostream &OS, bool Full=true) const override
void resolveName() override
PROPERTY(Property, HasDiscriminator)
PROPERTY(Property, HasLocals)
PROPERTY(Property, HasGlobals)
void printActiveRanges(raw_ostream &OS, bool Full=true) const
size_t scopeCount() const
KIND_1(LVScopeKind, IsCallSite, IsFunction)
const LVSymbols * getSymbols() const
KIND(LVScopeKind, IsTemplate)
PROPERTY(Property, HasSymbols)
virtual void printMatchedElements(raw_ostream &OS, bool UseMatchedElements)
PROPERTY(Property, CanHaveRanges)
virtual void setEncodedArgs(StringRef EncodedArgs)
void printEncodedArgs(raw_ostream &OS, bool Full) const
PROPERTY(Property, IsComdat)
bool isRoot() const override
KIND(LVScopeKind, IsNamespace)
PROPERTY(Property, AddedMissing)
void updateLevel(LVScope *Parent, bool Moved) override
KIND(LVScopeKind, IsTemplateAlias)
PROPERTY(Property, HasScopes)
KIND_3(LVScopeKind, IsCompileUnit, CanHaveRanges, CanHaveLines, TransformName)
LVScope * outermostParent(LVAddress Address)
std::unique_ptr< LVLocations > Ranges
KIND_1(LVScopeKind, IsUnion, IsAggregate)
void addToChildren(LVElement *Element)
static void markMissingParents(const LVScopes *References, const LVScopes *Targets, bool TraverseChildren)
KIND(LVScopeKind, IsMember)
std::unique_ptr< LVSymbols > Symbols
const LVTypes * getTypes() const
void encodeTemplateArguments(std::string &Name) const
void addObject(LVLocation *Location)
const LVElements * getChildren() const
KIND_1(LVScopeKind, IsCatchBlock, IsBlock)
LVScope * getCompileUnitParent() const override
KIND_1(LVScopeKind, IsTryBlock, IsBlock)
virtual void printSizes(raw_ostream &OS) const
std::unique_ptr< LVElements > Children
std::unique_ptr< LVTypes > Types
LVScope(const LVScope &)=delete
virtual bool equals(const LVScope *Scope) const
KIND_1(LVScopeKind, IsStructure, IsAggregate)
bool getTemplateParameterTypes(LVTypes &Params)
virtual StringRef getEncodedArgs() const
std::unique_ptr< LVLines > Lines
KIND(LVScopeKind, IsAggregate)
void getLocations(LVLocations &LocationList, LVValidLocation ValidLocation, bool RecordInvalid=false)
unsigned getCoverageFactor() const
Error doPrint(bool Split, bool Match, bool Print, raw_ostream &OS, bool Full=true) const override
virtual bool equalNumberOfChildren(const LVScope *Scope) const
KIND_1(LVScopeKind, IsLabel, IsFunction)
void addMissingElements(LVScope *Reference)
virtual void printWarnings(raw_ostream &OS, bool Full=true) const
void resolveReferences() override
KIND_1(LVScopeKind, IsFunctionType, IsFunction)
std::unique_ptr< LVScopes > Scopes
const LVLocations * getRanges() const
PROPERTY(Property, HasComdatScopes)
KIND_1(LVScopeKind, IsRoot, TransformName)
KIND_1(LVScopeKind, IsClass, IsAggregate)
PROPERTY(Property, HasRanges)
KIND(LVScopeKind, IsArray)
size_t symbolCount() const
KIND_1(LVScopeKind, IsEntryPoint, IsFunction)
bool removeElement(LVElement *Element) override
size_t rangeCount() const
KIND_2(LVScopeKind, IsFunction, CanHaveRanges, CanHaveLines)
void dump() const override
KIND_2(LVScopeKind, IsInlinedFunction, IsFunction, IsInlined)
StringRef getString(size_t Index) const
size_t getIndex(StringRef Key)
This class implements an extremely fast bulk output stream that can only output to a stream.
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
std::map< LVOffset, LVElement * > LVOffsetElementMap
std::set< LVScopeKind > LVScopeKindSet
LVStringPool & getStringPool()
std::pair< LVLine *, LVLine * > LVLineRange
std::pair< LVAddress, uint64_t > LVNameInfo
std::map< LVScopeKind, LVScopeGetFunction > LVScopeDispatch
std::map< LVScope *, LVNameInfo > LVPublicNames
std::map< LVOffset, LVLocations > LVOffsetLocationsMap
bool(LVObject::*)() const LVObjectGetFunction
std::map< dwarf::Tag, LVOffsets > LVTagOffsetsMap
bool(LVScope::*)() const LVScopeGetFunction
bool(LVLocation::*)() LVValidLocation
std::vector< LVScopeGetFunction > LVScopeRequest
std::map< LVOffset, LVSymbol * > LVOffsetSymbolMap
void(LVObject::*)() LVObjectSetFunction
std::map< LVOffset, LVLines > LVOffsetLinesMap
std::map< LVAddress, LVNameInfo > LVPublicAddresses
void(LVScope::*)() LVScopeSetFunction
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.