LLVM  13.0.0git
Classes | Functions
CodeViewDebug.cpp File Reference
#include "CodeViewDebug.h"
#include "DwarfExpression.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.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/CodeViewRecordIO.h"
#include "llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h"
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/EnumTables.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeTableCollection.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfoMetadata.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/BinaryStreamWriter.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.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 <iterator>
#include <limits>

Go to the source code of this file.


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


static CPUType mapArchToCVCPUType (Triple::ArchType Type)
static StringRef getPrettyScopeName (const DIScope *Scope)
static std::string formatNestedName (ArrayRef< StringRef > QualifiedNameComponents, StringRef TypeName)
static StringRef removeTemplateArgs (StringRef Name)
static bool isNonTrivial (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)
static bool isUsableDebugLoc (DebugLoc DL)
static StringRef getSymbolName (SymbolKind SymKind)
static bool isFloatDIType (const DIType *Ty)

Function Documentation

◆ addLocIfNotPresent()

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

Definition at line 496 of file CodeViewDebug.cpp.

References llvm::is_contained().

◆ canUseReferenceType()

static bool canUseReferenceType ( const DbgVariableLocation Loc)

Definition at line 1239 of file CodeViewDebug.cpp.

References llvm::DbgVariableLocation::LoadChain.

◆ dwarfCCToCodeView()

static CallingConvention dwarfCCToCodeView ( unsigned  DwarfCC)

Given a DWARF calling convention, get the CodeView equivalent.

If we don't have a translation, use the NearC convention.

Definition at line 1839 of file CodeViewDebug.cpp.

References llvm::lltok::DwarfCC.

◆ emitNullTerminatedSymbolName()

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

◆ formatNestedName()

static std::string formatNestedName ( ArrayRef< StringRef QualifiedNameComponents,
StringRef  TypeName 

◆ getCommonClassOptions()

static ClassOptions getCommonClassOptions ( const DICompositeType Ty)

Return ClassOptions that should be present on both the forward declaration and the defintion of a tag type.

Definition at line 2049 of file CodeViewDebug.cpp.

References llvm::StringRef::empty(), llvm::DICompositeType::getIdentifier(), llvm::DIType::getScope(), llvm::DINode::getTag(), and llvm::None.

◆ getFunctionOptions()

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

◆ getPrettyScopeName()

static StringRef getPrettyScopeName ( const DIScope Scope)

Definition at line 263 of file CodeViewDebug.cpp.

References llvm::StringRef::empty().

◆ getRecordKind()

static TypeRecordKind getRecordKind ( const DICompositeType Ty)

Definition at line 2036 of file CodeViewDebug.cpp.

References llvm::tgtok::Class, llvm::DINode::getTag(), and llvm_unreachable.

◆ getStringIdTypeIdx()

static TypeIndex getStringIdTypeIdx ( GlobalTypeTableBuilder TypeTable,
StringRef  S 

◆ getSymbolName()

static StringRef getSymbolName ( SymbolKind  SymKind)

◆ isFloatDIType()

static bool isFloatDIType ( const DIType Ty)

Definition at line 3196 of file CodeViewDebug.cpp.

References assert(), llvm::DINode::getTag(), and T.

◆ isNonTrivial()

static bool isNonTrivial ( const DICompositeType DCTy)

Definition at line 413 of file CodeViewDebug.cpp.

References llvm::DIType::getFlags().

Referenced by getFunctionOptions().

◆ isUsableDebugLoc()

static bool isUsableDebugLoc ( DebugLoc  DL)

Definition at line 2942 of file CodeViewDebug.cpp.

References DL.

Referenced by llvm::CodeViewDebug::beginInstruction().

◆ mapArchToCVCPUType()

static CPUType mapArchToCVCPUType ( Triple::ArchType  Type)

◆ MapDWLangToCVLang()

static SourceLanguage MapDWLangToCVLang ( unsigned  DWLang)

◆ needsReferenceType()

static bool needsReferenceType ( const DbgVariableLocation Loc)

Definition at line 1243 of file CodeViewDebug.cpp.

References llvm::DbgVariableLocation::LoadChain.

◆ parseVersion()

static Version parseVersion ( StringRef  Name)

Definition at line 779 of file CodeViewDebug.cpp.

References N, and llvm::IndexedInstrProf::Version.

◆ removeTemplateArgs()

static StringRef removeTemplateArgs ( StringRef  Name)

Definition at line 361 of file CodeViewDebug.cpp.

References i.

◆ shouldAlwaysEmitCompleteClassType()

static bool shouldAlwaysEmitCompleteClassType ( const DICompositeType Ty)

◆ shouldEmitUdt()

static bool shouldEmitUdt ( const DIType T)

Definition at line 1478 of file CodeViewDebug.cpp.

References T.

◆ translateAccessFlags()

static MemberAccess translateAccessFlags ( unsigned  RecordTag,
unsigned  Flags 

Definition at line 1994 of file CodeViewDebug.cpp.

References llvm::DINode::FlagAccessibility, and llvm_unreachable.

◆ translateMethodKindFlags()

static MethodKind translateMethodKindFlags ( const DISubprogram SP,
bool  Introduced 

Definition at line 2016 of file CodeViewDebug.cpp.

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

◆ translateMethodOptionFlags()

static MethodOptions translateMethodOptionFlags ( const DISubprogram SP)

Definition at line 2007 of file CodeViewDebug.cpp.

References llvm::None.

◆ translatePtrToMemberRep()

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