diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-09-01 16:29:06 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-09-01 16:29:06 +0000 | 
| commit | ef2abedb8a769fd36f6bf297c7dca6ba0fd3671f (patch) | |
| tree | e9a6b5da4df35be0858459207ed982a777fd4d0a /lib/Frontend/CompilerInvocation.cpp | |
| parent | a75fa8aaf2005c6cb7561a9aa5129a38075939a4 (diff) | |
Notes
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
| -rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index b2c14554a4b5..0d0869c815d3 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -573,6 +573,33 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,    if (!Opts.ProfileInstrumentUsePath.empty())      setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath); +  if (Arg *A = Args.getLastArg(OPT_fclang_abi_compat_EQ)) { +    Opts.setClangABICompat(CodeGenOptions::ClangABI::Latest); + +    StringRef Ver = A->getValue(); +    std::pair<StringRef, StringRef> VerParts = Ver.split('.'); +    unsigned Major, Minor = 0; + +    // Check the version number is valid: either 3.x (0 <= x <= 9) or +    // y or y.0 (4 <= y <= current version). +    if (!VerParts.first.startswith("0") && +        !VerParts.first.getAsInteger(10, Major) && +        3 <= Major && Major <= CLANG_VERSION_MAJOR && +        (Major == 3 ? VerParts.second.size() == 1 && +                      !VerParts.second.getAsInteger(10, Minor) +                    : VerParts.first.size() == Ver.size() || +                      VerParts.second == "0")) { +      // Got a valid version number. +      if (Major == 3 && Minor <= 8) +        Opts.setClangABICompat(CodeGenOptions::ClangABI::Ver3_8); +      else if (Major <= 4) +        Opts.setClangABICompat(CodeGenOptions::ClangABI::Ver4); +    } else if (Ver != "latest") { +      Diags.Report(diag::err_drv_invalid_value) +          << A->getAsString(Args) << A->getValue(); +    } +  } +    Opts.CoverageMapping =        Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping, false);    Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping); | 
