diff options
Diffstat (limited to 'include/clang/Lex')
-rw-r--r-- | include/clang/Lex/HeaderSearchOptions.h | 7 | ||||
-rw-r--r-- | include/clang/Lex/ModuleMap.h | 7 | ||||
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 23 | ||||
-rw-r--r-- | include/clang/Lex/Token.h | 7 |
4 files changed, 33 insertions, 11 deletions
diff --git a/include/clang/Lex/HeaderSearchOptions.h b/include/clang/Lex/HeaderSearchOptions.h index 316134c..c9c3260 100644 --- a/include/clang/Lex/HeaderSearchOptions.h +++ b/include/clang/Lex/HeaderSearchOptions.h @@ -98,8 +98,9 @@ public: /// Note: Only used for testing! unsigned DisableModuleHash : 1; - /// \brief Interpret module maps. This option is implied by full modules. - unsigned ModuleMaps : 1; + /// \brief Implicit module maps. This option is enabld by default when + /// modules is enabled. + unsigned ImplicitModuleMaps : 1; /// \brief Set the 'home directory' of a module map file to the current /// working directory (or the home directory of the module map file that @@ -166,7 +167,7 @@ public: public: HeaderSearchOptions(StringRef _Sysroot = "/") - : Sysroot(_Sysroot), DisableModuleHash(0), ModuleMaps(0), + : Sysroot(_Sysroot), DisableModuleHash(0), ImplicitModuleMaps(0), ModuleMapFileHomeIsCwd(0), ModuleCachePruneInterval(7*24*60*60), ModuleCachePruneAfter(31*24*60*60), diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h index e41efc5..0bbcfac 100644 --- a/include/clang/Lex/ModuleMap.h +++ b/include/clang/Lex/ModuleMap.h @@ -268,15 +268,10 @@ public: /// /// \param File The header file that is likely to be included. /// - /// \param RequestingModule Specifies the module the header is intended to be - /// used from. Used to disambiguate if a header is present in multiple - /// modules. - /// /// \returns The module KnownHeader, which provides the module that owns the /// given header file. The KnownHeader is default constructed to indicate /// that no module owns this header file. - KnownHeader findModuleForHeader(const FileEntry *File, - Module *RequestingModule = nullptr); + KnownHeader findModuleForHeader(const FileEntry *File); /// \brief Reports errors if a module must not include a specific file. /// diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index f6e61c0..439a280 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -256,6 +256,10 @@ class Preprocessor : public RefCountedBase<Preprocessor> { /// \#pragma clang arc_cf_code_audited begin. SourceLocation PragmaARCCFCodeAuditedLoc; + /// \brief The source location of the currently-active + /// \#pragma clang assume_nonnull begin. + SourceLocation PragmaAssumeNonNullLoc; + /// \brief True if we hit the code-completion point. bool CodeCompletionReached; @@ -455,8 +459,9 @@ class Preprocessor : public RefCountedBase<Preprocessor> { void overrideActiveModuleMacros(Preprocessor &PP, IdentifierInfo *II) { if (auto *Info = getModuleInfo(PP, II)) { - for (auto *Active : Info->ActiveModuleMacros) - Info->OverriddenMacros.push_back(Active); + Info->OverriddenMacros.insert(Info->OverriddenMacros.end(), + Info->ActiveModuleMacros.begin(), + Info->ActiveModuleMacros.end()); Info->ActiveModuleMacros.clear(); Info->IsAmbiguous = false; } @@ -1249,6 +1254,20 @@ public: PragmaARCCFCodeAuditedLoc = Loc; } + /// \brief The location of the currently-active \#pragma clang + /// assume_nonnull begin. + /// + /// Returns an invalid location if there is no such pragma active. + SourceLocation getPragmaAssumeNonNullLoc() const { + return PragmaAssumeNonNullLoc; + } + + /// \brief Set the location of the currently-active \#pragma clang + /// assume_nonnull begin. An invalid location ends the pragma. + void setPragmaAssumeNonNullLoc(SourceLocation Loc) { + PragmaAssumeNonNullLoc = Loc; + } + /// \brief Set the directory in which the main file should be considered /// to have been found, if it is not a real file. void setMainFileDir(const DirectoryEntry *Dir) { diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h index e087809..7ba22b2 100644 --- a/include/clang/Lex/Token.h +++ b/include/clang/Lex/Token.h @@ -94,6 +94,13 @@ public: /// "if (Tok.is(tok::l_brace)) {...}". bool is(tok::TokenKind K) const { return Kind == K; } bool isNot(tok::TokenKind K) const { return Kind != K; } + bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const { + return is(K1) || is(K2); + } + template <typename... Ts> + bool isOneOf(tok::TokenKind K1, tok::TokenKind K2, Ts... Ks) const { + return is(K1) || isOneOf(K2, Ks...); + } /// \brief Return true if this is a raw identifier (when lexing /// in raw mode) or a non-keyword identifier (when lexing in non-raw mode). |