[PATCH] D128439: [Clang][WIP] Don't call distributeTypeAttrsFromDeclarator() on empty list.

Martin Böhme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 06:08:08 PDT 2022

mboehme created this revision.
Herald added a project: All.
mboehme requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This check was present before https://reviews.llvm.org/D126061. I eliminated it
as part of that patch because it seemed superfluous; the check has no influence
on behavior. However, as @yurai007 points out in
https://reviews.llvm.org/D128097, this change may have had a negative impact on
compile time, so I'm adding the check back in.

  rG LLVM Github Monorepo



Index: clang/lib/Sema/SemaType.cpp
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -3430,7 +3430,8 @@
   // Note: We don't need to distribute declaration attributes (i.e.
   // D.getDeclarationAttributes()) because those are always C++11 attributes,
   // and those don't get distributed.
-  distributeTypeAttrsFromDeclarator(state, T);
+  if (!D.getAttributes().empty())
+    distributeTypeAttrsFromDeclarator(state, T);
   // Find the deduced type in this type. Look in the trailing return type if we
   // have one, otherwise in the DeclSpec type.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128439.439370.patch
Type: text/x-patch
Size: 640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220623/3fc344a9/attachment.bin>

More information about the cfe-commits mailing list