From c68237bc2c7283f9cc62593b3dd8e30562014400 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 16 Jul 2014 03:13:50 +0000 Subject: Driver: bifurcate extended and basic MSC versioning This restores the original behaviour of -fmsc-version. The older option remains as a mechanism for specifying the basic version information. A secondary option, -fms-compatibility-version permits the user to specify an extended version to the driver. The new version takes the value as a dot-separated value rather than the major * 100 + minor format that -fmsc-version format. This makes it easier to specify the value as well as a more flexible manner for specifying the value. Specifying both values is considered an error. The older parameter is left solely as a driver option, which is normalised into the newer parameter. This allows us to retain a single code path in the compiler itself whilst preserving the semantics of the old parameter as well as avoid having to determine which of two formats are being used by the invocation. The test changes are due to the fact that the compiler no longer supports the old option, and is a direct conversion to the new option. llvm-svn: 213119 --- clang/lib/Frontend/CompilerInvocation.cpp | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 3d79ac7..2025871 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1208,7 +1208,7 @@ static Visibility parseVisibility(Arg *arg, ArgList &args, } static unsigned parseMSCVersion(ArgList &Args, DiagnosticsEngine &Diags) { - auto Arg = Args.getLastArg(OPT_fmsc_version); + auto Arg = Args.getLastArg(OPT_fms_compatibility_version); if (!Arg) return 0; @@ -1225,25 +1225,8 @@ static unsigned parseMSCVersion(ArgList &Args, DiagnosticsEngine &Diags) { // Unfortunately, due to the bit-width limitations, we cannot currently encode // the value for the patch level. - StringRef Value = Arg->getValue(); - - // parse the compatible old form of _MSC_VER or the newer _MSC_FULL_VER - if (Value.find('.') == StringRef::npos) { - unsigned Version = 0; - if (Value.getAsInteger(10, Version)) { - Diags.Report(diag::err_drv_invalid_value) - << Arg->getAsString(Args) << Value; - return 0; - } - if (Version < 100) - Version = Version * 100; // major -> major.minor - if (Version < 100000) - Version = Version * 100000; // major.minor -> major.minor.build - return Version; - } - - // parse the dot-delimited component version unsigned VC[4] = {0}; + StringRef Value = Arg->getValue(); SmallVector Components; Value.split(Components, ".", llvm::array_lengthof(VC)); @@ -1430,7 +1413,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.MSVCCompat = Args.hasArg(OPT_fms_compatibility); Opts.MicrosoftExt = Opts.MSVCCompat || Args.hasArg(OPT_fms_extensions); Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks) || Opts.MicrosoftExt; - Opts.MSCVersion = parseMSCVersion(Args, Diags); + Opts.MSCompatibilityVersion = parseMSCVersion(Args, Diags); Opts.VtorDispMode = getLastArgIntValue(Args, OPT_vtordisp_mode_EQ, 1, Diags); Opts.Borland = Args.hasArg(OPT_fborland_extensions); Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings); -- cgit v1.1