[PATCH] D50953: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer

Shuai Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 19 21:52:55 PDT 2018


shuaiwang created this revision.
shuaiwang added reviewers: aaron.ballman, alexfh.
Herald added subscribers: cfe-commits, Szelethus, a.sidorin, xazax.hun.
Herald added a reviewer: george.karpenkov.

This handles cases like this:

  typedef int& IntRef;
  void mutate(IntRef);
  void f() {
    int x;
    mutate(x);
  }

where the param type is a sugared type (`TypedefType`) instead of a
reference type directly.

Note that another category of similar but different cases are already
handled properly before:

  typedef int Int;
  void mutate(Int&);
  void f() {
    int x;
    mutate(x);
  }


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50953

Files:
  clang-tidy/utils/ExprMutationAnalyzer.cpp
  unittests/clang-tidy/ExprMutationAnalyzerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50953.161415.patch
Type: text/x-patch
Size: 4269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180820/fda07860/attachment.bin>


More information about the cfe-commits mailing list