[PATCH] D46903: [Attr] Don't print attr arg with default value
Joel E. Denny via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 15 13:31:15 PDT 2018
jdenny created this revision.
jdenny added reviewers: aaron.ballman, rsmith, hfinkel.
For example, given:
class __single_inheritance T;
-ast-print -fms-extensions used to print:
class __single_inheritance(1) T;
Clang fails to parse that because the "(1)" is not valid syntax.
This was discovered at:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180514/228390.html
To fix that, this patch generally suppresses printing any attribute
argument that has its default value unless other arguments will be
printed after it. Doing so should always maintain the original source
semantics and produce valid syntax.
However, doing so also drops arguments where attributes are legally
specified explicitly with their default values but are not followed by
other arguments. Correct syntax in the previous case seems more
important than exact textual fidelity in this case.
https://reviews.llvm.org/D46903
Files:
test/SemaCXX/attr-print.cpp
utils/TableGen/ClangAttrEmitter.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46903.146909.patch
Type: text/x-patch
Size: 4155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180515/efbc522c/attachment.bin>
More information about the cfe-commits
mailing list