[PATCH] D51884: [clang-tidy] ExprMutationAnalyzer: construct from references. Fixes PR38888

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 10 12:35:27 PDT 2018


lebedev.ri created this revision.
lebedev.ri added reviewers: JonasToth, shuaiwang, alexfh.
lebedev.ri added a project: clang-tools-extra.
Herald added subscribers: Szelethus, a.sidorin, xazax.hun.
Herald added a reviewer: george.karpenkov.

I have hit this the rough way, while trying to use this in https://reviews.llvm.org/D51870.

There is no particular point in storing the pointers, and moreover
the pointers are assumed to be non-null, and that assumption is not
enforced. If they are null, it won't be able to do anything good
with them anyway.

Initially i thought about simply adding asserts() that they are
not null, but taking/storing references looks like even cleaner solution?

Fixes PR38888 <https://bugs.llvm.org/show_bug.cgi?id=38888>


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51884

Files:
  clang-tidy/performance/ForRangeCopyCheck.cpp
  clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tidy/utils/ExprMutationAnalyzer.cpp
  clang-tidy/utils/ExprMutationAnalyzer.h
  unittests/clang-tidy/ExprMutationAnalyzerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51884.164724.patch
Type: text/x-patch
Size: 6845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180910/21432774/attachment.bin>


More information about the cfe-commits mailing list