summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2017-10-17 20:33:35 +0000
committerAaron Ballman <aaron@aaronballman.com>2017-10-17 20:33:35 +0000
commit35713eba567eb38c99a3fd85ac89747d1524c62c (patch)
treea57bb7914e30091d4940ed7fff29dad879c94d39 /clang/lib/AST/Decl.cpp
parent96d9b7f5e1c5a437879b5192743c96649699a02f (diff)
downloadbcm5719-llvm-35713eba567eb38c99a3fd85ac89747d1524c62c.tar.gz
bcm5719-llvm-35713eba567eb38c99a3fd85ac89747d1524c62c.zip
Enable support for the [[nodiscard]] attribute from WG14 N2050 when enabling double square bracket attributes in C code.
llvm-svn: 316026
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 9b0d976ebb2..f27df1de819 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -3056,7 +3056,8 @@ SourceRange FunctionDecl::getExceptionSpecSourceRange() const {
const Attr *FunctionDecl::getUnusedResultAttr() const {
QualType RetType = getReturnType();
if (RetType->isRecordType()) {
- if (const CXXRecordDecl *Ret = RetType->getAsCXXRecordDecl()) {
+ if (const auto *Ret =
+ dyn_cast_or_null<RecordDecl>(RetType->getAsTagDecl())) {
if (const auto *R = Ret->getAttr<WarnUnusedResultAttr>())
return R;
}
OpenPOWER on IntegriCloud