diff options
author | Vlad Tsyrklevich <vlad@tsyrklevich.net> | 2017-08-04 19:17:16 +0000 |
---|---|---|
committer | Vlad Tsyrklevich <vlad@tsyrklevich.net> | 2017-08-04 19:17:16 +0000 |
commit | f4697f37f5691eb9399983164cc1cd947e1708db (patch) | |
tree | 9686458a05e757cb8e33c0d8e93d363f23d3950d /lib/CodeGen/CodeGenFunction.cpp | |
parent | 06e5f9a555256ed65aa2ed37d0d5e8ae47479d90 (diff) |
Revert "CFI: blacklist STL allocate() from unrelated-casts"
This reverts commit r310097.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 9d32ad2e70..fc7a10d08b 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -723,25 +723,6 @@ static void markAsIgnoreThreadCheckingAtRuntime(llvm::Function *Fn) { Fn->removeFnAttr(llvm::Attribute::SanitizeThread); } -static bool matchesStlAllocatorFn(const Decl *D, const ASTContext &Ctx) { - auto *MD = dyn_cast_or_null<CXXMethodDecl>(D); - if (!MD || !MD->getName().equals("allocate") || - (MD->getNumParams() != 1 && MD->getNumParams() != 2)) - return false; - - if (MD->parameters()[0]->getType().getCanonicalType() != Ctx.getSizeType()) - return false; - - if (MD->getNumParams() == 2) { - auto *PT = MD->parameters()[1]->getType()->getAs<PointerType>(); - if (!PT || !PT->isVoidPointerType() || - !PT->getPointeeType().isConstQualified()) - return false; - } - - return true; -} - void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, llvm::Function *Fn, @@ -801,14 +782,6 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, } } - // Ignore unrelated casts in STL allocate() since the allocator must cast - // from void* to T* before object initialization completes. Don't match on the - // namespace because not all allocators are in std:: - if (D && SanOpts.has(SanitizerKind::CFIUnrelatedCast)) { - if (matchesStlAllocatorFn(D, getContext())) - SanOpts.Mask &= ~SanitizerKind::CFIUnrelatedCast; - } - // Apply xray attributes to the function (as a string, for now) if (D && ShouldXRayInstrumentFunction()) { if (const auto *XRayAttr = D->getAttr<XRayInstrumentAttr>()) { |