summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-12-08 19:51:42 +0000
committerVedant Kumar <vsk@apple.com>2017-12-08 19:51:42 +0000
commit9174b684b7cd13e26b0eb35e33a67a9b6e971862 (patch)
tree617b15dbddfacb8dd9b884c0d86745364b3053ab /clang/lib/CodeGen
parentd9073510b7c20c8a758c3fbed2519fc4f4a1066d (diff)
downloadbcm5719-llvm-9174b684b7cd13e26b0eb35e33a67a9b6e971862.tar.gz
bcm5719-llvm-9174b684b7cd13e26b0eb35e33a67a9b6e971862.zip
[ubsan] array-bounds: Ignore params with constant size
This is a follow-up to r320128. Eli pointed out that there is some gray area in the language standard about whether the constant size is exact, or a lower bound. https://reviews.llvm.org/D40940 llvm-svn: 320185
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp8
1 files changed, 0 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 64af2096c98..c61bc0d6422 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -829,14 +829,6 @@ llvm::Value *CodeGenFunction::LoadPassedObjectSize(const Expr *E,
if (!ParamDecl)
return nullptr;
- // Arrays don't have pass_object_size attributes, but if they have a constant
- // size modifier it's the array size (C99 6.5.7.2p1).
- if (auto *DecayedArrayTy = dyn_cast<DecayedType>(ParamDecl->getType()))
- if (auto *ArrayTy =
- dyn_cast<ConstantArrayType>(DecayedArrayTy->getOriginalType()))
- return llvm::ConstantInt::get(SizeTy,
- ArrayTy->getSize().getLimitedValue());
-
auto *POSAttr = ParamDecl->getAttr<PassObjectSizeAttr>();
if (!POSAttr)
return nullptr;
OpenPOWER on IntegriCloud