r211506 - Driver: correct behaviour of -fmsc-version=MAJOR
Saleem Abdulrasool
compnerd at compnerd.org
Mon Jun 23 10:36:36 PDT 2014
Author: compnerd
Date: Mon Jun 23 12:36:36 2014
New Revision: 211506
URL: http://llvm.org/viewvc/llvm-project?rev=211506&view=rev
Log:
Driver: correct behaviour of -fmsc-version=MAJOR
Ensure that we properly handle the case where just the major version component
is provided by the user.
Thanks to Alp Toker for pointing out that this was not handled correctly!
Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Driver/msc-version.c
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=211506&r1=211505&r2=211506&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Jun 23 12:36:36 2014
@@ -1223,7 +1223,11 @@ static unsigned parseMSCVersion(ArgList
<< Arg->getAsString(Args) << Value;
return 0;
}
- return (Version < 100000) ? Version * 100000 : Version;
+ 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
Modified: cfe/trunk/test/Driver/msc-version.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/msc-version.c?rev=211506&r1=211505&r2=211506&view=diff
==============================================================================
--- cfe/trunk/test/Driver/msc-version.c (original)
+++ cfe/trunk/test/Driver/msc-version.c Mon Jun 23 12:36:36 2014
@@ -16,6 +16,12 @@
// CHECK-MSC-VERSION-EXT: _MSC_FULL_VER 160030319
// CHECK-MSC-VERSION-EXT: _MSC_VER 1600
+// RUN: %clang -target i686-windows -fms-compatibility -fmsc-version=14 -dM -E - </dev/null -o - | FileCheck %s -check-prefix CHECK-MSC-VERSION-MAJOR
+
+// CHECK-MSC-VERSION-MAJOR: _MSC_BUILD 1
+// CHECK-MSC-VERSION-MAJOR: _MSC_FULL_VER 140000000
+// CHECK-MSC-VERSION-MAJOR: _MSC_VER 1400
+
// RUN: %clang -target i686-windows -fms-compatibility -fmsc-version=17.00 -dM -E - </dev/null -o - | FileCheck %s -check-prefix CHECK-MSC-VERSION-MAJOR-MINOR
// CHECK-MSC-VERSION-MAJOR-MINOR: _MSC_BUILD 1
More information about the cfe-commits
mailing list