From e55bf7ccbf75ea2c9e9e30217fd0ecfffc99afd3 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Mon, 17 Nov 2025 17:35:00 +0000 Subject: [PATCH] [TableGen] Strip directories from generated include Fixes https://github.com/llvm/llvm-project/pull/167700 to not rely on the full output path of the file to be part of the include path later. --- llvm/utils/TableGen/RegisterInfoEmitter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp index ef7b13e8940f8..54ed69431b283 100644 --- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp +++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp @@ -29,6 +29,7 @@ #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Format.h" +#include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" @@ -104,7 +105,8 @@ static void emitInclude(StringRef FilenamePrefix, StringRef IncludeFile, StringRef GuardMacro, raw_ostream &OS) { OS << "#ifdef " << GuardMacro << '\n'; OS << "#undef " << GuardMacro << '\n'; - OS << "#include \"" << FilenamePrefix << IncludeFile << "\"\n"; + OS << "#include \"" << sys::path::stem(FilenamePrefix) << IncludeFile + << "\"\n"; OS << "#endif\n\n"; }