зеркало из https://github.com/microsoft/clang-1.git
Support block pointer conversions in C++. I'm storing the test case locally until we can enable blocks in C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60133 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
fa59aad701
Коммит
071f2aec57
|
@ -743,9 +743,24 @@ BuildSimilarlyQualifiedPointerType(const PointerType *FromPtr,
|
||||||
/// 4.10). If so, returns true and places the converted type (that
|
/// 4.10). If so, returns true and places the converted type (that
|
||||||
/// might differ from ToType in its cv-qualifiers at some level) into
|
/// might differ from ToType in its cv-qualifiers at some level) into
|
||||||
/// ConvertedType.
|
/// ConvertedType.
|
||||||
|
///
|
||||||
|
/// This routine also supports conversions to and from block pointers.
|
||||||
bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
|
bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
|
||||||
QualType& ConvertedType)
|
QualType& ConvertedType)
|
||||||
{
|
{
|
||||||
|
// Blocks: Block pointers can be converted to void*.
|
||||||
|
if (FromType->isBlockPointerType() && ToType->isPointerType() &&
|
||||||
|
ToType->getAsPointerType()->getPointeeType()->isVoidType()) {
|
||||||
|
ConvertedType = ToType;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Blocks: A null pointer constant can be converted to a block
|
||||||
|
// pointer type.
|
||||||
|
if (ToType->isBlockPointerType() && From->isNullPointerConstant(Context)) {
|
||||||
|
ConvertedType = ToType;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const PointerType* ToTypePtr = ToType->getAsPointerType();
|
const PointerType* ToTypePtr = ToType->getAsPointerType();
|
||||||
if (!ToTypePtr)
|
if (!ToTypePtr)
|
||||||
return false;
|
return false;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче