This is an archive of the discontinued LLVM Phabricator instance.

Driver: enhance MSC version compatibility
ClosedPublic

Authored by compnerd on Jun 20 2014, 10:36 AM.

Details

Reviewers
rnk
Summary

The version information for Visual Studio is spread over multiple variables.
The newer Windows SDK has started making use of some of the extended versioning
variables that were previously undefined. Enhance our compatibility definitions
for these cases.

_MSC_VER is defined to be the Major * 100 + Minor. _MSC_FULL_VER is defined to
be Major * 10000000 + Minor * 100000 + Build. And _MSC_BUILD is the build
revision of the compiler.

Extend the -fmsc-version option in a compatible manner. If the value is the
previous form of MMmm, then we assume that the build number is 0. Otherwise, a
specific build number may be passed by using the form MMmmbbbbb. Due to
bitwidth limitations of the option, it is currently not possible to define a
revision value.

Diff Detail

Event Timeline

compnerd updated this revision to Diff 10698.Jun 20 2014, 10:36 AM
compnerd retitled this revision from to Driver: enhance MSC version compatibility.
compnerd updated this object.
compnerd edited the test plan for this revision. (Show Details)
compnerd added a reviewer: rnk.
compnerd set the repository for this revision to rL LLVM.
compnerd added subscribers: Unknown Object (MLST), abdulras.
rnk added inline comments.Jun 20 2014, 11:52 AM
lib/Basic/Targets.cpp
582

I'm not crazy about -fmsc-version=MMmmmbbbbb. How about -fmsc-version either takes a non-full number, or it takes a dot-separated number as described here? We can skip the patch version for now, since that's too many bits.

compnerd added inline comments.Jun 20 2014, 11:57 AM
lib/Basic/Targets.cpp
582

AFAICT, the value is a uint32_t. How would the dot separated value be passed to it? I would certainly prefer that.

compnerd updated this revision to Diff 10702.Jun 20 2014, 12:14 PM

Incorporate Aaron's feedback.

rnk added inline comments.Jun 20 2014, 12:29 PM
lib/Basic/Targets.cpp
582

Change this line in CompilerInvocation.cpp to parse the dot separated value:

Opts.MSCVersion = getLastArgIntValue(Args, OPT_fmsc_version, 0, Diags);
compnerd updated this revision to Diff 10706.Jun 20 2014, 1:54 PM

Address additional review comments.

rnk accepted this revision.Jun 20 2014, 2:03 PM
rnk edited edge metadata.

lgtm with a simplification

lib/Frontend/CompilerInvocation.cpp
1197

I don't think this decltype stuff is necessary. LLVM assumes unsigned is 32-bit in lots of other places. I'd rather have this return 'unsigned', not take LangOpts, and have the caller assign the result to Opts.MSCVersion.

This revision is now accepted and ready to land.Jun 20 2014, 2:03 PM
compnerd closed this revision.Jun 20 2014, 4:06 PM

Committed with indicated simplifications as SVN r211420.