sammccall added inline comments.
================ Comment at: lib/Format/Format.cpp:2369 LangOpts.CPlusPlus = 1; - LangOpts.CPlusPlus11 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; - LangOpts.CPlusPlus14 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; - LangOpts.CPlusPlus17 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; - LangOpts.CPlusPlus2a = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; + LangOpts.CPlusPlus11 = Style.Standard >= FormatStyle::LS_Cpp11; + LangOpts.CPlusPlus14 = Style.Standard >= FormatStyle::LS_Cpp11; ---------------- Looking at this more, this is pretty subtle: `Style` *can* be `LS_Auto` here. So we're relying on the fact that Auto is the max value in the enum. It's probably worth making this more explicit, e.g. ``` LanguageStandard LexingStd = Style.Standard == LS_Auto ? LS_Cpp20 : Style.Standard; LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11; etc ``` (a comment would also be fine, but I think the code is at least as clear here) Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65183/new/ https://reviews.llvm.org/D65183 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits