-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-cl] Treat inputs as C++ with /E, like MSVC
midl invokes the compiler on .idl files with /E. Before this change, we would treat unrecognized inputs as object files. Now we pre-process to stdout as expected. I checked that MSVC defines __cplusplus when invoked this way, so treating the input as C++ seems like the right thing to do. After this change, I was able to run midl like this with clang-cl: $ midl -cpp_cmd clang-cl.exe foo.idl Things worked for the example IDL file in the Microsoft documentation, but beyond that, I don't know if this will work well. Fixes PR40140 llvm-svn: 350072
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // Note: %s must be preceded by --, otherwise it may be interpreted as a | ||
| // command-line option, e.g. on Mac where %s is commonly under /Users. | ||
|
|
||
| // Test that 'clang-cl /E' treats inputs as C++ if the extension is | ||
| // unrecognized. midl relies on this. See PR40140. | ||
|
|
||
| // Use a plain .cpp extension first. | ||
| // RUN: %clang_cl /E -- %s | FileCheck %s | ||
|
|
||
| // Copy to use .idl as the extension. | ||
| // RUN: cp %s %t.idl | ||
| // RUN: %clang_cl /E -- %t.idl | FileCheck %s | ||
|
|
||
| #ifdef __cplusplus | ||
| struct IsCPlusPlus {}; | ||
| #endif | ||
|
|
||
| // CHECK: struct IsCPlusPlus {}; |