Author: ahatanak Date: Mon May 2 17:29:40 2016 New Revision: 268318 URL: http://llvm.org/viewvc/llvm-project?rev=268318&view=rev Log: 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. Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=268318&r1=268317&r2=268318&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon May 2 17:29:40 2016 @@ -262,10 +262,10 @@ static bool isSafeForCXXConstantCapture( 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(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits