Skip to content

Conversation

@keith
Copy link
Member

@keith keith commented Nov 17, 2025

Fixes #167700 to not rely on
the full output path of the file to be part of the include path later.

@llvmbot
Copy link
Member

llvmbot commented Nov 17, 2025

@llvm/pr-subscribers-tablegen

Author: Keith Smiley (keith)

Changes

Fixes #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 --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";
 }
 

@github-actions
Copy link

github-actions bot commented Nov 17, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Fixes llvm#167700 to not rely on
the full output path of the file to be part of the include path later.
@keith keith force-pushed the ks/tablegen-strip-directories-from-generated-include branch from 5d3e69a to e55bf7c Compare November 17, 2025 17:40
Comment on lines +108 to +109
OS << "#include \"" << sys::path::stem(FilenamePrefix) << IncludeFile
<< "\"\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said, it doesn't make much sense to pass the directories here and then strip them. The prefix is only meant to be the prefix of the base name. Let me update #168355 instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok lmk when you update it and i can test it out

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@keith
Copy link
Member Author

keith commented Nov 17, 2025

#168355

@keith keith closed this Nov 17, 2025
@keith keith deleted the ks/tablegen-strip-directories-from-generated-include branch November 17, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants