SBCommandReturnObject: change LLDB_RECORD_METHOD(..., FILE *, ...) to use LLDB_RECORD_DUMMY

POSIX says FILE is a typedef to a structure containing information about
a file. The structure is unspecified, i.e. it may be an incomplete type, as is the case on musl
(`struct _IO_FILE` is an implementation detail that is not exposed).

`LLDB_RECORD_METHOD(..., (FILE *), ...)` transitively uses sizeof(FILE)
and requires the structure to be complete.  Change it to
LLDB_RECORD_DUMMY to fix the build failure on musl (regression of
D57475).

Reviewed By: JDevlieghere, labath, lawrence_danna

Differential Revision: https://reviews.llvm.org/D68872

llvm-svn: 375072
This commit is contained in:
Fangrui Song 2019-10-17 01:28:07 +00:00
parent 6150093e22
commit 56ee31964f
1 changed files with 10 additions and 11 deletions

View File

@ -116,7 +116,7 @@ size_t SBCommandReturnObject::GetErrorSize() {
}
size_t SBCommandReturnObject::PutOutput(FILE *fh) {
LLDB_RECORD_METHOD(size_t, SBCommandReturnObject, PutOutput, (FILE *), fh);
LLDB_RECORD_DUMMY(size_t, SBCommandReturnObject, PutOutput, (FILE *), fh);
if (fh) {
size_t num_bytes = GetOutputSize();
if (num_bytes)
@ -141,8 +141,7 @@ size_t SBCommandReturnObject::PutOutput(SBFile file) {
}
size_t SBCommandReturnObject::PutError(FILE *fh) {
LLDB_RECORD_METHOD(size_t, SBCommandReturnObject, PutError, (FILE *), fh);
LLDB_RECORD_DUMMY(size_t, SBCommandReturnObject, PutError, (FILE *), fh);
if (fh) {
size_t num_bytes = GetErrorSize();
if (num_bytes)
@ -255,31 +254,31 @@ bool SBCommandReturnObject::GetDescription(SBStream &description) {
}
void SBCommandReturnObject::SetImmediateOutputFile(FILE *fh) {
LLDB_RECORD_METHOD(void, SBCommandReturnObject, SetImmediateOutputFile,
(FILE *), fh);
LLDB_RECORD_DUMMY(void, SBCommandReturnObject, SetImmediateOutputFile,
(FILE *), fh);
SetImmediateOutputFile(fh, false);
}
void SBCommandReturnObject::SetImmediateErrorFile(FILE *fh) {
LLDB_RECORD_METHOD(void, SBCommandReturnObject, SetImmediateErrorFile,
(FILE *), fh);
LLDB_RECORD_DUMMY(void, SBCommandReturnObject, SetImmediateErrorFile,
(FILE *), fh);
SetImmediateErrorFile(fh, false);
}
void SBCommandReturnObject::SetImmediateOutputFile(FILE *fh,
bool transfer_ownership) {
LLDB_RECORD_METHOD(void, SBCommandReturnObject, SetImmediateOutputFile,
(FILE *, bool), fh, transfer_ownership);
LLDB_RECORD_DUMMY(void, SBCommandReturnObject, SetImmediateOutputFile,
(FILE *, bool), fh, transfer_ownership);
FileSP file = std::make_shared<NativeFile>(fh, transfer_ownership);
ref().SetImmediateOutputFile(file);
}
void SBCommandReturnObject::SetImmediateErrorFile(FILE *fh,
bool transfer_ownership) {
LLDB_RECORD_METHOD(void, SBCommandReturnObject, SetImmediateErrorFile,
(FILE *, bool), fh, transfer_ownership);
LLDB_RECORD_DUMMY(void, SBCommandReturnObject, SetImmediateErrorFile,
(FILE *, bool), fh, transfer_ownership);
FileSP file = std::make_shared<NativeFile>(fh, transfer_ownership);
ref().SetImmediateErrorFile(file);
}