[cfe-commits] r105533 - in /cfe/trunk/lib/Sema: SemaExpr.cpp SemaInit.cpp SemaInit.h
Fariborz Jahanian
fjahanian at apple.com
Mon Jun 7 09:14:00 PDT 2010
Author: fjahanian
Date: Mon Jun 7 11:14:00 2010
New Revision: 105533
URL: http://llvm.org/viewvc/llvm-project?rev=105533&view=rev
Log:
Use MaybeCreateCXXExprWithTemporaries for potential destruction of
created temporary. Use own initialized entity for copied in block
variables.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaInit.h
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=105533&r1=105532&r2=105533&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Jun 7 11:14:00 2010
@@ -1757,11 +1757,12 @@
SourceLocation());
OwningExprResult Res = PerformCopyInitialization(
- InitializedEntity::InitializeResult(SourceLocation(),
- T, false),
+ InitializedEntity::InitializeBlock(VD->getLocation(),
+ T, false),
SourceLocation(),
Owned(E));
if (!Res.isInvalid()) {
+ Res = MaybeCreateCXXExprWithTemporaries(move(Res));
Expr *Init = Res.takeAs<Expr>();
if (isa<CXXConstructExpr>(Init))
BDRE->setCopyConstructorExpr(Init);
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=105533&r1=105532&r2=105533&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Mon Jun 7 11:14:00 2010
@@ -1956,6 +1956,7 @@
case EK_Base:
case EK_ArrayElement:
case EK_VectorElement:
+ case EK_BlockElement:
return DeclarationName();
}
@@ -1977,6 +1978,7 @@
case EK_Base:
case EK_ArrayElement:
case EK_VectorElement:
+ case EK_BlockElement:
return 0;
}
@@ -1998,6 +2000,7 @@
case EK_Base:
case EK_ArrayElement:
case EK_VectorElement:
+ case EK_BlockElement:
break;
}
@@ -3170,6 +3173,7 @@
case InitializedEntity::EK_Member:
case InitializedEntity::EK_ArrayElement:
case InitializedEntity::EK_VectorElement:
+ case InitializedEntity::EK_BlockElement:
return Sema::AA_Initializing;
}
@@ -3188,6 +3192,7 @@
case InitializedEntity::EK_Base:
case InitializedEntity::EK_VectorElement:
case InitializedEntity::EK_Exception:
+ case InitializedEntity::EK_BlockElement:
return false;
case InitializedEntity::EK_Parameter:
@@ -3207,6 +3212,7 @@
case InitializedEntity::EK_New:
case InitializedEntity::EK_Base:
case InitializedEntity::EK_VectorElement:
+ case InitializedEntity::EK_BlockElement:
return false;
case InitializedEntity::EK_Variable:
@@ -3291,6 +3297,7 @@
case InitializedEntity::EK_New:
case InitializedEntity::EK_Base:
case InitializedEntity::EK_VectorElement:
+ case InitializedEntity::EK_BlockElement:
Loc = CurInitExpr->getLocStart();
break;
}
Modified: cfe/trunk/lib/Sema/SemaInit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.h?rev=105533&r1=105532&r2=105533&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.h (original)
+++ cfe/trunk/lib/Sema/SemaInit.h Mon Jun 7 11:14:00 2010
@@ -66,7 +66,10 @@
EK_Base,
/// \brief The entity being initialized is an element of a vector.
/// or vector.
- EK_VectorElement
+ EK_VectorElement,
+ /// \brief The entity being initialized is a field of block descriptor for
+ /// the copied-in c++ object.
+ EK_BlockElement
};
private:
@@ -166,6 +169,11 @@
return InitializedEntity(EK_Result, ReturnLoc, Type, NRVO);
}
+ static InitializedEntity InitializeBlock(SourceLocation BlockVarLoc,
+ QualType Type, bool NRVO) {
+ return InitializedEntity(EK_BlockElement, BlockVarLoc, Type, NRVO);
+ }
+
/// \brief Create the initialization entity for an exception object.
static InitializedEntity InitializeException(SourceLocation ThrowLoc,
QualType Type, bool NRVO) {
More information about the cfe-commits
mailing list