This is an archive of the discontinued LLVM Phabricator instance.

Clean-up usage of OptionDefinition arrays
ClosedPublic

Authored by tatyana-krasnukha on Sep 27 2018, 4:34 AM.

Details

Summary

Removed unused static arrays from headers, removed sentinel entry from OptionDefinition array in Driver.cpp.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

tools/driver/Driver.cpp
-24–1

This type is duplicated here to not break the encapsulation of lldb's private types, am I right?

clayborg accepted this revision.Sep 27 2018, 8:59 AM
clayborg added inline comments.
tools/driver/Driver.cpp
-24–1

Correct. We want any tool that links against LLDB.framework on darwin, or liblldb.so on other platforms to use the lldb::SB API only.

-24–1

Do we even need this if statement and its contents? maybe lldbassert(g_num_options > 0);?

This revision is now accepted and ready to land.Sep 27 2018, 8:59 AM

Modifies Driver::ParseArgs checks

tools/driver/Driver.cpp
-24–1

I replaced it with static_assert since this expression can be checked at compile time. And added if (argc <= 1) to skip build of long_options_vector if there is no arguments to parse.

clayborg accepted this revision.Sep 28 2018, 10:40 AM
This revision was automatically updated to reflect the committed changes.