[PATCH] D69764: [clang-format] Add East/West Const fixer capability

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 29 11:27:14 PDT 2020


steveire added a comment.

Here's some more failing testcases.

  class Aa;
  class A;
  struct timespec;
  
  // Crash
  // #define UL unsigned long
  
  // Transformed, but with error reported:
  bool foo(Aa const &);
  
  // Not transformed (uppercase)
  template <typename T> bool bar(T const &);
  template <typename TYPE> bool bat(TYPE const &);
  bool bing(A const &);
  
  // const inserted after struct. Does not compile
  void fot(struct timespec const t);
  
  // Not transformed
  template <typename Type> void tov(typename Type::SubType const tu);
  
  // const inserted after typename. Does not compile
  template <typename Type> void tor(typename Type::SubType const &tu);
  template <typename Type> void top(typename Type::SubType const *tu);
  
  // const inserted after `TYPE::` (because uppercase?)
  template <typename TYPE> void top(typename TYPE::SubType const *tu);

This time I used

  BasedOnStyle: LLVM
  PointerAlignment: Left
  ConstPlacement: West

It seems to me that the heuristic "if the token is all uppercase assume it's a macro containing a * or &" is not the right heuristic. The mechanism of allowing the user to specify problematic macros in the config seems to make more sense.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69764/new/

https://reviews.llvm.org/D69764





More information about the cfe-commits mailing list