14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
102 unsigned CoverageFactor = 0;
105 void calculateCoverage() {
106 float CoveragePercentage = 0;
113 bool resolvePrinting()
const;
206 bool isRoot()
const override {
return getIsRoot(); }
208 const char *kind()
const override;
220 void addElement(
LVScope *Scope);
248 bool RecordInvalid =
false);
250 bool RecordInvalid =
false);
251 void getRanges(
LVRange &RangeList);
256 bool Full =
true)
const override;
262 bool getTemplateParameterTypes(
LVTypes &Params);
275 bool removeElement(
LVElement *Element)
override;
276 void updateLevel(
LVScope *Parent,
bool Moved)
override;
281 void resolve()
override;
282 void resolveName()
override;
283 void resolveReferences()
override;
288 void encodeTemplateArguments(std::string &
Name)
const;
289 void encodeTemplateArguments(std::string &
Name,
const LVTypes *
Types)
const;
291 void resolveElements();
296 static void markMissingParents(
const LVScopes *References,
298 bool TraverseChildren);
302 virtual void markMissingParents(
const LVScope *
Target,
bool TraverseChildren);
306 virtual bool equalNumberOfChildren(
const LVScope *Scope)
const;
309 virtual bool equals(
const LVScope *Scope)
const;
333 size_t EncodedArgsIndex = 0;
359 bool equals(
const LVScope *Scope)
const override;
372 setIsTemplateAlias();
404 std::vector<size_t> Filenames;
413 size_t ProducerIndex = 0;
416 size_t CompilationDirectoryIndex = 0;
438 using LVAddressToLine = std::map<LVAddress, LVLine *>;
461 using LVSizesMap = std::map<const LVScope *, LVOffset>;
476 static constexpr size_t TotalInitialSize = 8;
477 using LVTotalsEntry = std::pair<unsigned, float>;
515 PublicNames.emplace(std::piecewise_construct, std::forward_as_tuple(
Scope),
516 std::forward_as_tuple(LowPC, HighPC - LowPC));
519 LVPublicNames::iterator Iter = PublicNames.find(
Scope);
520 return (Iter != PublicNames.end()) ? Iter->second :
NameNone;
536 CompilationDirectoryIndex =
getStringPool().getIndex(CompilationDirectory);
562 void addInvalidCoverage(
LVSymbol *Symbol);
573 return InvalidLocations;
576 return InvalidCoverages;
582 void processRangeLocationCoverage(
588 void propagatePatternMatch();
595 const char *Header)
const;
597 void incrementPrintedLines();
598 void incrementPrintedScopes();
599 void incrementPrintedSymbols();
600 void incrementPrintedTypes();
604 void increment(
LVScope *Scope);
612 void addedElement(
LVScope *Scope);
613 void addedElement(
LVSymbol *Symbol);
619 bool equals(
const LVScope *Scope)
const override;
624 void printMatchedElements(
raw_ostream &OS,
bool UseMatchedElements)
override;
659 size_t LinkageNameIndex = 0;
660 size_t EncodedArgsIndex = 0;
693 void setName(
StringRef ObjectName)
override;
695 void resolveExtra()
override;
696 void resolveReferences()
override;
699 bool equals(
const LVScope *Scope)
const override;
710 size_t CallFilenameIndex = 0;
722 Discriminator =
Value;
723 setHasDiscriminator();
730 CallFilenameIndex = Index;
739 void resolveExtra()
override;
742 bool equals(
const LVScope *Scope)
const override;
800 bool equals(
const LVScope *Scope)
const override;
811 size_t FileFormatNameIndex = 0;
823 FileFormatNameIndex =
getStringPool().getIndex(FileFormatName);
828 void transformScopedName();
831 void processRangeInformation();
834 bool equals(
const LVScope *Scope)
const override;
839 bool UseMatchedElements)
const;
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static SmallString< 128 > getFilename(const DIScope *SP)
Extract a filename for a DIScope.
Lightweight error class with error context and mandatory checking.
Pass interface - Implemented by all 'passes'.
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.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
virtual LVScope * getCompileUnitParent() const
LVElement(LVSubclassID ID)
static bool calculateCoverage(LVLocations *Locations, unsigned &Factor, float &Percentage)
std::string lineAsString(uint32_t LineNumber, LVHalf Discriminator, bool ShowZero) const
LVScopeAggregate & operator=(const LVScopeAggregate &)=delete
void setEncodedArgs(StringRef EncodedArgs) override
~LVScopeAggregate()=default
StringRef getEncodedArgs() const override
void setReference(LVScope *Scope) override
LVScope * getReference() const override
LVScopeAggregate(const LVScopeAggregate &)=delete
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
static constexpr LVNameInfo NameNone
void printSummary(raw_ostream &OS) const override
const LVOffsetElementMap & getWarningOffsets() const
void addFilename(StringRef Name)
void setProducer(StringRef ProducerName) override
codeview::CPUType getCPUType()
LVSourceLanguage getSourceLanguage() const override
void addMatched(LVElement *Element)
LVScopeCompileUnit & operator=(const LVScopeCompileUnit &)=delete
~LVScopeCompileUnit()=default
const LVOffsetLocationsMap & getInvalidRanges() const
const LVTagOffsetsMap & getDebugTags() const
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
StringRef getCompilationDirectory() const
void addPublicName(LVScope *Scope, LVAddress LowPC, LVAddress HighPC)
const LVOffsetLocationsMap & getInvalidLocations() const
void printSizes(raw_ostream &OS) const override
StringRef getProducer() const override
const LVNameInfo & findPublicName(LVScope *Scope)
void setSourceLanguage(LVSourceLanguage SL) 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
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
uint32_t getDiscriminator() const override
std::string lineNumberAsString(bool ShowZero=false) const override
size_t getCallFilenameIndex() 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
LVScope * getReference() const override
void setEncodedArgs(StringRef EncodedArgs) override
size_t getLinkageNameIndex() const override
LVScopeFunction(const LVScopeFunction &)=delete
void setReference(LVScope *Scope) override
StringRef getEncodedArgs() const override
LVScopeFunction & operator=(const LVScopeFunction &)=delete
StringRef getLinkageName() const override
void setReference(LVElement *Element) override
void printExtra(raw_ostream &OS, bool Full=true) const override
LVScopeModule & operator=(const LVScopeModule &)=delete
LVScopeModule(const LVScopeModule &)=delete
bool equals(const LVScope *Scope) const override
LVScopeNamespace & operator=(const LVScopeNamespace &)=delete
LVScopeNamespace(const LVScopeNamespace &)=delete
~LVScopeNamespace()=default
LVScope * getReference() const override
void setReference(LVScope *Scope) override
void setReference(LVElement *Element) override
LVScopeRoot & operator=(const LVScopeRoot &)=delete
StringRef getFileFormatName() const
void setFileFormatName(StringRef FileFormatName)
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
LVScope & operator=(const LVScope &)=delete
static LVScopeDispatch & getDispatch()
const LVLines * getLines() const
virtual void printSummary(raw_ostream &OS) const
PROPERTY(Property, CanHaveLines)
KIND_2(LVScopeKind, IsBlock, CanHaveRanges, CanHaveLines)
KIND_1(LVScopeKind, IsLexicalBlock, IsBlock)
bool isCompileUnit() const override
KIND(LVScopeKind, IsEnumeration)
static bool classof(const LVElement *Element)
KIND(LVScopeKind, IsTemplatePack)
virtual ~LVScope()=default
PROPERTY(Property, HasLines)
PROPERTY(Property, HasTypes)
const LVScopes * getScopes() const
KIND_1(LVScopeKind, IsSubprogram, IsFunction)
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)
KIND(LVScopeKind, IsTemplateAlias)
PROPERTY(Property, HasScopes)
KIND_3(LVScopeKind, IsCompileUnit, CanHaveRanges, CanHaveLines, TransformName)
std::unique_ptr< LVLocations > Ranges
KIND_1(LVScopeKind, IsUnion, IsAggregate)
KIND(LVScopeKind, IsMember)
std::unique_ptr< LVSymbols > Symbols
const LVTypes * getTypes() const
const LVElements * getChildren() const
KIND_1(LVScopeKind, IsCatchBlock, IsBlock)
LVScope * getCompileUnitParent() const override
KIND_1(LVScopeKind, IsTryBlock, IsBlock)
KIND_2(LVScopeKind, IsModule, CanHaveRanges, CanHaveLines)
virtual void printSizes(raw_ostream &OS) const
std::unique_ptr< LVElements > Children
std::unique_ptr< LVTypes > Types
LVScope(const LVScope &)=delete
uint32_t getBitSize() const override
KIND_1(LVScopeKind, IsStructure, IsAggregate)
virtual StringRef getEncodedArgs() const
std::unique_ptr< LVLines > Lines
KIND(LVScopeKind, IsAggregate)
unsigned getCoverageFactor() const
KIND_1(LVScopeKind, IsLabel, IsFunction)
void setBitSize(uint32_t Size) override
virtual void printWarnings(raw_ostream &OS, bool Full=true) const
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)
size_t rangeCount() const
KIND_2(LVScopeKind, IsFunction, CanHaveRanges, CanHaveLines)
KIND_2(LVScopeKind, IsInlinedFunction, IsFunction, IsInlined)
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::pair< LVAddress, uint64_t > LVNameInfo
std::map< LVOffset, LVElement * > LVOffsetElementMap
LLVM_ABI LVStringPool & getStringPool()
SmallVector< LVElement *, 8 > LVElements
bool(LVScope::*)() const LVScopeGetFunction
std::map< LVOffset, LVLines > LVOffsetLinesMap
std::map< LVOffset, LVLocations > LVOffsetLocationsMap
void addItem(MapType *Map, KeyType Key, ValueType Value)
SmallVector< LVScope *, 8 > LVScopes
std::map< LVScopeKind, LVScopeGetFunction > LVScopeDispatch
bool(LVLocation::*)() LVValidLocation
void(LVScope::*)() LVScopeSetFunction
SmallVector< LVSymbol *, 8 > LVSymbols
std::set< LVScopeKind > LVScopeKindSet
std::map< LVScope *, LVNameInfo > LVPublicNames
std::map< dwarf::Tag, LVOffsets > LVTagOffsetsMap
std::pair< LVLine *, LVLine * > LVLineRange
std::vector< LVScopeGetFunction > LVScopeRequest
SmallVector< LVLine *, 8 > LVLines
bool(LVObject::*)() const LVObjectGetFunction
std::map< LVOffset, LVSymbol * > LVOffsetSymbolMap
SmallVector< LVType *, 8 > LVTypes
void(LVObject::*)() LVObjectSetFunction
SmallVector< LVLocation *, 8 > LVLocations
std::map< LVAddress, LVNameInfo > LVPublicAddresses
This is an optimization pass for GlobalISel generic memory operations.
void sort(IteratorTy Start, IteratorTy End)
A source language supported by any of the debug info representations.