From 097f34cc09caf46945ec17e198f57ac9c156e904 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Wed, 23 Aug 2017 08:57:51 -0700 Subject: ART: Use CmdlineParser in dex2oat Refactor dex2oat and the compiler to use the cmdline parser. In an effort to standardize command-line parsing and make it easier to add new properties in a principled manner. Test: m test-art-host Change-Id: Ia077a56234dbf579d7ca3430fef325b57aa06333 --- compiler/driver/compiler_options.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'compiler/driver/compiler_options.h') diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h index a9372c4844..311dbd569e 100644 --- a/compiler/driver/compiler_options.h +++ b/compiler/driver/compiler_options.h @@ -231,7 +231,9 @@ class CompilerOptions FINAL { return no_inline_from_; } - bool ParseCompilerOption(const StringPiece& option, UsageFn Usage); + bool ParseCompilerOptions(const std::vector& options, + bool ignore_unrecognized, + std::string* error_msg); void SetNonPic() { compile_pic_ = false; @@ -258,7 +260,7 @@ class CompilerOptions FINAL { } private: - void ParseDumpInitFailures(const StringPiece& option, UsageFn Usage); + bool ParseDumpInitFailures(const std::string& option, std::string* error_msg); void ParseDumpCfgPasses(const StringPiece& option, UsageFn Usage); void ParseInlineMaxCodeUnits(const StringPiece& option, UsageFn Usage); void ParseNumDexMethods(const StringPiece& option, UsageFn Usage); @@ -266,7 +268,7 @@ class CompilerOptions FINAL { void ParseSmallMethodMax(const StringPiece& option, UsageFn Usage); void ParseLargeMethodMax(const StringPiece& option, UsageFn Usage); void ParseHugeMethodMax(const StringPiece& option, UsageFn Usage); - void ParseRegisterAllocationStrategy(const StringPiece& option, UsageFn Usage); + bool ParseRegisterAllocationStrategy(const std::string& option, std::string* error_msg); CompilerFilter::Filter compiler_filter_; size_t huge_method_threshold_; @@ -327,6 +329,9 @@ class CompilerOptions FINAL { friend class CommonCompilerTest; friend class verifier::VerifierDepsTest; + template + friend bool ReadCompilerOptions(Base& map, CompilerOptions* options, std::string* error_msg); + DISALLOW_COPY_AND_ASSIGN(CompilerOptions); }; -- cgit v1.2.3-59-g8ed1b