[PATCH] Refactoring llvm command line parsing and option registration.

Asiri Rathnayake asiri.rathnayake at arm.com
Thu Jan 29 02:36:43 PST 2015


In http://reviews.llvm.org/D7132#114838, @beanz wrote:

> Committed a fix for Visual Studio r227385.
>
> -Chris


Hi Chris,

This doesn't seem to have fixed the failure:

  (ClCompile target) -> 
    F:\work\src\llvm\lib\Support\CommandLine.cpp(91): error C2864: 'CommandLineParser::ProgramOverview' : only static const integral data members can be initialized within a class  ...
    F:\work\src\llvm\lib\Support\CommandLine.cpp(100): error C2864: 'CommandLineParser::ConsumeAfterOpt' : only static const integral data members can be initialized within a class ...

Moving the initializer to the (default) constructor does it:

  diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp
  index 2ca9caa..a3d7d06 100644
  --- a/lib/Support/CommandLine.cpp
  +++ b/lib/Support/CommandLine.cpp
  @@ -88,7 +88,7 @@ public:
     // Globals for name and overview of program.  Program name is not a string to
     // avoid static ctor/dtor issues.
     std::string ProgramName;
  -  const char *ProgramOverview = nullptr;
  +  const char *ProgramOverview;
   
     // This collects additional help to be printed.
     std::vector<const char *> MoreHelp;
  @@ -97,7 +97,9 @@ public:
     SmallVector<Option *, 4> SinkOpts;
     StringMap<Option *> OptionsMap;
   
  -  Option *ConsumeAfterOpt = nullptr; // The ConsumeAfter option if it exists.
  +  Option *ConsumeAfterOpt; // The ConsumeAfter option if it exists.
  +
  +  CommandLineParser():ProgramOverview(nullptr), ConsumeAfterOpt(nullptr){}
   
     void ParseCommandLineOptions(int argc, const char *const *argv,
                                  const char *Overview);



- Asiri


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7132

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list