[clang] [clang-format] Handle C++ Core Guidelines suppression tags (PR #86458)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 22:07:35 PDT 2024


================
@@ -4827,6 +4827,10 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
         Right.is(TT_TemplateOpener)) {
       return true;
     }
+    if (Left.is(tok::identifier) && Right.is(tok::numeric_constant) &&
+        Right.TokenText[0] == '.') {
----------------
owenca wrote:

I suppose a `numeric_constant` can't follow an `identifier` except when they're inside attributes. clang-format is allowed to remove spaces between any two tokens only if they won't be changed to a single token. That's why we can remove the space in `type .5` but not `type 5`.

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


More information about the cfe-commits mailing list