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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 25 05:19:30 PDT 2020


MyDeveloperDay added a comment.

  Foo<const Foo<int>> P; 
  
  // This is needed to trigger the above 'const const' bug above:
  #if 0
  #else
  #endif

produces

  Foo<Foo<int> const const> P;

This bug is caused by the way clang-format re-parses the code for each conditional that the preprocessor caused (I actually didn't know it did this, or why)

The more conditional branches we introduce the more this goes wrong...

  // 'const >' inserted instead of 'const':
  Foo<Foo<int> const const const const> P;
  
  #if 0
  #if 1
  #else
  #endif
  #else
  #endif

I'm not yet sure of the solution or the reason.


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

https://reviews.llvm.org/D69764





More information about the cfe-commits mailing list