This is an archive of the discontinued LLVM Phabricator instance.

clang-format: Pointer `*` is seen as multiplication in C-style casts
Needs ReviewPublic

Authored by mxbOctasic on Apr 13 2016, 7:17 AM.

Details

Reviewers
djasper
Summary

The * was treated as multiplication operator in complex pointer type casts.

e.g.
(type *const)bar
(type *restrict)bar

Patch by cameron314

Diff Detail

Event Timeline

mxbOctasic updated this revision to Diff 53550.Apr 13 2016, 7:17 AM
mxbOctasic retitled this revision from to clang-format: Pointer `*` is seen as multiplication in C-style casts.
mxbOctasic updated this object.
mxbOctasic added a reviewer: djasper.
mxbOctasic added subscribers: cameron314, cfe-commits.
djasper added inline comments.Apr 13 2016, 12:37 PM
lib/Format/TokenAnnotator.cpp
1277

I think it would be better to not have such cast detection heuristics in several places. Could we change the type of the "*" to TT_PointerOrReference after the fact, when rParenEndsCast returns true?

Moved cast detection logic to rParenEndsCast.