clang 24.0.0git
FunctionUtils.cpp
Go to the documentation of this file.
1//===--- FunctionUtils.cpp - Shared function emission queries -------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
11namespace clang::CodeGenUtils {
12
14 const LangOptions &LangOpts) {
15 if (CGOpts.DisableLifetimeMarkers)
16 return false;
17
18 // Sanitizers may use markers.
19 if (CGOpts.SanitizeAddressUseAfterScope ||
20 LangOpts.Sanitize.has(SanitizerKind::HWAddress) ||
21 LangOpts.Sanitize.has(SanitizerKind::Memory) ||
22 LangOpts.Sanitize.has(SanitizerKind::MemtagStack))
23 return true;
24
25 // For now, only in optimized builds.
26 return CGOpts.OptimizationLevel != 0;
27}
28
29} // namespace clang::CodeGenUtils
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
SanitizerSet Sanitize
Set of enabled sanitizers.
bool shouldEmitLifetimeMarkers(const CodeGenOptions &CGOpts, const LangOptions &LangOpts)
Decide whether we need to emit the lifetime markers.
bool has(SanitizerMask K) const
Check if a certain (single) sanitizer is enabled.
Definition Sanitizers.h:174