Index: clang/lib/CodeGen/BackendUtil.cpp =================================================================== --- clang/lib/CodeGen/BackendUtil.cpp +++ clang/lib/CodeGen/BackendUtil.cpp @@ -1013,9 +1013,23 @@ // configure the pipeline. PassBuilder::OptimizationLevel Level = mapToLevel(CodeGenOpts); - // Register callbacks to schedule sanitizer passes at the appropriate part of - // the pipeline. - // FIXME: either handle asan/the remaining sanitizers or error out + // Register callbacks to schedule sanitizer passes at the appropriate part + // of the pipeline. + // + // FIXME: Handle the remaining sanitizers. This throws a fatal error when + // one is selected that's not implemented in the meantime. Update the + // following list as appropriate. + SanitizerMask ImplementedSanitizers = SanitizerKind::LocalBounds | + SanitizerKind::Memory | + SanitizerKind::Thread; +#define SANITIZER(NAME, ID) \ + if (LangOpts.Sanitize.hasOneOf(SanitizerKind::ID & ~ImplementedSanitizers)) \ + report_fatal_error("Trying to use the " NAME \ + " sanitizer, which is not implemented."); +#define SANITIZER_GROUP(NAME, ID, ALIAS) \ + SANITIZER(NAME, ID##Group) SANITIZER(NAME, ID) +#include "clang/Basic/Sanitizers.def" + if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds)) PB.registerScalarOptimizerLateEPCallback( [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {