14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
100 static const LVTypes EmptyTypes;
108 unsigned CoverageFactor = 0;
111 void calculateCoverage() {
112 float CoveragePercentage = 0;
119 bool resolvePrinting()
const;
204 bool isRoot()
const override {
return getIsRoot(); }
206 const char *kind()
const override;
234 void addElement(
LVScope *Scope);
261 bool RecordInvalid =
false);
263 bool RecordInvalid =
false);
264 void getRanges(
LVRange &RangeList);
269 bool Full =
true)
const override;
275 bool getTemplateParameterTypes(
LVTypes &Params);
288 bool removeElement(
LVElement *Element)
override;
289 void updateLevel(
LVScope *Parent,
bool Moved)
override;
294 void resolve()
override;
295 void resolveName()
override;
296 void resolveReferences()
override;
301 void encodeTemplateArguments(std::string &
Name)
const;
302 void encodeTemplateArguments(std::string &
Name,
const LVTypes *
Types)
const;
304 void resolveElements();
309 static void markMissingParents(
const LVScopes *References,
311 bool TraverseChildren);
315 virtual void markMissingParents(
const LVScope *
Target,
bool TraverseChildren);
319 virtual bool equalNumberOfChildren(
const LVScope *Scope)
const;
322 virtual bool equals(
const LVScope *Scope)
const;
346 size_t EncodedArgsIndex = 0;
372 bool equals(
const LVScope *Scope)
const override;
385 setIsTemplateAlias();
417 std::vector<size_t> Filenames;
426 size_t ProducerIndex = 0;
429 size_t CompilationDirectoryIndex = 0;
451 using LVAddressToLine = std::map<LVAddress, LVLine *>;
474 using LVSizesMap = std::map<const LVScope *, LVOffset>;
489 static constexpr size_t TotalInitialSize = 8;
490 using LVTotalsEntry = std::pair<unsigned, float>;
528 PublicNames.emplace(std::piecewise_construct, std::forward_as_tuple(
Scope),
529 std::forward_as_tuple(LowPC, HighPC - LowPC));
532 LVPublicNames::iterator Iter = PublicNames.find(
Scope);
533 return (Iter != PublicNames.end()) ? Iter->second :
NameNone;
549 CompilationDirectoryIndex =
getStringPool().getIndex(CompilationDirectory);
575 void addInvalidCoverage(
LVSymbol *Symbol);
586 return InvalidLocations;
589 return InvalidCoverages;
595 void processRangeLocationCoverage(
601 void propagatePatternMatch();
608 const char *Header)
const;
610 void incrementPrintedLines();
611 void incrementPrintedScopes();
612 void incrementPrintedSymbols();
613 void incrementPrintedTypes();
617 void increment(
LVScope *Scope);
625 void addedElement(
LVScope *Scope);
626 void addedElement(
LVSymbol *Symbol);
632 bool equals(
const LVScope *Scope)
const override;
637 void printMatchedElements(
raw_ostream &OS,
bool UseMatchedElements)
override;
672 size_t LinkageNameIndex = 0;
673 size_t EncodedArgsIndex = 0;
706 void setName(
StringRef ObjectName)
override;
708 void resolveExtra()
override;
709 void resolveReferences()
override;
712 bool equals(
const LVScope *Scope)
const override;
723 size_t CallFilenameIndex = 0;
735 Discriminator =
Value;
736 setHasDiscriminator();
743 CallFilenameIndex = Index;
752 void resolveExtra()
override;
755 bool equals(
const LVScope *Scope)
const override;
813 bool equals(
const LVScope *Scope)
const override;
824 size_t FileFormatNameIndex = 0;
836 FileFormatNameIndex =
getStringPool().getIndex(FileFormatName);
841 void transformScopedName();
844 void processRangeInformation();
847 bool equals(
const LVScope *Scope)
const override;
852 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)
LVElementsView getChildren() const
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
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< 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
LVSortValue(*)(const LVObject *LHS, const LVObject *RHS) LVSortFunction
void(LVScope::*)() LVScopeSetFunction
detail::concat_range< LVElement *const, const LVScopes &, const LVTypes &, const LVSymbols & > LVElementsView
SmallVector< LVSymbol *, 8 > LVSymbols
LLVM_ABI LVSortFunction getSortFunction()
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.
detail::concat_range< ValueT, RangeTs... > concat(RangeTs &&...Ranges)
Returns a concatenated range across two or more ranges.
void sort(IteratorTy Start, IteratorTy End)
A source language supported by any of the debug info representations.