[PATCH] D26953: clang-format: handle formatting on constexpr if

Denis Gladkikh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 10 13:53:13 PST 2017


outcoldman added a comment.

The actual problem is with that clang-format does not know anything about c++17 features, because it does not set it in lang options. Not sure if that will fix constexpr problem as well, but I could solve some other problems with

  tools/clang                                                                                                                        ✓  13:45:12 
  ╰─ svn diff
  Index: lib/Format/Format.cpp
  ===================================================================
  --- lib/Format/Format.cpp	(revision 297506)
  +++ lib/Format/Format.cpp	(working copy)
  @@ -1893,6 +1893,7 @@
     LangOpts.CPlusPlus = 1;
     LangOpts.CPlusPlus11 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
     LangOpts.CPlusPlus14 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
  +  LangOpts.CPlusPlus1z = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
     LangOpts.LineComment = 1;
     bool AlternativeOperators = Style.IsCpp();
     LangOpts.CXXOperatorNames = AlternativeOperators ? 1 : 0;


https://reviews.llvm.org/D26953





More information about the cfe-commits mailing list