Skip to content

Commit bcb1a89

Browse files
authored
[NFC][IntrinsicEmitter] Include source location with enum definition (#156800)
1 parent 13f97f0 commit bcb1a89

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/utils/TableGen/Basic/IntrinsicEmitter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "llvm/Support/ErrorHandling.h"
2121
#include "llvm/Support/FormatVariadic.h"
2222
#include "llvm/Support/ModRef.h"
23+
#include "llvm/Support/SourceMgr.h"
2324
#include "llvm/Support/raw_ostream.h"
2425
#include "llvm/TableGen/Error.h"
2526
#include "llvm/TableGen/Record.h"
@@ -154,7 +155,7 @@ void IntrinsicEmitter::EmitEnumInfo(const CodeGenIntrinsicTable &Ints,
154155

155156
OS << "// Enum values for intrinsics.\n";
156157
bool First = true;
157-
for (const auto &Int : Ints[*Set]) {
158+
for (const CodeGenIntrinsic &Int : Ints[*Set]) {
158159
OS << " " << Int.EnumName;
159160

160161
// Assign a value to the first intrinsic in this target set so that all
@@ -167,7 +168,9 @@ void IntrinsicEmitter::EmitEnumInfo(const CodeGenIntrinsicTable &Ints,
167168
OS << ", ";
168169
if (Int.EnumName.size() < 40)
169170
OS.indent(40 - Int.EnumName.size());
170-
OS << formatv(" // {}\n", Int.Name);
171+
OS << formatv(
172+
" // {} ({})\n", Int.Name,
173+
SrcMgr.getFormattedLocationNoOffset(Int.TheDef->getLoc().front()));
171174
}
172175

173176
// Emit num_intrinsics into the target neutral enum.

0 commit comments

Comments
 (0)