diff options
Diffstat (limited to 'include/llvm/MC/MCCodeView.h')
-rw-r--r-- | include/llvm/MC/MCCodeView.h | 66 |
1 files changed, 16 insertions, 50 deletions
diff --git a/include/llvm/MC/MCCodeView.h b/include/llvm/MC/MCCodeView.h index e2249f49c86c..1d9e3c6698cf 100644 --- a/include/llvm/MC/MCCodeView.h +++ b/include/llvm/MC/MCCodeView.h @@ -27,7 +27,7 @@ class MCObjectStreamer; class MCStreamer; class CodeViewContext; -/// \brief Instances of this class represent the information from a +/// Instances of this class represent the information from a /// .cv_loc directive. class MCCVLoc { uint32_t FunctionId; @@ -50,13 +50,13 @@ private: // CodeViewContext manages these public: unsigned getFunctionId() const { return FunctionId; } - /// \brief Get the FileNum of this MCCVLoc. + /// Get the FileNum of this MCCVLoc. unsigned getFileNum() const { return FileNum; } - /// \brief Get the Line of this MCCVLoc. + /// Get the Line of this MCCVLoc. unsigned getLine() const { return Line; } - /// \brief Get the Column of this MCCVLoc. + /// Get the Column of this MCCVLoc. unsigned getColumn() const { return Column; } bool isPrologueEnd() const { return PrologueEnd; } @@ -64,13 +64,13 @@ public: void setFunctionId(unsigned FID) { FunctionId = FID; } - /// \brief Set the FileNum of this MCCVLoc. + /// Set the FileNum of this MCCVLoc. void setFileNum(unsigned fileNum) { FileNum = fileNum; } - /// \brief Set the Line of this MCCVLoc. + /// Set the Line of this MCCVLoc. void setLine(unsigned line) { Line = line; } - /// \brief Set the Column of this MCCVLoc. + /// Set the Column of this MCCVLoc. void setColumn(unsigned column) { assert(column <= UINT16_MAX); Column = column; @@ -80,7 +80,7 @@ public: void setIsStmt(bool IS) { IsStmt = IS; } }; -/// \brief Instances of this class represent the line information for +/// Instances of this class represent the line information for /// the CodeView line table entries. Which is created after a machine /// instruction is assembled and uses an address from a temporary label /// created at the current address in the current section and the info from @@ -177,13 +177,7 @@ public: unsigned IACol); /// Retreive the function info if this is a valid function id, or nullptr. - MCCVFunctionInfo *getCVFunctionInfo(unsigned FuncId) { - if (FuncId >= Functions.size()) - return nullptr; - if (Functions[FuncId].isUnallocatedFunctionInfo()) - return nullptr; - return &Functions[FuncId]; - } + MCCVFunctionInfo *getCVFunctionInfo(unsigned FuncId); /// Saves the information from the currently parsed .cv_loc directive /// and sets CVLocSeen. When the next instruction is assembled an entry @@ -199,50 +193,22 @@ public: CurrentCVLoc.setIsStmt(IsStmt); CVLocSeen = true; } - void clearCVLocSeen() { CVLocSeen = false; } bool getCVLocSeen() { return CVLocSeen; } + void clearCVLocSeen() { CVLocSeen = false; } + const MCCVLoc &getCurrentCVLoc() { return CurrentCVLoc; } bool isValidCVFileNumber(unsigned FileNumber); - /// \brief Add a line entry. - void addLineEntry(const MCCVLineEntry &LineEntry) { - size_t Offset = MCCVLines.size(); - auto I = MCCVLineStartStop.insert( - {LineEntry.getFunctionId(), {Offset, Offset + 1}}); - if (!I.second) - I.first->second.second = Offset + 1; - MCCVLines.push_back(LineEntry); - } + /// Add a line entry. + void addLineEntry(const MCCVLineEntry &LineEntry); - std::vector<MCCVLineEntry> getFunctionLineEntries(unsigned FuncId) { - std::vector<MCCVLineEntry> FilteredLines; + std::vector<MCCVLineEntry> getFunctionLineEntries(unsigned FuncId); - auto I = MCCVLineStartStop.find(FuncId); - if (I != MCCVLineStartStop.end()) - for (size_t Idx = I->second.first, End = I->second.second; Idx != End; - ++Idx) - if (MCCVLines[Idx].getFunctionId() == FuncId) - FilteredLines.push_back(MCCVLines[Idx]); - return FilteredLines; - } - - std::pair<size_t, size_t> getLineExtent(unsigned FuncId) { - auto I = MCCVLineStartStop.find(FuncId); - // Return an empty extent if there are no cv_locs for this function id. - if (I == MCCVLineStartStop.end()) - return {~0ULL, 0}; - return I->second; - } + std::pair<size_t, size_t> getLineExtent(unsigned FuncId); - ArrayRef<MCCVLineEntry> getLinesForExtent(size_t L, size_t R) { - if (R <= L) - return None; - if (L >= MCCVLines.size()) - return None; - return makeArrayRef(&MCCVLines[L], R - L); - } + ArrayRef<MCCVLineEntry> getLinesForExtent(size_t L, size_t R); /// Emits a line table substream. void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId, |