14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVSCOPE_H
27namespace logicalview {
102 unsigned CoverageFactor = 0;
105 void calculateCoverage() {
106 float CoveragePercentage = 0;
107 LVLocation::calculateCoverage(
Ranges.get(), CoverageFactor,
113 bool resolvePrinting()
const;
140 void resolveTemplate();
143 void printActiveRanges(
raw_ostream &
OS,
bool Full =
true)
const;
206 bool isRoot()
const override {
return getIsRoot(); }
208 const char *kind()
const override;
220 void addElement(
LVScope *Scope);
229 void addMissingElements(
LVScope *Reference);
240 size_t symbolCount()
const {
return Symbols ? Symbols->size() : 0; }
248 bool RecordInvalid =
false);
250 bool RecordInvalid =
false);
251 void getRanges(
LVRange &RangeList);
256 bool Full =
true)
const override;
262 bool getTemplateParameterTypes(
LVTypes &Params);
268 return LVElement::getCompileUnitParent();
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;
325 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
333 size_t EncodedArgsIndex = 0;
348 setReference(
static_cast<LVScope *
>(Element));
359 bool equals(
const LVScope *Scope)
const override;
365 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
372 setIsTemplateAlias();
380 bool equals(
const LVScope *Scope)
const override;
382 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
393 void resolveExtra()
override;
396 bool equals(
const LVScope *Scope)
const override;
398 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
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>;
469 addInvalidOffset(
Offset, Element);
470 addItem<LVOffsetLocationsMap, LVOffset, LVLocation *>(Map,
Offset,
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;
562 void addInvalidCoverage(
LVSymbol *Symbol);
564 void addInvalidLocation(
LVLocation *Location);
573 return InvalidLocations;
576 return InvalidCoverages;
582 void processRangeLocationCoverage(
588 void propagatePatternMatch();
593 void printLocalNames(
raw_ostream &
OS,
bool Full =
true)
const;
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;
622 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
623 void printWarnings(
raw_ostream &
OS,
bool Full =
true)
const override;
624 void printMatchedElements(
raw_ostream &
OS,
bool UseMatchedElements)
override;
636 bool equals(
const LVScope *Scope)
const override;
638 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
651 bool equals(
const LVScope *Scope)
const override;
653 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
659 size_t LinkageNameIndex = 0;
660 size_t EncodedArgsIndex = 0;
675 setReference(
static_cast<LVScope *
>(Element));
693 void setName(
StringRef ObjectName)
override;
695 void resolveExtra()
override;
696 void resolveReferences()
override;
699 bool equals(
const LVScope *Scope)
const override;
705 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
710 size_t CallFilenameIndex = 0;
723 setHasDiscriminator();
730 CallFilenameIndex =
Index;
736 return lineAsString(getCallLineNumber(), getDiscriminator(), ShowZero);
739 void resolveExtra()
override;
742 bool equals(
const LVScope *Scope)
const override;
748 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
759 void resolveExtra()
override;
774 bool equals(
const LVScope *Scope)
const override;
776 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
796 setReference(
static_cast<LVScope *
>(Element));
800 bool equals(
const LVScope *Scope)
const override;
806 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
811 size_t FileFormatNameIndex = 0;
828 void transformScopedName();
831 void processRangeInformation();
834 bool equals(
const LVScope *Scope)
const override;
837 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
839 bool UseMatchedElements)
const;
852 bool equals(
const LVScope *Scope)
const override;
854 void printExtra(
raw_ostream &
OS,
bool Full =
true)
const override;
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'.
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.
LVSubclassID getSubclassID() const
LVOffset getOffset() 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
LVScopeAlias & operator=(const LVScopeAlias &)=delete
LVScopeArray(const LVScopeArray &)=delete
LVScopeArray & operator=(const LVScopeArray &)=delete
const LVScopes & getMatchedScopes() const
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 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
StringRef getProducer() const override
const LVNameInfo & findPublicName(LVScope *Scope)
void setSourceLanguage(LVSourceLanguage SL) override
LVScope * getCompileUnitParent() const override
LVScopeEnumeration(const LVScopeEnumeration &)=delete
~LVScopeEnumeration()=default
LVScopeEnumeration & operator=(const LVScopeEnumeration &)=delete
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
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
LVScopeModule & operator=(const LVScopeModule &)=delete
LVScopeModule(const LVScopeModule &)=delete
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
~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)
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)
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)
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....
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration in the Microsoft Debug Interface Access SDK,...
std::map< LVOffset, LVElement * > LVOffsetElementMap
std::set< LVScopeKind > LVScopeKindSet
LLVM_ABI 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.
void sort(IteratorTy Start, IteratorTy End)
A source language supported by any of the debug info representations.