This revision was automatically updated to reflect the committed changes.
Closed by commit rL300764: Corrrect warn_unused_result attribute (authored by
erichkeane).
Changed prior to commit:
https://reviews.llvm.org/D32207?vs=95807&id=95823#toc
Repository:
rL LLVM
https://reviews.llvm.org/D
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM!
https://reviews.llvm.org/D32207
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman
erichkeane updated this revision to Diff 95807.
erichkeane marked 3 inline comments as done.
erichkeane added a comment.
Added the tests, plus the two formatting changes.
https://reviews.llvm.org/D32207
Files:
include/clang/AST/Decl.h
lib/AST/Decl.cpp
test/SemaCXX/warn-unused-result.cpp
aaron.ballman added a comment.
I'm surprised this change didn't cause any other tests to need to be updated. A
few small formatting nits and a request for another test, but otherwise looking
good.
Comment at: test/SemaCXX/warn-unused-result.cpp:166
+// C++ Methods should warn
erichkeane updated this revision to Diff 95797.
erichkeane added a comment.
As discussed, removed the exception for postfix operators. It seems like the
right thing to do.I didn't add the [[nodiscard]] test, since it is the same
intended behavior now.
https://reviews.llvm.org/D32207
Files:
aaron.ballman added a comment.
In https://reviews.llvm.org/D32207#730681, @erichkeane wrote:
> 1 more thing: I excepted post-increment/decrement from this warning because
> I figured it would give a TON of warnings from people using post-inc/dec in
> for loops.
>
> However, after further discu
erichkeane added a comment.
1 more thing: I excepted post-increment/decrement from this warning because I
figured it would give a TON of warnings from people using post-inc/dec in for
loops.
However, after further discussion with Craig (who brought this up on the
mailing list), I severely won
erichkeane marked an inline comment as done.
erichkeane added inline comments.
Comment at: lib/AST/Decl.cpp:3010
+(OpCode == OO_PlusPlus || OpCode == OO_MinusMinus) &&
+(this->getNumParams() + (isa(this) ? 1 : 0)) == 2;
+if (Ret && !IsPostfix) {
--
aaron.ballman added inline comments.
Comment at: lib/AST/Decl.cpp:3007
const CXXRecordDecl *Ret = RetType->getAsCXXRecordDecl();
-const auto *MD = dyn_cast(this);
-if (Ret && !(MD && MD->getCorrespondingMethodInClass(Ret, true))) {
+auto OpCode = getOverloadedOpe
erichkeane created this revision.
The original idea was that if the attribute on an operator, that the
return-value unused-ness wouldn't matter. However, all of the operators except
postfix inc/dec return references! References don't result in this warning
anyway, so those are already exclude
10 matches
Mail list logo