Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/CodeGen/CGDeclCXX.cpp
Show First 20 Lines • Show All 415 Lines • ▼ Show 20 Lines | llvm::Function *CodeGenModule::CreateGlobalInitOrCleanUpFunction( | ||||
if (getLangOpts().Sanitize.has(SanitizerKind::SafeStack) && | if (getLangOpts().Sanitize.has(SanitizerKind::SafeStack) && | ||||
!isInSanitizerBlacklist(SanitizerKind::SafeStack, Fn, Loc)) | !isInSanitizerBlacklist(SanitizerKind::SafeStack, Fn, Loc)) | ||||
Fn->addFnAttr(llvm::Attribute::SafeStack); | Fn->addFnAttr(llvm::Attribute::SafeStack); | ||||
if (getLangOpts().Sanitize.has(SanitizerKind::ShadowCallStack) && | if (getLangOpts().Sanitize.has(SanitizerKind::ShadowCallStack) && | ||||
!isInSanitizerBlacklist(SanitizerKind::ShadowCallStack, Fn, Loc)) | !isInSanitizerBlacklist(SanitizerKind::ShadowCallStack, Fn, Loc)) | ||||
Fn->addFnAttr(llvm::Attribute::ShadowCallStack); | Fn->addFnAttr(llvm::Attribute::ShadowCallStack); | ||||
auto RASignKind = getLangOpts().getSignReturnAddressScope(); | |||||
if (RASignKind != LangOptions::SignReturnAddressScopeKind::None) { | |||||
Fn->addFnAttr("sign-return-address", | |||||
RASignKind == LangOptions::SignReturnAddressScopeKind::All | |||||
? "all" | |||||
: "non-leaf"); | |||||
auto RASignKey = getLangOpts().getSignReturnAddressKey(); | |||||
Fn->addFnAttr("sign-return-address-key", | |||||
RASignKey == LangOptions::SignReturnAddressKeyKind::AKey | |||||
? "a_key" | |||||
: "b_key"); | |||||
} | |||||
if (getLangOpts().BranchTargetEnforcement) | |||||
Fn->addFnAttr("branch-target-enforcement"); | |||||
return Fn; | return Fn; | ||||
} | } | ||||
/// Create a global pointer to a function that will initialize a global | /// Create a global pointer to a function that will initialize a global | ||||
/// variable. The user has requested that this pointer be emitted in a specific | /// variable. The user has requested that this pointer be emitted in a specific | ||||
/// section. | /// section. | ||||
void CodeGenModule::EmitPointerToInitFunc(const VarDecl *D, | void CodeGenModule::EmitPointerToInitFunc(const VarDecl *D, | ||||
llvm::GlobalVariable *GV, | llvm::GlobalVariable *GV, | ||||
▲ Show 20 Lines • Show All 386 Lines • Show Last 20 Lines |