FD->getBody()->getStmtClass() == Stmt::CoroutineBodyStmtClass)
SanOpts.Mask &= ~SanitizerKind::Null;
- if (D) {
- // Apply xray attributes to the function (as a string, for now)
- if (const auto *XRayAttr = D->getAttr<XRayInstrumentAttr>()) {
- if (CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
- XRayInstrKind::FunctionEntry) ||
- CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
- XRayInstrKind::FunctionExit)) {
- if (XRayAttr->alwaysXRayInstrument() && ShouldXRayInstrumentFunction())
- Fn->addFnAttr("function-instrument", "xray-always");
- if (XRayAttr->neverXRayInstrument())
- Fn->addFnAttr("function-instrument", "xray-never");
- if (const auto *LogArgs = D->getAttr<XRayLogArgsAttr>())
- if (ShouldXRayInstrumentFunction())
- Fn->addFnAttr("xray-log-args",
- llvm::utostr(LogArgs->getArgumentCount()));
- }
- } else {
- if (ShouldXRayInstrumentFunction() && !CGM.imbueXRayAttrs(Fn, Loc))
- Fn->addFnAttr(
- "xray-instruction-threshold",
- llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));
+ // Apply xray attributes to the function (as a string, for now)
+ if (const auto *XRayAttr = D ? D->getAttr<XRayInstrumentAttr>() : nullptr) {
+ if (CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
+ XRayInstrKind::FunctionEntry) ||
+ CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
+ XRayInstrKind::FunctionExit)) {
+ if (XRayAttr->alwaysXRayInstrument() && ShouldXRayInstrumentFunction())
+ Fn->addFnAttr("function-instrument", "xray-always");
+ if (XRayAttr->neverXRayInstrument())
+ Fn->addFnAttr("function-instrument", "xray-never");
+ if (const auto *LogArgs = D->getAttr<XRayLogArgsAttr>())
+ if (ShouldXRayInstrumentFunction())
+ Fn->addFnAttr("xray-log-args",
+ llvm::utostr(LogArgs->getArgumentCount()));
}
+ } else {
+ if (ShouldXRayInstrumentFunction() && !CGM.imbueXRayAttrs(Fn, Loc))
+ Fn->addFnAttr(
+ "xray-instruction-threshold",
+ llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));
+ }
- if (ShouldXRayInstrumentFunction()) {
- if (CGM.getCodeGenOpts().XRayIgnoreLoops)
- Fn->addFnAttr("xray-ignore-loops");
+ if (ShouldXRayInstrumentFunction()) {
+ if (CGM.getCodeGenOpts().XRayIgnoreLoops)
+ Fn->addFnAttr("xray-ignore-loops");
- if (!CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
- XRayInstrKind::FunctionExit))
- Fn->addFnAttr("xray-skip-exit");
+ if (!CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
+ XRayInstrKind::FunctionExit))
+ Fn->addFnAttr("xray-skip-exit");
- if (!CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
- XRayInstrKind::FunctionEntry))
- Fn->addFnAttr("xray-skip-entry");
- }
+ if (!CGM.getCodeGenOpts().XRayInstrumentationBundle.has(
+ XRayInstrKind::FunctionEntry))
+ Fn->addFnAttr("xray-skip-entry");
+ }
- unsigned Count, Offset;
- if (const auto *Attr = D->getAttr<PatchableFunctionEntryAttr>()) {
- Count = Attr->getCount();
- Offset = Attr->getOffset();
- } else {
- Count = CGM.getCodeGenOpts().PatchableFunctionEntryCount;
- Offset = CGM.getCodeGenOpts().PatchableFunctionEntryOffset;
- }
- if (Count && Offset <= Count) {
- Fn->addFnAttr("patchable-function-entry", std::to_string(Count - Offset));
- if (Offset)
- Fn->addFnAttr("patchable-function-prefix", std::to_string(Offset));
- }
+ unsigned Count, Offset;
+ if (const auto *Attr =
+ D ? D->getAttr<PatchableFunctionEntryAttr>() : nullptr) {
+ Count = Attr->getCount();
+ Offset = Attr->getOffset();
+ } else {
+ Count = CGM.getCodeGenOpts().PatchableFunctionEntryCount;
+ Offset = CGM.getCodeGenOpts().PatchableFunctionEntryOffset;
+ }
+ if (Count && Offset <= Count) {
+ Fn->addFnAttr("patchable-function-entry", std::to_string(Count - Offset));
+ if (Offset)
+ Fn->addFnAttr("patchable-function-prefix", std::to_string(Offset));
}
// Add no-jump-tables value.