summaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2019-01-03 14:24:31 +0000
committerAaron Ballman <aaron@aaronballman.com>2019-01-03 14:24:31 +0000
commitec8c48fb7d4ee1ee940ab3255f3e25b3e289ab8d (patch)
tree35b99c6fbdf0bf67e4dc4836a14a08cc28254026 /lib/AST/Decl.cpp
parent0e55e1c2d00e984de5fc3830649c5d2f8698e516 (diff)
downloadclang-ec8c48fb7d4ee1ee940ab3255f3e25b3e289ab8d.tar.gz
Diagnose an unused result from a call through a function pointer whose return type is marked [[nodiscard]].
When a function returns a type and that type was declared [[nodiscard]], we diagnose any unused results from that call as though the function were marked nodiscard. The same behavior should apply to calls through a function pointer. This addresses PR31526. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp14
1 files changed, 0 insertions, 14 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index b32e5d9aa0..5536358b1e 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -3231,20 +3231,6 @@ SourceRange FunctionDecl::getExceptionSpecSourceRange() const {
return FTL.getExceptionSpecRange();
}
-const Attr *FunctionDecl::getUnusedResultAttr() const {
- QualType RetType = getReturnType();
- if (const auto *Ret = RetType->getAsRecordDecl()) {
- if (const auto *R = Ret->getAttr<WarnUnusedResultAttr>())
- return R;
- } else if (const auto *ET = RetType->getAs<EnumType>()) {
- if (const EnumDecl *ED = ET->getDecl()) {
- if (const auto *R = ED->getAttr<WarnUnusedResultAttr>())
- return R;
- }
- }
- return getAttr<WarnUnusedResultAttr>();
-}
-
/// For an inline function definition in C, or for a gnu_inline function
/// in C++, determine whether the definition will be externally visible.
///