From: David Blaikie Date: Fri, 31 Oct 2014 17:08:11 +0000 (+0000) Subject: Fix unused-function warning differently from r220853 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4dad1441d2d34698bc71cca028fd40d9d27e8714;p=clang Fix unused-function warning differently from r220853 Rather than executing this code only needed for an assertion even in a non-asserts build, just roll the function into the assert. The assertion text literally describes the two cases so it doesn't seem like this benefits much from having a separate function (& have to hassle about ifndef NDEBUG it out, etc) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220970 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 4337eab16b..c979759b7a 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -3283,11 +3283,6 @@ bool FieldDecl::isAnonymousStructOrUnion() const { return false; } -static bool isVLATypeCapturingAllowed(const RecordDecl *RD) { - // Allow variable-length array capturing in Lambdas and CapturedStmts. - return RD->isLambda() || RD->isCapturedRecord(); -} - unsigned FieldDecl::getBitWidthValue(const ASTContext &Ctx) const { assert(isBitField() && "not a bitfield"); Expr *BitWidth = static_cast(InitStorage.getPointer()); @@ -3330,10 +3325,8 @@ SourceRange FieldDecl::getSourceRange() const { } void FieldDecl::setCapturedVLAType(const VariableArrayType *VLAType) { - bool fVLATypeCapturingAllowed = isVLATypeCapturingAllowed(getParent()); - assert(fVLATypeCapturingAllowed && + assert((RD->isLambda() || RD->isCapturedRecord()) && "capturing type in non-lambda or captured record."); - (void)fVLATypeCapturingAllowed; assert(InitStorage.getInt() == ISK_BitWidthOrNothing && InitStorage.getPointer() == nullptr && "bit width, initializer or captured type already set");