[llvm] [DebugInfo] Update CodeView enums (PR #71038)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 2 01:41:33 PDT 2023
https://github.com/nikitalita created https://github.com/llvm/llvm-project/pull/71038
This adds the following values to the CodeView.h enums (and updates the various functions that use them):
* CPUType:
* Added `Unknown`
* This is not currently documented in the online documentation, but this is present in `cvconst.h` in the latest DIA SDK (Visual Studio 2022, 17.7.6)
* `Unknown` is the CPUType that is emitted by `aliasobj.exe` in the Compile3Sym records, and can be found in objects that link with `oldnames.lib`
![image](https://github.com/llvm/llvm-project/assets/69168929/8ee7b032-761b-45da-8439-d07aba797940)
* SourceLanguage (All of these are documented at https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang?view=vs-2022 and are present in `cvconst.h` in the latest DIA SDK (Visual Studio 2022, 17.7.6))
* Added Go
* Added AliasObj
* emitted by `aliasobj.exe` in certain records, can be found in PDBs that link with `oldnames.lib`
* Changed Swift to the official Microsoft enumeration
* Added `OldSwift`
* The old Swift enumeration of `S` was changed to `OldSwift` to allow pdb dumping utilities to continue to emit correct source language information for old PDBs
### WARNING
The `Swift` change is a potentially breaking change, as the swift compiler will now emit `0x13` for the SourceLanguage type in PDB records instead of `S`. This could potentially break utilities that relied on the old enum value.
* CallType
* Added Swift
* This is not currently documented in the online documentation, but this is present in `cvconst.h` in the latest DIA SDK (Visual Studio 2022, 17.7.6)
>From 852fecc3a2c3f4a6ae03a3e26fe92241db688fc1 Mon Sep 17 00:00:00 2001
From: nikitalita <69168929+nikitalita at users.noreply.github.com>
Date: Wed, 1 Nov 2023 23:11:40 -0700
Subject: [PATCH] [DebugInfo] Update CodeView enums
---
.../llvm/DebugInfo/CodeView/CodeView.h | 19 +++++++++++++------
llvm/lib/DebugInfo/CodeView/EnumTables.cpp | 4 ++++
.../DebugInfo/CodeView/TypeDumpVisitor.cpp | 1 +
llvm/lib/DebugInfo/PDB/PDBExtras.cpp | 4 ++++
llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp | 1 +
.../llvm-pdbutil/MinimalSymbolDumper.cpp | 4 ++++
llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp | 1 +
7 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
index 62e559e2cebaef7..4345aa9759a9548 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
@@ -135,11 +135,13 @@ enum class CPUType : uint16_t {
HybridX86ARM64 = 0xf7,
ARM64EC = 0xf8,
ARM64X = 0xf9,
+ Unknown = 0xff,
D3D11_Shader = 0x100,
};
/// These values correspond to the CV_CFL_LANG enumeration in the Microsoft
-/// Debug Interface Access SDK
+/// Debug Interface Access SDK, and are documented here:
+/// https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang
enum SourceLanguage : uint8_t {
C = 0x00,
Cpp = 0x01,
@@ -160,13 +162,17 @@ enum SourceLanguage : uint8_t {
HLSL = 0x10,
ObjC = 0x11,
ObjCpp = 0x12,
-
+ Swift = 0x13,
+ AliasObj = 0x14,
Rust = 0x15,
+ Go = 0x16,
- /// The DMD & Swift compilers emit 'D' and 'S', respectively, for the CV
- /// source language. Microsoft does not have enumerators for them yet.
+ /// The DMD compiler emits 'D' for the CV source language. Microsoft does not
+ /// have an enumerator for it yet.
D = 'D',
- Swift = 'S',
+ /// The Swift compiler used to emit 'S' for the CV source language, but
+ /// current versions emit the enumerator defined above.
+ OldSwift = 'S',
};
/// These values correspond to the CV_call_e enumeration, and are documented
@@ -199,7 +205,8 @@ enum class CallingConvention : uint8_t {
ClrCall = 0x16, // clr call
Inline =
0x17, // Marker for routines always inlined and thus lacking a convention
- NearVector = 0x18 // near left to right push with regs, callee pops stack
+ NearVector = 0x18, // near left to right push with regs, callee pops stack
+ Swift = 0x19, // Swift call
};
enum class ClassOptions : uint16_t {
diff --git a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp
index 7e3087373bfa0b5..fa8bccf1e48fa4b 100644
--- a/llvm/lib/DebugInfo/CodeView/EnumTables.cpp
+++ b/llvm/lib/DebugInfo/CodeView/EnumTables.cpp
@@ -106,6 +106,8 @@ static const EnumEntry<codeview::SourceLanguage> SourceLanguages[] = {
CV_ENUM_ENT(SourceLanguage, HLSL), CV_ENUM_ENT(SourceLanguage, D),
CV_ENUM_ENT(SourceLanguage, Swift), CV_ENUM_ENT(SourceLanguage, Rust),
CV_ENUM_ENT(SourceLanguage, ObjC), CV_ENUM_ENT(SourceLanguage, ObjCpp),
+ CV_ENUM_ENT(SourceLanguage, AliasObj), CV_ENUM_ENT(SourceLanguage, Go),
+ {"Swift", SourceLanguage::OldSwift},
};
static const EnumEntry<uint32_t> CompileSym2FlagNames[] = {
@@ -205,6 +207,7 @@ static const EnumEntry<unsigned> CPUTypeNames[] = {
CV_ENUM_CLASS_ENT(CPUType, HybridX86ARM64),
CV_ENUM_CLASS_ENT(CPUType, ARM64EC),
CV_ENUM_CLASS_ENT(CPUType, ARM64X),
+ CV_ENUM_CLASS_ENT(CPUType, Unknown),
CV_ENUM_CLASS_ENT(CPUType, D3D11_Shader),
};
@@ -421,6 +424,7 @@ static const EnumEntry<uint8_t> CallingConventions[] = {
CV_ENUM_CLASS_ENT(CallingConvention, ClrCall),
CV_ENUM_CLASS_ENT(CallingConvention, Inline),
CV_ENUM_CLASS_ENT(CallingConvention, NearVector),
+ CV_ENUM_CLASS_ENT(CallingConvention, Swift),
};
static const EnumEntry<uint8_t> FunctionOptionEnum[] = {
diff --git a/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp b/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp
index df7e42df1afcd21..776676410e782b8 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp
@@ -133,6 +133,7 @@ static const EnumEntry<uint8_t> CallingConventions[] = {
ENUM_ENTRY(CallingConvention, ClrCall),
ENUM_ENTRY(CallingConvention, Inline),
ENUM_ENTRY(CallingConvention, NearVector),
+ ENUM_ENTRY(CallingConvention, Swift),
};
static const EnumEntry<uint8_t> FunctionOptionEnum[] = {
diff --git a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
index 2b318bf1c6488f5..cb8afabec0db36d 100644
--- a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
@@ -96,6 +96,7 @@ raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, ClrCall , "clrcall", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Inline , "inlinecall", OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, NearVector , "vectorcall", OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_CallingConv, Swift, "swiftcall", OS)
}
return OS;
}
@@ -234,6 +235,9 @@ raw_ostream &llvm::pdb::operator<<(raw_ostream &OS, const PDB_Lang &Lang) {
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Rust, OS)
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, ObjC, OS)
CASE_OUTPUT_ENUM_CLASS_STR(PDB_Lang, ObjCpp, "ObjC++", OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, AliasObj, OS)
+ CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Go, OS)
+ CASE_OUTPUT_ENUM_CLASS_STR(PDB_Lang, OldSwift, "Swift", OS)
}
return OS;
}
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
index 99689786a13cce8..f4ca1b22eafa0dc 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
@@ -259,6 +259,7 @@ void ScalarEnumerationTraits<CallingConvention>::enumeration(
IO.enumCase(Value, "ClrCall", CallingConvention::ClrCall);
IO.enumCase(Value, "Inline", CallingConvention::Inline);
IO.enumCase(Value, "NearVector", CallingConvention::NearVector);
+ IO.enumCase(Value, "Swift", CallingConvention::Swift);
}
void ScalarEnumerationTraits<PointerKind>::enumeration(IO &IO,
diff --git a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
index 1beb2d2827441ea..479d025835188bd 100644
--- a/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
@@ -213,6 +213,9 @@ static std::string formatSourceLanguage(SourceLanguage Lang) {
RETURN_CASE(SourceLanguage, Rust, "rust");
RETURN_CASE(SourceLanguage, ObjC, "objc");
RETURN_CASE(SourceLanguage, ObjCpp, "objc++");
+ RETURN_CASE(SourceLanguage, AliasObj, "aliasobj");
+ RETURN_CASE(SourceLanguage, Go, "go");
+ RETURN_CASE(SourceLanguage, OldSwift, "swift");
}
return formatUnknownEnum(Lang);
}
@@ -282,6 +285,7 @@ static std::string formatMachineType(CPUType Cpu) {
RETURN_CASE(CPUType, Thumb, "thumb");
RETURN_CASE(CPUType, ARMNT, "arm nt");
RETURN_CASE(CPUType, D3D11_Shader, "d3d11 shader");
+ RETURN_CASE(CPUType, Unknown, "unknown");
}
return formatUnknownEnum(Cpu);
}
diff --git a/llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp b/llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp
index aaa430a9572e800..a4077820eb03c81 100644
--- a/llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp
@@ -125,6 +125,7 @@ static std::string formatCallingConvention(CallingConvention Convention) {
RETURN_CASE(CallingConvention, PpcCall, "ppccall");
RETURN_CASE(CallingConvention, SHCall, "shcall");
RETURN_CASE(CallingConvention, SH5Call, "sh5call");
+ RETURN_CASE(CallingConvention, Swift, "swift");
RETURN_CASE(CallingConvention, ThisCall, "thiscall");
RETURN_CASE(CallingConvention, TriCall, "tricall");
}
More information about the llvm-commits
mailing list