[Modules] Handle sanitizer feature mismatches when importing modules
This patch makes it an error to have a mismatch between the enabled sanitizers in a CU, and in any module being imported into the CU. Only mismatches between non-modular sanitizers are treated as errors. This patch also includes non-modular sanitizers in module hashes, in order to ensure module rebuilds occur when -fsanitize=X is toggled on and off for non-modular sanitizers, and to cut down on module rebuilds when the option is toggled for modular sanitizers. This fixes a longstanding issue with implicit modules and sanitizers, which Duncan originally diagnosed. When building with implicit modules it's possible to hit a scenario where modules are built without -fsanitize=address, and are subsequently imported into CUs with -fsanitize=address enabled. This causes strange failures at runtime. The case Duncan found affects libcxx, since its vector implementation behaves differently when ASan is enabled. Implicit module builds should "just work" when -fsanitize=X is toggled on and off across multiple compiler invocations, which is what this patch does. Differential Revision: https://reviews.llvm.org/D32724 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304463 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/Sanitizers.h 8 additions, 2 deletionsinclude/clang/Basic/Sanitizers.h
- lib/Basic/LangOptions.cpp 1 addition, 3 deletionslib/Basic/LangOptions.cpp
- lib/Frontend/CompilerInvocation.cpp 7 additions, 0 deletionslib/Frontend/CompilerInvocation.cpp
- lib/Serialization/ASTReader.cpp 27 additions, 0 deletionslib/Serialization/ASTReader.cpp
- test/Modules/Inputs/check-for-sanitizer-feature/check.h 5 additions, 0 deletionstest/Modules/Inputs/check-for-sanitizer-feature/check.h
- test/Modules/Inputs/check-for-sanitizer-feature/map 3 additions, 0 deletionstest/Modules/Inputs/check-for-sanitizer-feature/map
- test/Modules/check-for-sanitizer-feature.cpp 66 additions, 0 deletionstest/Modules/check-for-sanitizer-feature.cpp
Loading
Please register or sign in to comment