-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[TableGen] Strip directories from generated include #168409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TableGen] Strip directories from generated include #168409
Conversation
|
@llvm/pr-subscribers-tablegen Author: Keith Smiley (keith) ChangesFixes #167700 to not rely on Full diff: https://github.com/llvm/llvm-project/pull/168409.diff 1 Files Affected:
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";
}
|
|
✅ 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.
5d3e69a to
e55bf7c
Compare
| OS << "#include \"" << sys::path::stem(FilenamePrefix) << IncludeFile | ||
| << "\"\n"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Fixes #167700 to not rely on
the full output path of the file to be part of the include path later.