Skip to content

Commit ab305c0

Browse files
committed
[TableGen] Strip directories from filename prefixes.
Fixes #167700 to support builds where TableGen's output file is specified as full path rather than just filename.
1 parent 6f5c8fe commit ab305c0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/TableGen/Main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,11 @@ int llvm::TableGenMain(const char *argv0,
167167

168168
// Write output to memory.
169169
Timer.startBackendTimer("Backend overall");
170-
SmallString<128> FilenamePrefix(OutputFilename);
171-
sys::path::replace_extension(FilenamePrefix, "");
172170
TableGenOutputFiles OutFiles;
173171
unsigned status = 0;
174172
// ApplyCallback will return true if it did not apply any callback. In that
175173
// case, attempt to apply the MainFn.
174+
StringRef FilenamePrefix(sys::path::stem(OutputFilename));
176175
if (TableGen::Emitter::ApplyCallback(Records, OutFiles, FilenamePrefix))
177176
status = MainFn ? MainFn(OutFiles, Records) : 1;
178177
Timer.stopBackendTimer();
@@ -195,7 +194,7 @@ int llvm::TableGenMain(const char *argv0,
195194
SmallString<128> Filename(OutputFilename);
196195
// TODO: Format using the split-file convention when writing to stdout?
197196
if (Filename != "-") {
198-
Filename = FilenamePrefix;
197+
sys::path::replace_extension(Filename, "");
199198
Filename.append(Suffix);
200199
}
201200
if (int Ret = WriteOutput(Parser, argv0, Filename, Content))

0 commit comments

Comments
 (0)