Skip to content

Commit e55bf7c

Browse files
committed
[TableGen] Strip directories from generated include
Fixes #167700 to not rely on the full output path of the file to be part of the include path later.
1 parent dbd97c8 commit e55bf7c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/utils/TableGen/RegisterInfoEmitter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "llvm/Support/Casting.h"
3030
#include "llvm/Support/CommandLine.h"
3131
#include "llvm/Support/Format.h"
32+
#include "llvm/Support/Path.h"
3233
#include "llvm/Support/raw_ostream.h"
3334
#include "llvm/TableGen/Error.h"
3435
#include "llvm/TableGen/Record.h"
@@ -104,7 +105,8 @@ static void emitInclude(StringRef FilenamePrefix, StringRef IncludeFile,
104105
StringRef GuardMacro, raw_ostream &OS) {
105106
OS << "#ifdef " << GuardMacro << '\n';
106107
OS << "#undef " << GuardMacro << '\n';
107-
OS << "#include \"" << FilenamePrefix << IncludeFile << "\"\n";
108+
OS << "#include \"" << sys::path::stem(FilenamePrefix) << IncludeFile
109+
<< "\"\n";
108110
OS << "#endif\n\n";
109111
}
110112

0 commit comments

Comments
 (0)