1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00

[Remarks] Allow empty temporary remark files

When parsing bitstream remarks, allow external remark files to be
empty, which means there are no remarks to be parsed.

In the same way, dsymutil should not produce a remark file.
This commit is contained in:
Francis Visoiu Mistrih 2019-11-22 14:27:47 -08:00
parent f319b282ab
commit 600ec0d5c6
10 changed files with 14 additions and 1 deletions

View File

@ -428,8 +428,13 @@ Error BitstreamRemarkParser::processExternalFilePath(
MemoryBuffer::getFile(FullPath);
if (std::error_code EC = BufferOrErr.getError())
return createFileError(FullPath, EC);
TmpRemarkBuffer = std::move(*BufferOrErr);
// Don't try to parse the file if it's empty.
if (TmpRemarkBuffer->getBufferSize() == 0)
return make_error<EndOfFileError>();
// Create a separate parser used for parsing the separate file.
ParserHelper = BitstreamParserHelper(TmpRemarkBuffer->getBuffer());
// Advance and check until we can parse the meta block.

View File

@ -22,7 +22,7 @@
Remarks compilation:
for FILE in basic1.c basic2.c basic3.c; do
clang -gline-tables-only -c $FILE -fsave-optimization-record=bitstream -foptimization-remarks-file=/tmp/${FILE%.c}.macho.remarks.x86_64.opt.bitstream -mllvm -remarks-section -o ${FILE%.c}.macho.remarks.x86_64.o
clang -gline-tables-only -c $FILE -fsave-optimization-record=bitstream -foptimization-record-file=/remarks/${FILE%.c}.macho.remarks.x86_64.opt.bitstream -o ${FILE%.c}.macho.remarks.x86_64.o
done
clang basic1.macho.remarks.x86_64.o basic2.macho.remarks.x86_64.o basic3.macho.remarks.x86_64.o -o basic.macho.remarks.x86_64 -Wl,-dead_strip

View File

@ -0,0 +1,8 @@
RUN: rm -rf %t
RUN: mkdir -p %t
RUN: cat %p/../Inputs/remarks/basic.macho.remarks.empty.x86_64 > %t/basic.macho.remarks.empty.x86_64
RUN: dsymutil -oso-prepend-path=%p/../Inputs -remarks-prepend-path=%p/../Inputs %t/basic.macho.remarks.empty.x86_64
Check that the remark file in the bundle does not exist:
RUN: not cat %t/basic.macho.remarks.empty.x86_64.dSYM/Contents/Resources/Remarks/basic.macho.remarks.empty.x86_64 2>&1