Page MenuHomePhabricator

[NFC] Turn "load dependent files" boolean into an enum
ClosedPublic

Authored by JDevlieghere on Sep 10 2018, 8:38 AM.

Details

Summary

This is an NFC commit to refactor the "load dependent files" parameter from a boolean to an enum value. We want to be able to specify a default, in which case we decide whether or not to load the dependent files based on whether the target is an executable or not (i.e. a dylib).

A second diff will build on top of this to allow the user to specify a value to target -d so we can choose between the default behavior or force (not) loading the dependent files.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Sep 10 2018, 8:38 AM
JDevlieghere retitled this revision from [NFC] Turn "load dependent files" boolean is enum to [NFC] Turn "load dependent files" boolean into an enum .Sep 11 2018, 2:08 AM
This revision was not accepted when it landed; it landed in state Needs Review.Sep 20 2018, 2:13 AM
This revision was automatically updated to reflect the committed changes.

This broke the windows build:

##[error]llvm\tools\lldb\source\plugins\process\windows\common\processwindows.cpp(840,0): Error C2664: 'void lldb_private::Target::SetExecutableModule(lldb::ModuleSP &,lldb_private::LoadDependentFiles)': cannot convert argument 2 from 'bool' to 'lldb_private::LoadDependentFiles'
lldb/trunk/source/Target/Target.cpp
1449

I think it's a good idea to either initialize this to false or to add a default case in the switch statement. That way if the enum ever changes, the behavior will be strictly defined.

1455

Typo - I think you wanted this to be load_dependents

brooks added a subscriber: brooks.Sep 25 2018, 10:05 AM

Also broke the FreeBSD build:

/usr/local/poudriere/ports/brooks/devel/llvm-devel/work/llvm-b418c2351b1fdf6faf6
a2d010d804e895ef49932/tools/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.c
pp:338:50: error: cannot initialize a parameter of type 'lldb_private::LoadDepen
dentFiles' with an rvalue of type 'bool'
  GetTarget().SetExecutableModule(exe_module_sp, true);                        
                                                 ^~~~
/usr/local/poudriere/ports/brooks/devel/llvm-devel/work/llvm-b418c2351b1fdf6faf6
a2d010d804e895ef49932/tools/lldb/include/lldb/Target/Target.h:860:26: note: pass
ing argument to parameter 'load_dependent_files' here
      LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
                         ^
/usr/local/poudriere/ports/brooks/devel/llvm-devel/work/llvm-b418c2351b1fdf6faf6
a2d010d804e895ef49932/tools/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.c
pp:522:50: error: cannot initialize a parameter of type 'lldb_private::LoadDepen
dentFiles' with an rvalue of type 'bool'
      target->SetExecutableModule(exe_module_sp, true);
                                                 ^~~~
/usr/local/poudriere/ports/brooks/devel/llvm-devel/work/llvm-b418c2351b1fdf6faf6
a2d010d804e895ef49932/tools/lldb/include/lldb/Target/Target.h:860:26: note: pass
ing argument to parameter 'load_dependent_files' here
      LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
                         ^
2 errors generated.
ninja: build stopped: subcommand failed.