[llvm] [TableGen] Strip directories from generated include (PR #168409)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 17 09:36:38 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-tablegen
Author: Keith Smiley (keith)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/168409.diff
1 Files Affected:
- (modified) llvm/utils/TableGen/RegisterInfoEmitter.cpp (+2-1)
``````````diff
diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index ef7b13e8940f8..286d5bf637ce0 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,7 @@ 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";
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/168409
More information about the llvm-commits
mailing list