Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Parse/ParseDecl.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 3,946 Lines • ▼ Show 20 Lines | while (1) { | ||||
case tok::kw_pipe: | case tok::kw_pipe: | ||||
if (!getLangOpts().OpenCL || (getLangOpts().OpenCLVersion < 200 && | if (!getLangOpts().OpenCL || (getLangOpts().OpenCLVersion < 200 && | ||||
!getLangOpts().OpenCLCPlusPlus)) { | !getLangOpts().OpenCLCPlusPlus)) { | ||||
// OpenCL 2.0 and later define this keyword. OpenCL 1.2 and earlier | // OpenCL 2.0 and later define this keyword. OpenCL 1.2 and earlier | ||||
// should support the "pipe" word as identifier. | // should support the "pipe" word as identifier. | ||||
Tok.getIdentifierInfo()->revertTokenIDToIdentifier(); | Tok.getIdentifierInfo()->revertTokenIDToIdentifier(); | ||||
Tok.setKind(tok::identifier); | Tok.setKind(tok::identifier); | ||||
goto DoneWithDeclSpec; | goto DoneWithDeclSpec; | ||||
} | } else if (!getLangOpts().OpenCLPipes) { | ||||
DiagID = diag::err_opencl_unknown_type_specifier; | |||||
PrevSpec = Tok.getIdentifierInfo()->getNameStart(); | |||||
isInvalid = true; | |||||
} else | |||||
isInvalid = DS.SetTypePipe(true, Loc, PrevSpec, DiagID, Policy); | isInvalid = DS.SetTypePipe(true, Loc, PrevSpec, DiagID, Policy); | ||||
break; | break; | ||||
// We only need to enumerate each image type once. | // We only need to enumerate each image type once. | ||||
#define IMAGE_READ_WRITE_TYPE(Type, Id, Ext) | #define IMAGE_READ_WRITE_TYPE(Type, Id, Ext) | ||||
#define IMAGE_WRITE_TYPE(Type, Id, Ext) | #define IMAGE_WRITE_TYPE(Type, Id, Ext) | ||||
#define IMAGE_READ_TYPE(ImgType, Id, Ext) \ | #define IMAGE_READ_TYPE(ImgType, Id, Ext) \ | ||||
case tok::kw_##ImgType##_t: \ | case tok::kw_##ImgType##_t: \ | ||||
if (!handleOpenCLImageKW(Ext, DeclSpec::TST_##ImgType##_t)) \ | if (!handleOpenCLImageKW(Ext, DeclSpec::TST_##ImgType##_t)) \ | ||||
goto DoneWithDeclSpec; \ | goto DoneWithDeclSpec; \ | ||||
▲ Show 20 Lines • Show All 1,156 Lines • ▼ Show 20 Lines | |||||
/// declaration specifier. | /// declaration specifier. | ||||
/// | /// | ||||
/// \param DisambiguatingWithExpression True to indicate that the purpose of | /// \param DisambiguatingWithExpression True to indicate that the purpose of | ||||
/// this check is to disambiguate between an expression and a declaration. | /// this check is to disambiguate between an expression and a declaration. | ||||
bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { | bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { | ||||
switch (Tok.getKind()) { | switch (Tok.getKind()) { | ||||
default: return false; | default: return false; | ||||
// OpenCL 2.0 and later define this keyword. | |||||
case tok::kw_pipe: | case tok::kw_pipe: | ||||
return getLangOpts().OpenCLPipe; | return (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 200) || | ||||
getLangOpts().OpenCLCPlusPlus; | |||||
case tok::identifier: // foo::bar | case tok::identifier: // foo::bar | ||||
// Unfortunate hack to support "Class.factoryMethod" notation. | // Unfortunate hack to support "Class.factoryMethod" notation. | ||||
if (getLangOpts().ObjC && NextToken().is(tok::period)) | if (getLangOpts().ObjC && NextToken().is(tok::period)) | ||||
return false; | return false; | ||||
if (TryAltiVecVectorToken()) | if (TryAltiVecVectorToken()) | ||||
return true; | return true; | ||||
LLVM_FALLTHROUGH; | LLVM_FALLTHROUGH; | ||||
▲ Show 20 Lines • Show All 512 Lines • ▼ Show 20 Lines | void Parser::ParseDeclarator(Declarator &D) { | ||||
ParseDeclaratorInternal(D, &Parser::ParseDirectDeclarator); | ParseDeclaratorInternal(D, &Parser::ParseDirectDeclarator); | ||||
} | } | ||||
static bool isPtrOperatorToken(tok::TokenKind Kind, const LangOptions &Lang, | static bool isPtrOperatorToken(tok::TokenKind Kind, const LangOptions &Lang, | ||||
DeclaratorContext TheContext) { | DeclaratorContext TheContext) { | ||||
if (Kind == tok::star || Kind == tok::caret) | if (Kind == tok::star || Kind == tok::caret) | ||||
return true; | return true; | ||||
if (Kind == tok::kw_pipe && Lang.OpenCLPipe) | // OpenCL 2.0 and later define this keyword. | ||||
if (Kind == tok::kw_pipe && | |||||
((Lang.OpenCL && Lang.OpenCLVersion >= 200) || Lang.OpenCLCPlusPlus)) | |||||
return true; | return true; | ||||
if (!Lang.CPlusPlus) | if (!Lang.CPlusPlus) | ||||
return false; | return false; | ||||
if (Kind == tok::amp) | if (Kind == tok::amp) | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 1,745 Lines • Show Last 20 Lines |