summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorVlad Tsyrklevich <vlad@tsyrklevich.net>2017-08-04 20:37:49 +0000
committerVlad Tsyrklevich <vlad@tsyrklevich.net>2017-08-04 20:37:49 +0000
commit04faf0908936010c690ae7f866a92dce915823b9 (patch)
tree5085e4e2036cf1eb78ea62a2c2e7363f2c1d050d /lib/CodeGen/CodeGenFunction.cpp
parentb80084e6704f0e3589ccafca860d4aa973d157dd (diff)
Revert "Reland "CFI: blacklist STL allocate() from unrelated-casts""
This reverts commit r310105. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310121 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp27
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>()) {