sidney added a comment. In http://reviews.llvm.org/D17043#348982, @alexfh wrote:
> The attribute can have arguments (e.g. `[[deprecated("use some other API")]] > void f();`), so if there is a good reason, an argument (e.g. a custom > message) can be added to the `warn_unused_result` attribute. Richard might > have thoughts on the matter. Ah, nice! It looks like the format is fairly flexible, too. Maybe it could take presets like `warn_unused_result(no_side_effects)` for common cases in addition to a string for a custom one? I'd be happy to try to work on this once there's a consensus on how/if it should work. ================ Comment at: clang-tidy/misc/NoSideEffectsCheck.cpp:52 @@ +51,3 @@ +AST_MATCHER(CXXMethodDecl, isAPurelyInformationalMethod) { + static const std::unordered_set<std::string> whitelist{ + "get_allocator", ---------------- alexfh wrote: > Can we assume that all const methods shouldn't be called without using their > result? This will make this list much shorter. Good idea. I originally considered making a check that just looks for const methods with unused return values, but Marshall reminded me that const methods in third party code might have side effects. Now that this patch is restricted to STL containers it's safe, though. http://reviews.llvm.org/D17043 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits