[clang] [clang-format] Handle common C++ non-keyword types as such (PR #83709)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 23:31:28 PST 2024


================
@@ -268,20 +268,24 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeRight(
   if (isPossibleMacro(TypeToken))
     return Tok;
 
+  const bool IsCpp = Style.isCpp();
+
   // The case `const long long int volatile` -> `long long int const volatile`
   // The case `long const long int volatile` -> `long long int const volatile`
   // The case `long long volatile int const` -> `long long int const volatile`
   // The case `const long long volatile int` -> `long long int const volatile`
-  if (TypeToken->isSimpleTypeSpecifier()) {
+  if (TypeToken->isTypeName(IsCpp)) {
----------------
owenca wrote:

Neither am I, but I don't know of a better way. BTW, `Token::isSimpleTypeSpecifier(const LangOptions &LangOpts)` also has a similar parameter.

https://github.com/llvm/llvm-project/pull/83709


More information about the cfe-commits mailing list