[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer
Whisperity via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 14 02:51:28 PDT 2020
whisperity added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp:43
+static bool isLiteral(const Expr *E) {
+ return isa<StringLiteral>(E) ||
+ isa<CharacterLiteral>(E) ||
----------------
baloghadamsoftware wrote:
> aaron.ballman wrote:
> > What about other kinds of literals like user-defined literals, or literal class types? Should this be using `E->getType()->isLiteralType()`?
> `E->getType()->isLiteralType()` does not work since it tells about the type, not the expression itself. Here we should return `true` for literals only, not for any expressions whose type is a literal type. Thus `int` is a literal type, `5` is an `int` literal, but `n` or `return_any_int()` not.
@baloghadamsoftware The original comment by Aaron is left unmarked as "done" here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71199/new/
https://reviews.llvm.org/D71199
More information about the cfe-commits
mailing list