[cfe-commits] [PATCH] #import directive in MS compatibility mode

Douglas Gregor dgregor at apple.com
Wed Mar 14 09:15:06 PDT 2012


On Mar 12, 2012, at 4:10 PM, Aaron Ballman wrote:

> MSVC uses the #import directive in a far different way than the
> language extension clang supports.  Instead of including the target
> into the source, it parses a type library and generates C++ classes
> from the definitions.  This difference in behavior is large enough
> that we should be warning users in MS compatibility mode so they can
> understand what's happening.
> 
> This patch addresses PR 10727.


Given that the subject of an MSVC-style #import is likely to be a binary file, I think it would be better to simply warn that we are ignoring the #import directly entirely, rather than going through HandleIncludeDirective. Also, can you perhaps make

+def warn_pp_import_directive_ms : Warning<
+  "#import is a language extension that includes the contents of a header "
+  "file. It does not convert a type library to C++ classes in Microsoft Mode">,
+  InGroup<Microsoft>;
+

a bit less wordy?

	- Doug



More information about the cfe-commits mailing list