diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 14:00:56 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 14:00:56 +0000 |
commit | 2e645aa5697838f16ec570eb07c2bee7e13d0e0b (patch) | |
tree | a764184c2fc9486979b074250b013a0937ee64e5 /lib/Lex/PPDirectives.cpp | |
parent | 798321d8eb5630cd4a8f490a4f25e32ef195fb07 (diff) | |
download | src-2e645aa5697838f16ec570eb07c2bee7e13d0e0b.tar.gz src-2e645aa5697838f16ec570eb07c2bee7e13d0e0b.zip |
Vendor import of clang trunk r240225:vendor/clang/clang-trunk-r240225
Notes
Notes:
svn path=/vendor/clang/dist/; revision=284679
svn path=/vendor/clang/clang-trunk-r240225/; revision=284680; tag=vendor/clang/clang-trunk-r240225
Diffstat (limited to 'lib/Lex/PPDirectives.cpp')
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index ec06e790f018..33ce79922819 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1575,6 +1575,15 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, PragmaARCCFCodeAuditedLoc = SourceLocation(); } + // Complain about attempts to #include files in an assume-nonnull pragma. + if (PragmaAssumeNonNullLoc.isValid()) { + Diag(HashLoc, diag::err_pp_include_in_assume_nonnull); + Diag(PragmaAssumeNonNullLoc, diag::note_pragma_entered_here); + + // Immediately leave the pragma. + PragmaAssumeNonNullLoc = SourceLocation(); + } + if (HeaderInfo.HasIncludeAliasMap()) { // Map the filename with the brackets still attached. If the name doesn't // map to anything, fall back on the filename we've already gotten the @@ -1603,7 +1612,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, FilenameLoc, LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, isAngled, LookupFrom, LookupFromFile, CurDir, Callbacks ? &SearchPath : nullptr, Callbacks ? &RelativePath : nullptr, - HeaderInfo.getHeaderSearchOpts().ModuleMaps ? &SuggestedModule : nullptr); + &SuggestedModule); if (!File) { if (Callbacks) { @@ -1620,9 +1629,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, FilenameLoc, LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, isAngled, LookupFrom, LookupFromFile, CurDir, nullptr, nullptr, - HeaderInfo.getHeaderSearchOpts().ModuleMaps ? &SuggestedModule - : nullptr, - /*SkipCache*/ true); + &SuggestedModule, /*SkipCache*/ true); } } } @@ -1638,8 +1645,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, LookupFrom, LookupFromFile, CurDir, Callbacks ? &SearchPath : nullptr, Callbacks ? &RelativePath : nullptr, - HeaderInfo.getHeaderSearchOpts().ModuleMaps ? &SuggestedModule - : nullptr); + &SuggestedModule); if (File) { SourceRange Range(FilenameTok.getLocation(), CharEnd); Diag(FilenameTok, diag::err_pp_file_not_found_not_fatal) << @@ -2012,8 +2018,8 @@ static bool isConfigurationPattern(Token &MacroName, MacroInfo *MI, } // #define inline - if ((MacroName.is(tok::kw_extern) || MacroName.is(tok::kw_inline) || - MacroName.is(tok::kw_static) || MacroName.is(tok::kw_const)) && + if (MacroName.isOneOf(tok::kw_extern, tok::kw_inline, tok::kw_static, + tok::kw_const) && MI->getNumTokens() == 0) { return true; } |