diff options
Diffstat (limited to 'lib/AST/ExprCXX.cpp')
-rw-r--r-- | lib/AST/ExprCXX.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 3891f45c7f..bbf7e044aa 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -1,9 +1,8 @@ //===- ExprCXX.cpp - (C++) Expression AST Node Implementation -------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// // @@ -98,7 +97,8 @@ CXXNewExpr::CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs, SourceRange TypeIdParens, - Expr *ArraySize, InitializationStyle InitializationStyle, + Optional<Expr *> ArraySize, + InitializationStyle InitializationStyle, Expr *Initializer, QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange DirectInitRange) @@ -113,7 +113,7 @@ CXXNewExpr::CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew, "Only NoInit can have no initializer!"); CXXNewExprBits.IsGlobalNew = IsGlobalNew; - CXXNewExprBits.IsArray = ArraySize != nullptr; + CXXNewExprBits.IsArray = ArraySize.hasValue(); CXXNewExprBits.ShouldPassAlignment = ShouldPassAlignment; CXXNewExprBits.UsualArrayDeleteWantsSize = UsualArrayDeleteWantsSize; CXXNewExprBits.StoredInitializationStyle = @@ -123,12 +123,14 @@ CXXNewExpr::CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew, CXXNewExprBits.NumPlacementArgs = PlacementArgs.size(); if (ArraySize) { - if (ArraySize->isInstantiationDependent()) - ExprBits.InstantiationDependent = true; - if (ArraySize->containsUnexpandedParameterPack()) - ExprBits.ContainsUnexpandedParameterPack = true; + if (Expr *SizeExpr = *ArraySize) { + if (SizeExpr->isInstantiationDependent()) + ExprBits.InstantiationDependent = true; + if (SizeExpr->containsUnexpandedParameterPack()) + ExprBits.ContainsUnexpandedParameterPack = true; + } - getTrailingObjects<Stmt *>()[arraySizeOffset()] = ArraySize; + getTrailingObjects<Stmt *>()[arraySizeOffset()] = *ArraySize; } if (Initializer) { @@ -180,11 +182,11 @@ CXXNewExpr::Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs, SourceRange TypeIdParens, - Expr *ArraySize, InitializationStyle InitializationStyle, - Expr *Initializer, QualType Ty, - TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, - SourceRange DirectInitRange) { - bool IsArray = ArraySize != nullptr; + Optional<Expr *> ArraySize, + InitializationStyle InitializationStyle, Expr *Initializer, + QualType Ty, TypeSourceInfo *AllocatedTypeInfo, + SourceRange Range, SourceRange DirectInitRange) { + bool IsArray = ArraySize.hasValue(); bool HasInit = Initializer != nullptr; unsigned NumPlacementArgs = PlacementArgs.size(); bool IsParenTypeId = TypeIdParens.isValid(); @@ -1205,7 +1207,11 @@ CXXMethodDecl *LambdaExpr::getCallOperator() const { TemplateParameterList *LambdaExpr::getTemplateParameterList() const { CXXRecordDecl *Record = getLambdaClass(); return Record->getGenericLambdaTemplateParameterList(); +} +ArrayRef<NamedDecl *> LambdaExpr::getExplicitTemplateParameters() const { + const CXXRecordDecl *Record = getLambdaClass(); + return Record->getLambdaExplicitTemplateParameters(); } CompoundStmt *LambdaExpr::getBody() const { |