Skip to content

Commit d36c6f9

Browse files
authored
[DebugInfo][CodeView] Move codeview::SourceLanguage enumerators to CodeViewLanguages.def (NFC) (#141750)
This PR proposes moving out enumerators for `codeview::SourceLanguage` to a separate CodeViewLanguages.def file, following the same guideline that in other parts of LLVM, and in particular the `TypeRecordKind` (enumerators in CodeViewTypes.def) or `SymbolRecordKind` (enumerators in CodeViewSymbols.def). This is a non-functional change, and has been labeled as such. This change helps for #137223, and possibly other future changes.
1 parent c9968f4 commit d36c6f9

File tree

2 files changed

+53
-30
lines changed

2 files changed

+53
-30
lines changed

llvm/include/llvm/DebugInfo/CodeView/CodeView.h

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -144,36 +144,8 @@ enum class CPUType : uint16_t {
144144
/// Debug Interface Access SDK, and are documented here:
145145
/// https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang
146146
enum SourceLanguage : uint8_t {
147-
C = 0x00,
148-
Cpp = 0x01,
149-
Fortran = 0x02,
150-
Masm = 0x03,
151-
Pascal = 0x04,
152-
Basic = 0x05,
153-
Cobol = 0x06,
154-
Link = 0x07,
155-
Cvtres = 0x08,
156-
Cvtpgd = 0x09,
157-
CSharp = 0x0a,
158-
VB = 0x0b,
159-
ILAsm = 0x0c,
160-
Java = 0x0d,
161-
JScript = 0x0e,
162-
MSIL = 0x0f,
163-
HLSL = 0x10,
164-
ObjC = 0x11,
165-
ObjCpp = 0x12,
166-
Swift = 0x13,
167-
AliasObj = 0x14,
168-
Rust = 0x15,
169-
Go = 0x16,
170-
171-
/// The DMD compiler emits 'D' for the CV source language. Microsoft does not
172-
/// have an enumerator for it yet.
173-
D = 'D',
174-
/// The Swift compiler used to emit 'S' for the CV source language, but
175-
/// current versions emit the enumerator defined above.
176-
OldSwift = 'S',
147+
#define CV_LANGUAGE(NAME, ID) NAME = ID,
148+
#include "CodeViewLanguages.def"
177149
};
178150

179151
/// These values correspond to the CV_call_e enumeration, and are documented
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//===-- CodeViewLanguages.def - All CodeView languages ----------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// These values correspond to the CV_CFL_LANG enumeration in the Microsoft
10+
// Debug Interface Access SDK, and are documented here:
11+
// https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang
12+
// This should match the constants there.
13+
//
14+
//===----------------------------------------------------------------------===//
15+
16+
#ifndef CV_LANGUAGE
17+
#define CV_LANGUAGE(NAME, ID)
18+
#endif
19+
20+
CV_LANGUAGE(C, 0x00)
21+
CV_LANGUAGE(Cpp, 0x01)
22+
CV_LANGUAGE(Fortran, 0x02)
23+
CV_LANGUAGE(Masm, 0x03)
24+
CV_LANGUAGE(Pascal, 0x04)
25+
CV_LANGUAGE(Basic, 0x05)
26+
CV_LANGUAGE(Cobol, 0x06)
27+
CV_LANGUAGE(Link, 0x07)
28+
CV_LANGUAGE(Cvtres, 0x08)
29+
CV_LANGUAGE(Cvtpgd, 0x09)
30+
CV_LANGUAGE(CSharp, 0x0a)
31+
CV_LANGUAGE(VB, 0x0b)
32+
CV_LANGUAGE(ILAsm, 0x0c)
33+
CV_LANGUAGE(Java, 0x0d)
34+
CV_LANGUAGE(JScript, 0x0e)
35+
CV_LANGUAGE(MSIL, 0x0f)
36+
CV_LANGUAGE(HLSL, 0x10)
37+
CV_LANGUAGE(ObjC, 0x11)
38+
CV_LANGUAGE(ObjCpp, 0x12)
39+
CV_LANGUAGE(Swift, 0x13)
40+
CV_LANGUAGE(AliasObj, 0x14)
41+
CV_LANGUAGE(Rust, 0x15)
42+
CV_LANGUAGE(Go, 0x16)
43+
44+
// The DMD compiler emits 'D' for the CV source language. Microsoft does not
45+
// have an enumerator for it yet.
46+
CV_LANGUAGE(D, 'D')
47+
// The Swift compiler used to emit 'S' for the CV source language, but
48+
// current versions emit the enumerator defined above.
49+
CV_LANGUAGE(OldSwift, 'S')
50+
51+
#undef CV_LANGUAGE

0 commit comments

Comments
 (0)