r220970 - Fix unused-function warning differently from r220853
David Blaikie
dblaikie at gmail.com
Fri Oct 31 10:08:11 PDT 2014
Author: dblaikie
Date: Fri Oct 31 12:08:11 2014
New Revision: 220970
URL: http://llvm.org/viewvc/llvm-project?rev=220970&view=rev
Log:
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)
Modified:
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=220970&r1=220969&r2=220970&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Oct 31 12:08:11 2014
@@ -3283,11 +3283,6 @@ bool FieldDecl::isAnonymousStructOrUnion
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<Expr *>(InitStorage.getPointer());
@@ -3330,10 +3325,8 @@ SourceRange FieldDecl::getSourceRange()
}
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");
More information about the cfe-commits
mailing list