From ebfc427bbe08f0c36af9721d5a4e6d3ffe2e4bf5 Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Wed, 28 Oct 2020 23:29:41 +0100 Subject: [PATCH] [Sema] Let getters assert that trailing return type exists, NFCI This was requested in the review of D90129. --- clang/include/clang/Sema/DeclSpec.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h index 33b57db..abbefc9 100644 --- a/clang/include/clang/Sema/DeclSpec.h +++ b/clang/include/clang/Sema/DeclSpec.h @@ -1502,10 +1502,14 @@ struct DeclaratorChunk { bool hasTrailingReturnType() const { return HasTrailingReturnType; } /// Get the trailing-return-type for this function declarator. - ParsedType getTrailingReturnType() const { return TrailingReturnType; } + ParsedType getTrailingReturnType() const { + assert(HasTrailingReturnType); + return TrailingReturnType; + } /// Get the trailing-return-type location for this function declarator. SourceLocation getTrailingReturnTypeLoc() const { + assert(HasTrailingReturnType); return SourceLocation::getFromRawEncoding(TrailingReturnTypeLoc); } }; -- 2.7.4