This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Run Windows-specific code only on Windows platform
AbandonedPublic

Authored by kevgs on May 4 2016, 9:20 AM.

Details

Reviewers
nadav

Diff Detail

Event Timeline

kevgs updated this revision to Diff 56162.May 4 2016, 9:20 AM
kevgs retitled this revision from to [NFC] Run Windows-specific code only on Windows platform.
kevgs updated this object.
kevgs added a reviewer: nadav.
kevgs added a subscriber: llvm-commits.
probinson added inline comments.
lib/Target/X86/X86TargetMachine.cpp
43

Isn't this a Windows-target thing? You've made it a Windows-host thing.

kevgs added inline comments.May 4 2016, 9:50 AM
lib/Target/X86/X86TargetMachine.cpp
43

I'm building clang on Linux, running like this clang++ foo.cc and this code executes. My thoughts is that clang++ frontend isn't meant to generate Windows code because clang-cl is meant for this puprose.

Should clang++ be able to generate Windows code?

probinson added inline comments.May 4 2016, 12:38 PM
lib/Target/X86/X86TargetMachine.cpp
43

clang-cl isn't meant to be the only way to produce Windows objects; it is meant to be a drop-in replacement for Microsoft cl.exe, and so *defaults* to producing Windows objects.
You can certainly specify a Windows target while running on Linux:
clang++ -target x86_64-pc-win32 foo.cc

So you don't want to use #ifdef here. If you can get your hands on the target triple, you could put this under a runtime test.

kevgs abandoned this revision.May 4 2016, 12:42 PM
kevgs added inline comments.
lib/Target/X86/X86TargetMachine.cpp
43

Ok. That means my patch have no sense. Thanks for your time!