SemaDeclCXX.cpp (204643) | SemaDeclCXX.cpp (204793) |
---|---|
1//===------ SemaDeclCXX.cpp - Semantic Analysis for C++ Declarations ------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 5198 unchanged lines hidden (view full) --- 5207 Invalid = true; 5208 5209 if (!Invalid && !ExDeclType->isDependentType() && 5210 RequireNonAbstractType(Loc, ExDeclType, 5211 diag::err_abstract_type_in_decl, 5212 AbstractVariableType)) 5213 Invalid = true; 5214 | 1//===------ SemaDeclCXX.cpp - Semantic Analysis for C++ Declarations ------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 5198 unchanged lines hidden (view full) --- 5207 Invalid = true; 5208 5209 if (!Invalid && !ExDeclType->isDependentType() && 5210 RequireNonAbstractType(Loc, ExDeclType, 5211 diag::err_abstract_type_in_decl, 5212 AbstractVariableType)) 5213 Invalid = true; 5214 |
5215 // FIXME: Need to test for ability to copy-construct and destroy the 5216 // exception variable. 5217 5218 // FIXME: Need to check for abstract classes. 5219 | |
5220 VarDecl *ExDecl = VarDecl::Create(Context, CurContext, Loc, 5221 Name, ExDeclType, TInfo, VarDecl::None); 5222 | 5215 VarDecl *ExDecl = VarDecl::Create(Context, CurContext, Loc, 5216 Name, ExDeclType, TInfo, VarDecl::None); 5217 |
5218 if (!Invalid) { 5219 if (const RecordType *RecordTy = ExDeclType->getAs<RecordType>()) { 5220 // C++ [except.handle]p16: 5221 // The object declared in an exception-declaration or, if the 5222 // exception-declaration does not specify a name, a temporary (12.2) is 5223 // copy-initialized (8.5) from the exception object. [...] 5224 // The object is destroyed when the handler exits, after the destruction 5225 // of any automatic objects initialized within the handler. 5226 // 5227 // We just pretend to initialize the object with itself, then make sure 5228 // it can be destroyed later. 5229 InitializedEntity Entity = InitializedEntity::InitializeVariable(ExDecl); 5230 Expr *ExDeclRef = DeclRefExpr::Create(Context, 0, SourceRange(), ExDecl, 5231 Loc, ExDeclType, 0); 5232 InitializationKind Kind = InitializationKind::CreateCopy(Loc, 5233 SourceLocation()); 5234 InitializationSequence InitSeq(*this, Entity, Kind, &ExDeclRef, 1); 5235 OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, 5236 MultiExprArg(*this, (void**)&ExDeclRef, 1)); 5237 if (Result.isInvalid()) 5238 Invalid = true; 5239 else 5240 FinalizeVarWithDestructor(ExDecl, RecordTy); 5241 } 5242 } 5243 |
|
5223 if (Invalid) 5224 ExDecl->setInvalidDecl(); 5225 5226 return ExDecl; 5227} 5228 5229/// ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch 5230/// handler. --- 672 unchanged lines hidden --- | 5244 if (Invalid) 5245 ExDecl->setInvalidDecl(); 5246 5247 return ExDecl; 5248} 5249 5250/// ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch 5251/// handler. --- 672 unchanged lines hidden --- |