LLVM  8.0.0svn
Classes | Functions
CodeViewDebug.cpp File Reference
#include "CodeViewDebug.h"
#include "DwarfExpression.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h"
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeTableCollection.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <limits>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  llvm::CodeViewDebug::TypeLoweringScope
 
struct  llvm::ClassInfo
 
struct  llvm::ClassInfo::MemberInfo
 

Functions

static CPUType mapArchToCVCPUType (Triple::ArchType Type)
 
static StringRef getPrettyScopeName (const DIScope *Scope)
 
static const DISubprogramgetQualifiedNameComponents (const DIScope *Scope, SmallVectorImpl< StringRef > &QualifiedNameComponents)
 
static std::string getQualifiedName (ArrayRef< StringRef > QualifiedNameComponents, StringRef TypeName)
 
static std::string getFullyQualifiedName (const DIScope *Scope, StringRef Name)
 
static std::string getFullyQualifiedName (const DIScope *Ty)
 
static bool isTrivial (const DICompositeType *DCTy)
 
static FunctionOptions getFunctionOptions (const DISubroutineType *Ty, const DICompositeType *ClassTy=nullptr, StringRef SPName=StringRef(""))
 
static void addLocIfNotPresent (SmallVectorImpl< const DILocation *> &Locs, const DILocation *Loc)
 
static void emitNullTerminatedSymbolName (MCStreamer &OS, StringRef S, unsigned MaxFixedRecordLength=0xF00)
 
static SourceLanguage MapDWLangToCVLang (unsigned DWLang)
 
static Version parseVersion (StringRef Name)
 
static TypeIndex getStringIdTypeIdx (GlobalTypeTableBuilder &TypeTable, StringRef S)
 
static bool canUseReferenceType (const DbgVariableLocation &Loc)
 
static bool needsReferenceType (const DbgVariableLocation &Loc)
 
static bool shouldEmitUdt (const DIType *T)
 
static PointerToMemberRepresentation translatePtrToMemberRep (unsigned SizeInBytes, bool IsPMF, unsigned Flags)
 
static CallingConvention dwarfCCToCodeView (unsigned DwarfCC)
 Given a DWARF calling convention, get the CodeView equivalent. More...
 
static MemberAccess translateAccessFlags (unsigned RecordTag, unsigned Flags)
 
static MethodOptions translateMethodOptionFlags (const DISubprogram *SP)
 
static MethodKind translateMethodKindFlags (const DISubprogram *SP, bool Introduced)
 
static TypeRecordKind getRecordKind (const DICompositeType *Ty)
 
static ClassOptions getCommonClassOptions (const DICompositeType *Ty)
 Return ClassOptions that should be present on both the forward declaration and the defintion of a tag type. More...
 
static bool shouldAlwaysEmitCompleteClassType (const DICompositeType *Ty)
 
template<typename T >
static void copyBytesForDefRange (SmallString< 20 > &BytePrefix, SymbolKind SymKind, const T &DefRangeHeader)
 Only call this on endian-specific types like ulittle16_t and little32_t, or structs composed of them. More...
 

Function Documentation

◆ addLocIfNotPresent()

static void addLocIfNotPresent ( SmallVectorImpl< const DILocation *> &  Locs,
const DILocation Loc 
)
static

◆ canUseReferenceType()

static bool canUseReferenceType ( const DbgVariableLocation Loc)
static

◆ copyBytesForDefRange()

template<typename T >
static void copyBytesForDefRange ( SmallString< 20 > &  BytePrefix,
SymbolKind  SymKind,
const T DefRangeHeader 
)
static

Only call this on endian-specific types like ulittle16_t and little32_t, or structs composed of them.

Definition at line 2579 of file CodeViewDebug.cpp.

References llvm::SmallVectorImpl< T >::append(), assert(), llvm::codeview::DefRangeRegisterRelSym::Header::BasePointerOffset, llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorImpl< char >::clear(), llvm::MCContext::createTempSymbol(), llvm::dyn_cast(), emitNullTerminatedSymbolName(), llvm::codeview::encodeFramePtrReg(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::N86::ESP, llvm::codeview::DefRangeRegisterRelSym::Header::Flags, llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::LexicalScope::getChildren(), llvm::MachineModuleInfo::getContext(), llvm::codeview::TypeIndex::getIndex(), llvm::DebugHandlerBase::getLabelAfterInsn(), llvm::DebugHandlerBase::getLabelBeforeInsn(), llvm::DIScope::getName(), llvm::LexicalScope::getRanges(), llvm::LexicalScope::getScopeNode(), llvm::LexicalScope::isAbstractScope(), llvm::codeview::DefRangeRegisterSym::Header::MayHaveNoName, llvm::codeview::DefRangeSubfieldRegisterSym::Header::MayHaveNoName, llvm::DebugHandlerBase::MMI, llvm::None, llvm::codeview::DefRangeSubfieldRegisterSym::Header::OffsetInParent, llvm::SmallVectorTemplateBase< T, bool >::push_back(), Reg, llvm::codeview::DefRangeRegisterSym::Header::Register, llvm::codeview::DefRangeSubfieldRegisterSym::Header::Register, llvm::codeview::DefRangeRegisterRelSym::Header::Register, llvm::SmallVectorImpl< char >::resize(), and llvm::SmallVectorBase::size().

◆ dwarfCCToCodeView()

static CallingConvention dwarfCCToCodeView ( unsigned  DwarfCC)
static

◆ emitNullTerminatedSymbolName()

static void emitNullTerminatedSymbolName ( MCStreamer OS,
StringRef  S,
unsigned  MaxFixedRecordLength = 0xF00 
)
static

◆ getCommonClassOptions()

static ClassOptions getCommonClassOptions ( const DICompositeType Ty)
static

◆ getFullyQualifiedName() [1/2]

static std::string getFullyQualifiedName ( const DIScope Scope,
StringRef  Name 
)
static

◆ getFullyQualifiedName() [2/2]

static std::string getFullyQualifiedName ( const DIScope Ty)
static

◆ getFunctionOptions()

static FunctionOptions getFunctionOptions ( const DISubroutineType Ty,
const DICompositeType ClassTy = nullptr,
StringRef  SPName = StringRef("") 
)
static

◆ getPrettyScopeName()

static StringRef getPrettyScopeName ( const DIScope Scope)
static

◆ getQualifiedName()

static std::string getQualifiedName ( ArrayRef< StringRef QualifiedNameComponents,
StringRef  TypeName 
)
static

Definition at line 278 of file CodeViewDebug.cpp.

References llvm::reverse().

Referenced by getFullyQualifiedName(), and shouldEmitUdt().

◆ getQualifiedNameComponents()

static const DISubprogram* getQualifiedNameComponents ( const DIScope Scope,
SmallVectorImpl< StringRef > &  QualifiedNameComponents 
)
static

◆ getRecordKind()

static TypeRecordKind getRecordKind ( const DICompositeType Ty)
static

◆ getStringIdTypeIdx()

static TypeIndex getStringIdTypeIdx ( GlobalTypeTableBuilder TypeTable,
StringRef  S 
)
static

◆ isTrivial()

static bool isTrivial ( const DICompositeType DCTy)
static

Definition at line 364 of file CodeViewDebug.cpp.

References llvm::DIType::getFlags().

Referenced by despeculateCountZeros(), and getFunctionOptions().

◆ mapArchToCVCPUType()

static CPUType mapArchToCVCPUType ( Triple::ArchType  Type)
static

◆ MapDWLangToCVLang()

static SourceLanguage MapDWLangToCVLang ( unsigned  DWLang)
static

◆ needsReferenceType()

static bool needsReferenceType ( const DbgVariableLocation Loc)
static

◆ parseVersion()

static Version parseVersion ( StringRef  Name)
static

◆ shouldAlwaysEmitCompleteClassType()

static bool shouldAlwaysEmitCompleteClassType ( const DICompositeType Ty)
static

◆ shouldEmitUdt()

static bool shouldEmitUdt ( const DIType T)
static

◆ translateAccessFlags()

static MemberAccess translateAccessFlags ( unsigned  RecordTag,
unsigned  Flags 
)
static

◆ translateMethodKindFlags()

static MethodKind translateMethodKindFlags ( const DISubprogram SP,
bool  Introduced 
)
static

Definition at line 1943 of file CodeViewDebug.cpp.

References llvm_unreachable, and llvm::Reloc::Static.

Referenced by shouldAlwaysEmitCompleteClassType().

◆ translateMethodOptionFlags()

static MethodOptions translateMethodOptionFlags ( const DISubprogram SP)
static

Definition at line 1934 of file CodeViewDebug.cpp.

References llvm::None.

Referenced by shouldAlwaysEmitCompleteClassType().

◆ translatePtrToMemberRep()

static PointerToMemberRepresentation translatePtrToMemberRep ( unsigned  SizeInBytes,
bool  IsPMF,
unsigned  Flags 
)
static