[PATCH] D146582: [clang] Fix wrong highlight for _Complex
Ilyas Mustafazade via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 21 15:13:55 PDT 2023
1lyasm created this revision.
1lyasm added a reviewer: tbaeder.
Herald added a project: All.
1lyasm requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Fix https://github.com/llvm/llvm-project/issues/61518 by adding check for _Complex
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146582
Files:
clang/lib/Sema/SemaInit.cpp
Index: clang/lib/Sema/SemaInit.cpp
===================================================================
--- clang/lib/Sema/SemaInit.cpp
+++ clang/lib/Sema/SemaInit.cpp
@@ -1252,6 +1252,10 @@
unsigned DK = ExtraInitsIsError ? diag::err_excess_initializers
: diag::ext_excess_initializers;
+ if (T->isAnyComplexType() && Index < IList->getNumInits() - 1)
+ // To highlight third instead of second element of init list when
+ // it is too large for _Complex type.
+ ++Index;
SemaRef.Diag(IList->getInit(Index)->getBeginLoc(), DK)
<< initKind << IList->getInit(Index)->getSourceRange();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146582.507143.patch
Type: text/x-patch
Size: 660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230321/20bc8665/attachment.bin>
More information about the cfe-commits
mailing list