diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-10-22 22:13:48 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2012-10-22 22:13:48 +0000 |
commit | 929fccd4761b3de9d6c651cc85799d4bbfd165b0 (patch) | |
tree | ba81d70746265516fbbef1bb9f00057257bcdb38 /clang/lib/Driver/Tools.cpp | |
parent | dbeb0f0e0cdb0201d35635e72baed288e3021906 (diff) | |
download | bcm5719-llvm-929fccd4761b3de9d6c651cc85799d4bbfd165b0.tar.gz bcm5719-llvm-929fccd4761b3de9d6c651cc85799d4bbfd165b0.zip |
[Options] Add prefixes to options.
Each option has a set of prefixes. When matching an argument such as
-funroll-loops. First the leading - is removed as it is a prefix. Then
a lower_bound search for "funroll-loops" is done against the option table by
option name. From there each option prefix + option name combination is tested
against the argument.
This allows us to support Microsoft style options where both / and - are valid
prefixes. It also simplifies the cases we already have where options come in
both - and -- forms. Almost every option for gnu-ld happens to have this form.
llvm-svn: 166444
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 7848b488d37..54ec0cb1a90 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1175,8 +1175,8 @@ void Clang::AddX86TargetArgs(const ArgList &Args, (*it)->claim(); // Skip over "-m". - assert(Name.startswith("-m") && "Invalid feature name."); - Name = Name.substr(2); + assert(Name.startswith("m") && "Invalid feature name."); + Name = Name.substr(1); bool IsNegative = Name.startswith("no-"); if (IsNegative) @@ -2283,7 +2283,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-fbounds-checking=1"); } - if (Args.hasArg(options::OPT__relocatable_pch)) + if (Args.hasArg(options::OPT_relocatable_pch)) CmdArgs.push_back("-relocatable-pch"); if (Arg *A = Args.getLastArg(options::OPT_fconstant_string_class_EQ)) { |