[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:17 PST 2024


================
@@ -71,8 +71,21 @@ bool FormatToken::isSimpleTypeSpecifier() const {
   }
 }
 
-bool FormatToken::isTypeOrIdentifier() const {
-  return isSimpleTypeSpecifier() || Tok.isOneOf(tok::kw_auto, tok::identifier);
+// Sorted common C++ non-keyword types.
+static SmallVector<StringRef> CppNonKeywordTypes = {
+    "int16_t",  "int32_t",  "int64_t",  "int8_t",  "intptr_t",  "size_t",
----------------
owenca wrote:

`ssize_t` is a POSIX type. Regarding the fixed-width integer types, I wanted to start with a few common ones. (I will add `ptrdiff_t` though.)

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


More information about the cfe-commits mailing list