|
@@ -335,6 +335,7 @@ static DeclaratorChunk *maybeMovePastReturnType(Declarator &declarator,
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::MemberPointer:
|
|
case DeclaratorChunk::MemberPointer:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
return result;
|
|
return result;
|
|
|
|
|
|
// If we do find a function declarator, scan inwards from that,
|
|
// If we do find a function declarator, scan inwards from that,
|
|
@@ -347,6 +348,7 @@ static DeclaratorChunk *maybeMovePastReturnType(Declarator &declarator,
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::Reference:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
continue;
|
|
continue;
|
|
|
|
|
|
case DeclaratorChunk::MemberPointer:
|
|
case DeclaratorChunk::MemberPointer:
|
|
@@ -427,6 +429,7 @@ static void distributeObjCPointerTypeAttr(TypeProcessingState &state,
|
|
// Don't walk through these.
|
|
// Don't walk through these.
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::MemberPointer:
|
|
case DeclaratorChunk::MemberPointer:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -459,6 +462,7 @@ distributeObjCPointerTypeAttrFromDeclarator(TypeProcessingState &state,
|
|
case DeclaratorChunk::MemberPointer:
|
|
case DeclaratorChunk::MemberPointer:
|
|
case DeclaratorChunk::Paren:
|
|
case DeclaratorChunk::Paren:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Array:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
continue;
|
|
continue;
|
|
|
|
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Function:
|
|
@@ -520,6 +524,7 @@ static void distributeFunctionTypeAttr(TypeProcessingState &state,
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::MemberPointer:
|
|
case DeclaratorChunk::MemberPointer:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1272,6 +1277,10 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
|
|
// value being declared, poison it as invalid so we don't get chains of
|
|
// value being declared, poison it as invalid so we don't get chains of
|
|
// errors.
|
|
// errors.
|
|
declarator.setInvalidType(true);
|
|
declarator.setInvalidType(true);
|
|
|
|
+ } else if (S.getLangOpts().OpenCLVersion >= 200 && DS.isTypeSpecPipe()){
|
|
|
|
+ S.Diag(DeclLoc, diag::err_missing_actual_pipe_type)
|
|
|
|
+ << DS.getSourceRange();
|
|
|
|
+ declarator.setInvalidType(true);
|
|
} else {
|
|
} else {
|
|
S.Diag(DeclLoc, diag::ext_missing_type_specifier)
|
|
S.Diag(DeclLoc, diag::ext_missing_type_specifier)
|
|
<< DS.getSourceRange();
|
|
<< DS.getSourceRange();
|
|
@@ -1564,7 +1573,9 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
|
|
// Apply any type attributes from the decl spec. This may cause the
|
|
// Apply any type attributes from the decl spec. This may cause the
|
|
// list of type attributes to be temporarily saved while the type
|
|
// list of type attributes to be temporarily saved while the type
|
|
// attributes are pushed around.
|
|
// attributes are pushed around.
|
|
- processTypeAttrs(state, Result, TAL_DeclSpec, DS.getAttributes().getList());
|
|
|
|
|
|
+ // pipe attributes will be handled later ( at GetFullTypeForDeclarator )
|
|
|
|
+ if (!DS.isTypeSpecPipe())
|
|
|
|
+ processTypeAttrs(state, Result, TAL_DeclSpec, DS.getAttributes().getList());
|
|
|
|
|
|
// Apply const/volatile/restrict qualifiers to T.
|
|
// Apply const/volatile/restrict qualifiers to T.
|
|
if (unsigned TypeQuals = DS.getTypeQualifiers()) {
|
|
if (unsigned TypeQuals = DS.getTypeQualifiers()) {
|
|
@@ -1924,6 +1935,21 @@ QualType Sema::BuildReferenceType(QualType T, bool SpelledAsLValue,
|
|
return Context.getRValueReferenceType(T);
|
|
return Context.getRValueReferenceType(T);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/// \brief Build a Pipe type.
|
|
|
|
+///
|
|
|
|
+/// \param T The type to which we'll be building a Pipe.
|
|
|
|
+///
|
|
|
|
+/// \param Loc We do not use it for now.
|
|
|
|
+///
|
|
|
|
+/// \returns A suitable pipe type, if there are no errors. Otherwise, returns a
|
|
|
|
+/// NULL type.
|
|
|
|
+QualType Sema::BuildPipeType(QualType T, SourceLocation Loc) {
|
|
|
|
+ assert(!T->isObjCObjectType() && "Should build ObjCObjectPointerType");
|
|
|
|
+
|
|
|
|
+ // Build the pipe type.
|
|
|
|
+ return Context.getPipeType(T);
|
|
|
|
+}
|
|
|
|
+
|
|
/// Check whether the specified array size makes the array type a VLA. If so,
|
|
/// Check whether the specified array size makes the array type a VLA. If so,
|
|
/// return true, if not, return the size of the array in SizeVal.
|
|
/// return true, if not, return the size of the array in SizeVal.
|
|
static bool isArraySizeVLA(Sema &S, Expr *ArraySize, llvm::APSInt &SizeVal) {
|
|
static bool isArraySizeVLA(Sema &S, Expr *ArraySize, llvm::APSInt &SizeVal) {
|
|
@@ -2393,6 +2419,7 @@ static void inferARCWriteback(TypeProcessingState &state,
|
|
case DeclaratorChunk::Array: // suppress if written (id[])?
|
|
case DeclaratorChunk::Array: // suppress if written (id[])?
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::MemberPointer:
|
|
case DeclaratorChunk::MemberPointer:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2532,6 +2559,7 @@ static void diagnoseRedundantReturnTypeQualifiers(Sema &S, QualType RetTy,
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::MemberPointer:
|
|
case DeclaratorChunk::MemberPointer:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
// FIXME: We can't currently provide an accurate source location and a
|
|
// FIXME: We can't currently provide an accurate source location and a
|
|
// fix-it hint for these.
|
|
// fix-it hint for these.
|
|
unsigned AtomicQual = RetTy->isAtomicType() ? DeclSpec::TQ_atomic : 0;
|
|
unsigned AtomicQual = RetTy->isAtomicType() ? DeclSpec::TQ_atomic : 0;
|
|
@@ -3057,6 +3085,7 @@ static PointerDeclaratorKind classifyPointerDeclarator(Sema &S,
|
|
switch (chunk.Kind) {
|
|
switch (chunk.Kind) {
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Function:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
break;
|
|
break;
|
|
|
|
|
|
case DeclaratorChunk::BlockPointer:
|
|
case DeclaratorChunk::BlockPointer:
|
|
@@ -3305,6 +3334,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Array:
|
|
DiagKind = 2;
|
|
DiagKind = 2;
|
|
break;
|
|
break;
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
|
|
S.Diag(DeclChunk.Loc, DiagId) << DiagKind;
|
|
S.Diag(DeclChunk.Loc, DiagId) << DiagKind;
|
|
@@ -3370,6 +3401,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
|
switch (chunk.Kind) {
|
|
switch (chunk.Kind) {
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Function:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
break;
|
|
break;
|
|
|
|
|
|
case DeclaratorChunk::BlockPointer:
|
|
case DeclaratorChunk::BlockPointer:
|
|
@@ -3689,6 +3721,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
|
break;
|
|
break;
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::BlockPointer:
|
|
case DeclaratorChunk::BlockPointer:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
// These are invalid anyway, so just ignore.
|
|
// These are invalid anyway, so just ignore.
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -4038,7 +4071,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
|
|
|
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- case DeclaratorChunk::MemberPointer:
|
|
|
|
|
|
+ case DeclaratorChunk::MemberPointer: {
|
|
// The scope spec must refer to a class, or be dependent.
|
|
// The scope spec must refer to a class, or be dependent.
|
|
CXXScopeSpec &SS = DeclType.Mem.Scope();
|
|
CXXScopeSpec &SS = DeclType.Mem.Scope();
|
|
QualType ClsType;
|
|
QualType ClsType;
|
|
@@ -4098,6 +4131,12 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ case DeclaratorChunk::Pipe: {
|
|
|
|
+ T = S.BuildPipeType(T, DeclType.Loc );
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if (T.isNull()) {
|
|
if (T.isNull()) {
|
|
D.setInvalidType(true);
|
|
D.setInvalidType(true);
|
|
T = Context.IntTy;
|
|
T = Context.IntTy;
|
|
@@ -4392,6 +4431,7 @@ static void transferARCOwnership(TypeProcessingState &state,
|
|
|
|
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::MemberPointer:
|
|
case DeclaratorChunk::MemberPointer:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -4682,6 +4722,14 @@ namespace {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ void VisitPipeTypeLoc(PipeTypeLoc TL) {
|
|
|
|
+ TL.setKWLoc(DS.getTypeSpecTypeLoc());
|
|
|
|
+
|
|
|
|
+ TypeSourceInfo *TInfo = 0;
|
|
|
|
+ Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
|
|
|
|
+ TL.getValueLoc().initializeFullCopy(TInfo->getTypeLoc());
|
|
|
|
+ }
|
|
|
|
+
|
|
void VisitTypeLoc(TypeLoc TL) {
|
|
void VisitTypeLoc(TypeLoc TL) {
|
|
// FIXME: add other typespec types and change this to an assert.
|
|
// FIXME: add other typespec types and change this to an assert.
|
|
TL.initialize(Context, DS.getTypeSpecTypeLoc());
|
|
TL.initialize(Context, DS.getTypeSpecTypeLoc());
|
|
@@ -4802,6 +4850,10 @@ namespace {
|
|
TL.setLParenLoc(Chunk.Loc);
|
|
TL.setLParenLoc(Chunk.Loc);
|
|
TL.setRParenLoc(Chunk.EndLoc);
|
|
TL.setRParenLoc(Chunk.EndLoc);
|
|
}
|
|
}
|
|
|
|
+ void VisitPipeTypeLoc(PipeTypeLoc TL) {
|
|
|
|
+ assert(Chunk.Kind == DeclaratorChunk::Pipe);
|
|
|
|
+ TL.setKWLoc(Chunk.Loc);
|
|
|
|
+ }
|
|
|
|
|
|
void VisitTypeLoc(TypeLoc TL) {
|
|
void VisitTypeLoc(TypeLoc TL) {
|
|
llvm_unreachable("unsupported TypeLoc kind in declarator!");
|
|
llvm_unreachable("unsupported TypeLoc kind in declarator!");
|
|
@@ -4815,6 +4867,7 @@ static void fillAtomicQualLoc(AtomicTypeLoc ATL, const DeclaratorChunk &Chunk) {
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Function:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Array:
|
|
case DeclaratorChunk::Paren:
|
|
case DeclaratorChunk::Paren:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
llvm_unreachable("cannot be _Atomic qualified");
|
|
llvm_unreachable("cannot be _Atomic qualified");
|
|
|
|
|
|
case DeclaratorChunk::Pointer:
|
|
case DeclaratorChunk::Pointer:
|
|
@@ -5738,6 +5791,7 @@ static bool distributeNullabilityTypeAttr(TypeProcessingState &state,
|
|
|
|
|
|
// Don't walk through these.
|
|
// Don't walk through these.
|
|
case DeclaratorChunk::Reference:
|
|
case DeclaratorChunk::Reference:
|
|
|
|
+ case DeclaratorChunk::Pipe:
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|