[all-commits] [llvm/llvm-project] 7fb39f: [Support] Reset option to its default if its Defau...

Yevgeny Rouban via All-commits all-commits at lists.llvm.org
Sun Feb 27 05:58:50 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7fb39fb6d6665cd469557b43eb205cc32b0a7ac3
      https://github.com/llvm/llvm-project/commit/7fb39fb6d6665cd469557b43eb205cc32b0a7ac3
  Author: Yevgeny Rouban <yrouban at azul.com>
  Date:   2022-02-27 (Sun, 27 Feb 2022)

  Changed paths:
    M llvm/include/llvm/Support/CommandLine.h
    M llvm/unittests/Support/CommandLineTest.cpp

  Log Message:
  -----------
  [Support] Reset option to its default if its Default field is undefined

opt::setDefaultImpl() is changed to set the option value to the option
type's default if the Default field is not set. This results in option
value reset by Option::reset() or ResetAllOptionOccurrences() even if
the cl::init() is not specified.

Example:
  StackOption<std::string> Str("str"); // No cl::init().
  Str = "some value";
  cl::ResetAllOptionOccurrences();
  EXPECT_EQ("", Str); // The Str is reset.

Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D115433




More information about the All-commits mailing list