[PATCH] D102122: Support warn_unused_result on typedefs
David Blaikie via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 25 14:29:57 PDT 2022
dblaikie added a comment.
Sorry, with all the layers in the previous messages I'm not sure what the summary is. Sounds like the summary is "this is OK to continue work in the direction of supporting [[clang::warn_unused_result]] (only that spelling) for typedefs in C and C++ (for compatibility with C/so that C headers, like LLVM C's APIs can still be parsed as C++), while considering some of the complications raised in the WG21 discussion"?
OK, so I updated this patch with a very first draft/attempt at that - I wasn't sure how to add typedef support to only the clang spelling - so I created a new attribute name in the .td file (is there a better/more suitable way?) and that seems to have created one follow-on issue (partly because of my other choice: Clang still only /instantiates WarnUnusedResultAttr class, not the new WarnUnusedResultClangAttr class - even for the clang spelling, it uses the non-clang attribute class, so /most/ of the code looking at the attribute class type continues to work) - that issue is in SemaCXX/cxx11-attr-print.cpp it doesn't print the attribute spelling correctly, it chooses the C++ standard spelling when trying to reproduce the Clang spelling, I guess because the ClangAttr class isn't used. (but of course if I change the code to actually instantiate the WarnUnusedResultClangAttr class - then all the existing code that handles the attribute class/implements the warning has to be updated to test both attribute classes... )
Is there another way I should be approaching this?
(oh, and there was something about a supported version number for the `has attribute` checking - where would that factor into all this?)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102122/new/
https://reviews.llvm.org/D102122
More information about the cfe-commits
mailing list