summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2019-10-21 22:51:13 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2019-10-21 22:51:13 +0000
commit5d899f7d95c13ea08fae3aba3280a902f2834e23 (patch)
tree991b2e149e78f6d36830c475cb99e4f4f9acea7c /include
parent73e476646bdaeb2ad2d40254ce64c2dfe8c78873 (diff)
downloadclang-5d899f7d95c13ea08fae3aba3280a902f2834e23.tar.gz
[Implicit Modules] Add -cc1 option -fmodules-strict-context-hash which includes search paths and diagnostics.
This is a recommit of r375322 and r375327 with a fix for the Windows test breakage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375466 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Driver/CC1Options.td3
-rw-r--r--include/clang/Lex/HeaderSearchOptions.h20
2 files changed, 22 insertions, 1 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index e0974fbb5a..4518aca82e 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -815,6 +815,9 @@ def fdisable_module_hash : Flag<["-"], "fdisable-module-hash">,
HelpText<"Disable the module hash">;
def fmodules_hash_content : Flag<["-"], "fmodules-hash-content">,
HelpText<"Enable hashing the content of a module file">;
+def fmodules_strict_context_hash : Flag<["-"], "fmodules-strict-context-hash">,
+ HelpText<"Enable hashing of all compiler options that could impact the "
+ "semantics of a module in an implicit build">;
def c_isystem : JoinedOrSeparate<["-"], "c-isystem">, MetaVarName<"<directory>">,
HelpText<"Add directory to the C SYSTEM include search path">;
def objc_isystem : JoinedOrSeparate<["-"], "objc-isystem">,
diff --git a/include/clang/Lex/HeaderSearchOptions.h b/include/clang/Lex/HeaderSearchOptions.h
index 3c309744ba..5c19a41986 100644
--- a/include/clang/Lex/HeaderSearchOptions.h
+++ b/include/clang/Lex/HeaderSearchOptions.h
@@ -11,6 +11,7 @@
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/CachedHashString.h"
+#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringRef.h"
#include <cstdint>
@@ -206,6 +207,13 @@ public:
unsigned ModulesHashContent : 1;
+ /// Whether we should include all things that could impact the module in the
+ /// hash.
+ ///
+ /// This includes things like the full header search path, and enabled
+ /// diagnostics.
+ unsigned ModulesStrictContextHash : 1;
+
HeaderSearchOptions(StringRef _Sysroot = "/")
: Sysroot(_Sysroot), ModuleFormat("raw"), DisableModuleHash(false),
ImplicitModuleMaps(false), ModuleMapFileHomeIsCwd(false),
@@ -214,7 +222,8 @@ public:
ModulesValidateOncePerBuildSession(false),
ModulesValidateSystemHeaders(false),
ValidateASTInputFilesContent(false), UseDebugInfo(false),
- ModulesValidateDiagnosticOptions(true), ModulesHashContent(false) {}
+ ModulesValidateDiagnosticOptions(true), ModulesHashContent(false),
+ ModulesStrictContextHash(false) {}
/// AddPath - Add the \p Path path to the specified \p Group list.
void AddPath(StringRef Path, frontend::IncludeDirGroup Group,
@@ -238,6 +247,15 @@ public:
}
};
+inline llvm::hash_code hash_value(const HeaderSearchOptions::Entry &E) {
+ return llvm::hash_combine(E.Path, E.Group, E.IsFramework, E.IgnoreSysRoot);
+}
+
+inline llvm::hash_code
+hash_value(const HeaderSearchOptions::SystemHeaderPrefix &SHP) {
+ return llvm::hash_combine(SHP.Prefix, SHP.IsSystemHeader);
+}
+
} // namespace clang
#endif // LLVM_CLANG_LEX_HEADERSEARCHOPTIONS_H