summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2016-05-02 22:29:40 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2016-05-02 22:29:40 +0000
commit1cfa27309184d95b3e2f9a4f74d35fb3723856cc (patch)
tree6556f30c07188102a48428357cbefd2e27f2e84c /clang/lib/CodeGen/CGBlocks.cpp
parent1e918c9cb37c251e8fcc88d403fba89a9fc7ea52 (diff)
downloadbcm5719-llvm-1cfa27309184d95b3e2f9a4f74d35fb3723856cc.tar.gz
bcm5719-llvm-1cfa27309184d95b3e2f9a4f74d35fb3723856cc.zip
Remove unneeded test in tryCaptureAsConstant.
It isn't necessary to call hasDefaultArg because we can't rematerialize a captured variable that is a function parameter, regardless of whether or not it has a default argument. NFC. llvm-svn: 268318
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r--clang/lib/CodeGen/CGBlocks.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 88786bc9fcf..d603d21bbe0 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -262,10 +262,10 @@ static bool isSafeForCXXConstantCapture(QualType type) {
static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM,
CodeGenFunction *CGF,
const VarDecl *var) {
- // Don't rematerialize default arguments of function parameters.
- if (auto *PD = dyn_cast<ParmVarDecl>(var))
- if (PD->hasDefaultArg())
- return nullptr;
+ // Return if this is a function paramter. We shouldn't try to
+ // rematerialize default arguments of function parameters.
+ if (isa<ParmVarDecl>(var))
+ return nullptr;
QualType type = var->getType();
OpenPOWER on IntegriCloud