[PATCH] D141424: [clang][Sema] Fix uninitialized `SourceLocation` for types with multiple attributes and macros.
Volodymyr Sapsai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 10 12:55:33 PST 2023
vsapsai created this revision.
vsapsai added reviewers: rnk, leonardchan, yonghong-song.
Herald added a subscriber: ributzka.
Herald added a project: All.
vsapsai requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Some `TypeLoc`s are considered "sugar" and we go past them in
`GetTypeSourceInfoForDeclarator`. The problem is that we peel off only
the same kind of `TypeLoc` at the time which makes it impossible to
handle mixed sequences like
`AttributedTypeLoc - MacroQualifiedTypeLoc - AttributedTypeLoc - PointerTypeLoc`
In this situation, as shown in the added test, we don't get to
`PointerTypeLoc` and don't set its starLoc leaving it uninitialized.
Address FIXME and peel off "sugar" `TypeLoc`s regardless of their order.
rdar://102149264
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141424
Files:
clang/lib/Sema/SemaType.cpp
clang/unittests/AST/SourceLocationTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141424.487957.patch
Type: text/x-patch
Size: 4476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230110/272364d7/attachment.bin>
More information about the cfe-commits
mailing list