aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorMichael Spencer <bigcheesegs@gmail.com>2020-07-07 17:13:02 -0600
committerMichael Spencer <bigcheesegs@gmail.com>2020-07-07 17:13:23 -0600
commit64788d7d5377345af5e3080d26cb6a76c324ab5b (patch)
treeb0b42cfb5981d85b46187f7c84ec4fe65eaa17b5 /clang/lib/Frontend/CompilerInvocation.cpp
parent0fa0cf8638b0777a1a44feebf78a63865e48ecf6 (diff)
downloadllvm-64788d7d5377345af5e3080d26cb6a76c324ab5b.zip
llvm-64788d7d5377345af5e3080d26cb6a76c324ab5b.tar.gz
llvm-64788d7d5377345af5e3080d26cb6a76c324ab5b.tar.bz2
[clang] Include missing LangOpts in `getModuleHash`.
`ObjCRuntime` and `CommentOpts.BlockCommandNames` are checked by `ASTReader::checkLanguageOptions`, but are not part of the module context hash. This can lead to errors when using implicit modules if different TUs have different values for these options when using the same module cache. This was not hit very often due to the rare usage of `-fblock-command-names=` and that `ObjCRuntime` is by default set by the target triple, which is part of the existing context hash.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index f58854c..6f6af91 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3852,6 +3852,10 @@ std::string CompilerInvocation::getModuleHash() const {
for (StringRef Feature : LangOpts->ModuleFeatures)
code = hash_combine(code, Feature);
+ code = hash_combine(code, LangOpts->ObjCRuntime);
+ const auto &BCN = LangOpts->CommentOpts.BlockCommandNames;
+ code = hash_combine(code, hash_combine_range(BCN.begin(), BCN.end()));
+
// Extend the signature with the target options.
code = hash_combine(code, TargetOpts->Triple, TargetOpts->CPU,
TargetOpts->ABI);