[PATCH] D94092: [Clang] Remove unnecessary Attr.isArgIdent checks.
Florian Hahn via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 5 08:51:32 PST 2021
fhahn added a comment.
================
Comment at: clang/lib/Sema/SemaType.cpp:7661
- Expr *SizeExpr;
- // Special case where the argument is a template id.
- if (Attr.isArgIdent(0)) {
- CXXScopeSpec SS;
- SourceLocation TemplateKWLoc;
- UnqualifiedId Id;
- Id.setIdentifier(Attr.getArgAsIdent(0)->Ident, Attr.getLoc());
-
- ExprResult Size = S.ActOnIdExpression(S.getCurScope(), SS, TemplateKWLoc,
- Id, /*HasTrailingLParen=*/false,
- /*IsAddressOfOperand=*/false);
-
- if (Size.isInvalid())
- return;
- SizeExpr = Size.get();
- } else {
- SizeExpr = Attr.getArgAsExpr(0);
- }
+ assert(Attr.isArgExpr(0) && "Argument to should be an expression");
+ Expr *SizeExpr = Attr.getArgAsExpr(0);
----------------
erichkeane wrote:
> I think the asserts aren't necessary, isArgExpr does a ArgsUnion::get<Expr*>, which already asserts.
Good point, I removed the assertions. It's even more compact now :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94092/new/
https://reviews.llvm.org/D94092
More information about the cfe-commits
mailing list