|
@@ -11,7 +11,6 @@
|
|
//
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
-#include "clang/Sema/SemaInternal.h"
|
|
|
|
#include "TypeLocBuilder.h"
|
|
#include "TypeLocBuilder.h"
|
|
#include "clang/AST/ASTConsumer.h"
|
|
#include "clang/AST/ASTConsumer.h"
|
|
#include "clang/AST/ASTContext.h"
|
|
#include "clang/AST/ASTContext.h"
|
|
@@ -22,17 +21,19 @@
|
|
#include "clang/AST/Expr.h"
|
|
#include "clang/AST/Expr.h"
|
|
#include "clang/AST/TypeLoc.h"
|
|
#include "clang/AST/TypeLoc.h"
|
|
#include "clang/AST/TypeLocVisitor.h"
|
|
#include "clang/AST/TypeLocVisitor.h"
|
|
-#include "clang/Lex/Preprocessor.h"
|
|
|
|
#include "clang/Basic/PartialDiagnostic.h"
|
|
#include "clang/Basic/PartialDiagnostic.h"
|
|
#include "clang/Basic/TargetInfo.h"
|
|
#include "clang/Basic/TargetInfo.h"
|
|
#include "clang/Lex/Preprocessor.h"
|
|
#include "clang/Lex/Preprocessor.h"
|
|
|
|
+#include "clang/Lex/Preprocessor.h"
|
|
#include "clang/Sema/DeclSpec.h"
|
|
#include "clang/Sema/DeclSpec.h"
|
|
#include "clang/Sema/DelayedDiagnostic.h"
|
|
#include "clang/Sema/DelayedDiagnostic.h"
|
|
#include "clang/Sema/Lookup.h"
|
|
#include "clang/Sema/Lookup.h"
|
|
#include "clang/Sema/ScopeInfo.h"
|
|
#include "clang/Sema/ScopeInfo.h"
|
|
|
|
+#include "clang/Sema/SemaInternal.h"
|
|
#include "clang/Sema/Template.h"
|
|
#include "clang/Sema/Template.h"
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
|
#include "llvm/ADT/SmallString.h"
|
|
#include "llvm/ADT/SmallString.h"
|
|
|
|
+#include "llvm/ADT/StringSwitch.h"
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
|
|
|
|
using namespace clang;
|
|
using namespace clang;
|
|
@@ -1178,6 +1179,21 @@ TypeResult Sema::actOnObjCTypeArgsAndProtocolQualifiers(
|
|
return CreateParsedType(Result, ResultTInfo);
|
|
return CreateParsedType(Result, ResultTInfo);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static StringRef getImageAccessAttrStr(AttributeList *attrs) {
|
|
|
|
+ if (attrs) {
|
|
|
|
+
|
|
|
|
+ AttributeList *Next;
|
|
|
|
+ do {
|
|
|
|
+ AttributeList &Attr = *attrs;
|
|
|
|
+ Next = Attr.getNext();
|
|
|
|
+ if (Attr.getKind() == AttributeList::AT_OpenCLAccess) {
|
|
|
|
+ return Attr.getName()->getName();
|
|
|
|
+ }
|
|
|
|
+ } while (Next);
|
|
|
|
+ }
|
|
|
|
+ return "";
|
|
|
|
+}
|
|
|
|
+
|
|
/// \brief Convert the specified declspec to the appropriate type
|
|
/// \brief Convert the specified declspec to the appropriate type
|
|
/// object.
|
|
/// object.
|
|
/// \param state Specifies the declarator containing the declaration specifier
|
|
/// \param state Specifies the declarator containing the declaration specifier
|
|
@@ -1362,6 +1378,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case DeclSpec::TST_bool: Result = Context.BoolTy; break; // _Bool or bool
|
|
case DeclSpec::TST_bool: Result = Context.BoolTy; break; // _Bool or bool
|
|
|
|
+ break;
|
|
case DeclSpec::TST_decimal32: // _Decimal32
|
|
case DeclSpec::TST_decimal32: // _Decimal32
|
|
case DeclSpec::TST_decimal64: // _Decimal64
|
|
case DeclSpec::TST_decimal64: // _Decimal64
|
|
case DeclSpec::TST_decimal128: // _Decimal128
|
|
case DeclSpec::TST_decimal128: // _Decimal128
|
|
@@ -1430,9 +1447,18 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
|
|
declarator.setInvalidType(true);
|
|
declarator.setInvalidType(true);
|
|
}
|
|
}
|
|
} else if (!S.getOpenCLOptions().cl_khr_gl_msaa_sharing &&
|
|
} else if (!S.getOpenCLOptions().cl_khr_gl_msaa_sharing &&
|
|
- (Result->isImage2dMSAAT() || Result->isImage2dArrayMSAAT() ||
|
|
|
|
- Result->isImage2dArrayMSAATDepth() ||
|
|
|
|
- Result->isImage2dMSAATDepth())) {
|
|
|
|
|
|
+ (Result->isOCLImage2dArrayMSAADepthROType() ||
|
|
|
|
+ Result->isOCLImage2dArrayMSAADepthWOType() ||
|
|
|
|
+ Result->isOCLImage2dArrayMSAADepthRWType() ||
|
|
|
|
+ Result->isOCLImage2dArrayMSAAROType() ||
|
|
|
|
+ Result->isOCLImage2dArrayMSAARWType() ||
|
|
|
|
+ Result->isOCLImage2dArrayMSAAWOType() ||
|
|
|
|
+ Result->isOCLImage2dMSAADepthROType() ||
|
|
|
|
+ Result->isOCLImage2dMSAADepthRWType() ||
|
|
|
|
+ Result->isOCLImage2dMSAADepthWOType() ||
|
|
|
|
+ Result->isOCLImage2dMSAAROType() ||
|
|
|
|
+ Result->isOCLImage2dMSAARWType() ||
|
|
|
|
+ Result->isOCLImage2dMSAAWOType())) {
|
|
S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_requires_extension)
|
|
S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_requires_extension)
|
|
<< Result << "cl_khr_gl_msaa_sharing";
|
|
<< Result << "cl_khr_gl_msaa_sharing";
|
|
declarator.setInvalidType(true);
|
|
declarator.setInvalidType(true);
|
|
@@ -1546,6 +1572,16 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+#define GENERIC_IMAGE_TYPE(ImgType, Id) \
|
|
|
|
+ case DeclSpec::TST_##ImgType##_t: \
|
|
|
|
+ Result = llvm::StringSwitch<QualType>( \
|
|
|
|
+ getImageAccessAttrStr(DS.getAttributes().getList())) \
|
|
|
|
+ .Cases("write_only", "__write_only", Context.Id##WOTy) \
|
|
|
|
+ .Cases("read_write", "__read_write", Context.Id##RWTy) \
|
|
|
|
+ .Default(Context.Id##ROTy); \
|
|
|
|
+ break;
|
|
|
|
+#include "clang/AST/OpenCLImageTypes.def"
|
|
|
|
+
|
|
case DeclSpec::TST_error:
|
|
case DeclSpec::TST_error:
|
|
Result = Context.IntTy;
|
|
Result = Context.IntTy;
|
|
declarator.setInvalidType(true);
|
|
declarator.setInvalidType(true);
|