[all-commits] [llvm/llvm-project] 73d936: [clang-tidy] modernize-use-using uses AST and now ...

mitchell-stellar via All-commits all-commits at lists.llvm.org
Tue Jan 7 13:36:15 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 73d93617d3ae23bad232fa3a160c638728c71c01
      https://github.com/llvm/llvm-project/commit/73d93617d3ae23bad232fa3a160c638728c71c01
  Author: Mitchell Balan <mitchell at stellarscience.com>
  Date:   2020-01-07 (Tue, 07 Jan 2020)

  Changed paths:
    M clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp
    M clang-tools-extra/clang-tidy/modernize/UseUsingCheck.h
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/modernize-use-using.rst
    M clang-tools-extra/test/clang-tidy/checkers/modernize-use-using.cpp
    M clang/include/clang/Basic/SourceLocation.h

  Log Message:
  -----------
  [clang-tidy] modernize-use-using uses AST and now supports struct defintions and multiple types in a typedef

Summary:
It now handles `typedef`s that include comma-separated multiple types, and handles embedded struct definitions, which previously could not be automatically converted.

For example, with this patch `modernize-use-using` now can convert:

typedef struct { int a; } R_t, *R_p;

to:

using R_t = struct { int a; };
using R_p = R_t*;

`-ast-dump` showed that the `CXXRecordDecl` definitions and multiple `TypedefDecl`s come consecutively in the tree, so `check()` stores information between calls to determine when it is receiving a second or additional `TypedefDecl` within a single `typedef`, or when the current `TypedefDecl` refers to an embedded `CXXRecordDecl` like a `struct`.

Reviewers: alexfh, aaron.ballman

Patch by: poelmanc

Subscribers: riccibruno, sammccall, cfe-commits, aaron.ballman

Tags: clang-tools-extra, clang

Differential Revision: https://reviews.llvm.org/D70270




More information about the All-commits mailing list