diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2012-03-18 03:10:37 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2012-03-18 03:10:37 +0000 |
commit | 4207edaf03da28fa917a94b31c5c1eef0e6417dc (patch) | |
tree | 6ef077c681ac392a208b6e627b9260cd26155e8f /lib/Lex | |
parent | 07b49a88df1bad9305696f360f46cbe3b722ba40 (diff) |
Turns #import in MS Mode into an error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 53bb5c354e..3d96e86cb2 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1484,13 +1484,29 @@ void Preprocessor::HandleIncludeNextDirective(SourceLocation HashLoc, return HandleIncludeDirective(HashLoc, IncludeNextTok, Lookup); } +/// HandleMicrosoftImportDirective - Implements #import for Microsoft Mode +void Preprocessor::HandleMicrosoftImportDirective(Token &Tok) { + // The Microsoft #import directive takes a type library and generates header + // files from it, and includes those. This is beyond the scope of what clang + // does, so we ignore it and error out. However, #import can optionally have + // trailing attributes that span multiple lines. We're going to eat those + // so we can continue processing from there. + Diag(Tok, diag::err_pp_import_directive_ms ); + + // Read tokens until we get to the end of the directive. Note that the + // directive can be split over multiple lines using the backslash character. + DiscardUntilEndOfDirective(); +} + /// HandleImportDirective - Implements #import. /// void Preprocessor::HandleImportDirective(SourceLocation HashLoc, Token &ImportTok) { - if (!LangOpts.ObjC1) // #import is standard for ObjC. + if (!LangOpts.ObjC1) { // #import is standard for ObjC. + if (LangOpts.MicrosoftMode) + return HandleMicrosoftImportDirective(ImportTok); Diag(ImportTok, diag::ext_pp_import_directive); - + } return HandleIncludeDirective(HashLoc, ImportTok, 0, true); } |