================ @@ -0,0 +1,60 @@ +//===--- SemaExprCXXtUtils.h - Utils for SemaExprCXX ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines helper classes for Sema Expr CXX. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_SEMA_SEMAEXPRCXXUTILS_H +#define LLVM_CLANG_SEMA_SEMAEXPRCXXUTILS_H + +#include "clang/AST/ASTContext.h" +#include "clang/AST/Expr.h" +#include "clang/AST/TypeBase.h" +#include "clang/Basic/SourceLocation.h" +#include "llvm/ADT/APSInt.h" +#include <optional> + +namespace clang { + +/// Helper class to encapsulate an optional pointer to an array size Expr +/// +/// Allows rewriting constructions like: +/// @code if (ArraySize && *ArraySize && (*ArraySize)->getBeginLoc()) +/// into cleaner code: +/// @code if (ArraySize.getExprBeginLoc()) +class ArraySizeOptExpr { + std::optional<Expr *> ArraySize; + +public: ---------------- ojhunt wrote:
I'm sorry, this seems a significantly over engineered/designed solution for this problem. It's a very large abstraction over an optional<Expr> https://github.com/llvm/llvm-project/pull/186617 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
