Author: dblaikie Date: Fri Jan 15 17:43:34 2016 New Revision: 257958 URL: http://llvm.org/viewvc/llvm-project?rev=257958&view=rev Log: OpaquePtr: Use nullptr construction for ParsedType OpaquePtr typedef
Modified: cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Parse/ParseDecl.cpp cfe/trunk/lib/Parse/ParseDeclCXX.cpp cfe/trunk/lib/Parse/ParseExpr.cpp cfe/trunk/lib/Parse/ParseExprCXX.cpp cfe/trunk/lib/Parse/ParseInit.cpp cfe/trunk/lib/Parse/ParseObjc.cpp cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Parse/ParseStmtAsm.cpp cfe/trunk/lib/Parse/ParseTemplate.cpp cfe/trunk/lib/Parse/Parser.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/lib/Sema/SemaExprObjC.cpp cfe/trunk/lib/Sema/SemaTemplate.cpp Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Fri Jan 15 17:43:34 2016 @@ -1485,9 +1485,8 @@ public: ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS = nullptr, - bool isClassName = false, - bool HasTrailingDot = false, - ParsedType ObjectType = ParsedType(), + bool isClassName = false, bool HasTrailingDot = false, + ParsedType ObjectType = nullptr, bool IsCtorOrDtorName = false, bool WantNontrivialTypeSourceInfo = false, IdentifierInfo **CorrectedII = nullptr); Modified: cfe/trunk/lib/Parse/ParseDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseDecl.cpp (original) +++ cfe/trunk/lib/Parse/ParseDecl.cpp Fri Jan 15 17:43:34 2016 @@ -2835,12 +2835,11 @@ void Parser::ParseDeclarationSpecifiers( << Next.getIdentifierInfo() << 1 /* type */; } - ParsedType TypeRep = Actions.getTypeName(*Next.getIdentifierInfo(), - Next.getLocation(), - getCurScope(), &SS, - false, false, ParsedType(), - /*IsCtorOrDtorName=*/false, - /*NonTrivialSourceInfo=*/true); + ParsedType TypeRep = + Actions.getTypeName(*Next.getIdentifierInfo(), Next.getLocation(), + getCurScope(), &SS, false, false, nullptr, + /*IsCtorOrDtorName=*/false, + /*NonTrivialSourceInfo=*/true); // If the referenced identifier is not a type, then this declspec is // erroneous: We already checked about that it has no type specifier, and @@ -3788,7 +3787,7 @@ void Parser::ParseEnumSpecifier(SourceLo ColonProtectionRAIIObject X(*this, AllowFixedUnderlyingType); CXXScopeSpec Spec; - if (ParseOptionalCXXScopeSpecifier(Spec, ParsedType(), + if (ParseOptionalCXXScopeSpecifier(Spec, nullptr, /*EnteringContext=*/true)) return; @@ -4588,7 +4587,7 @@ bool Parser::isConstructorDeclarator(boo // Parse the C++ scope specifier. CXXScopeSpec SS; - if (ParseOptionalCXXScopeSpecifier(SS, ParsedType(), + if (ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/true)) { TPA.Revert(); return false; @@ -4932,7 +4931,7 @@ void Parser::ParseDeclaratorInternal(Dec bool EnteringContext = D.getContext() == Declarator::FileContext || D.getContext() == Declarator::MemberContext; CXXScopeSpec SS; - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), EnteringContext); + ParseOptionalCXXScopeSpecifier(SS, nullptr, EnteringContext); if (SS.isNotEmpty()) { if (Tok.isNot(tok::star)) { @@ -5147,7 +5146,7 @@ void Parser::ParseDirectDeclarator(Decla if (D.getCXXScopeSpec().isEmpty()) { bool EnteringContext = D.getContext() == Declarator::FileContext || D.getContext() == Declarator::MemberContext; - ParseOptionalCXXScopeSpecifier(D.getCXXScopeSpec(), ParsedType(), + ParseOptionalCXXScopeSpecifier(D.getCXXScopeSpec(), nullptr, EnteringContext); } @@ -5208,11 +5207,8 @@ void Parser::ParseDirectDeclarator(Decla bool HadScope = D.getCXXScopeSpec().isValid(); if (ParseUnqualifiedId(D.getCXXScopeSpec(), /*EnteringContext=*/true, - /*AllowDestructorName=*/true, - AllowConstructorName, - ParsedType(), - TemplateKWLoc, - D.getName()) || + /*AllowDestructorName=*/true, AllowConstructorName, + nullptr, TemplateKWLoc, D.getName()) || // Once we're past the identifier, if the scope was bad, mark the // whole declarator bad. D.getCXXScopeSpec().isInvalid()) { Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original) +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Jan 15 17:43:34 2016 @@ -267,7 +267,7 @@ Decl *Parser::ParseNamespaceAlias(Source CXXScopeSpec SS; // Parse (optional) nested-name-specifier. - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false); + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false); if (SS.isInvalid() || Tok.isNot(tok::identifier)) { Diag(Tok, diag::err_expected_namespace_name); @@ -442,7 +442,7 @@ Decl *Parser::ParseUsingDirective(unsign CXXScopeSpec SS; // Parse (optional) nested-name-specifier. - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false); + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false); IdentifierInfo *NamespcName = nullptr; SourceLocation IdentLoc = SourceLocation(); @@ -517,7 +517,7 @@ Decl *Parser::ParseUsingDeclaration(unsi // Parse nested-name-specifier. IdentifierInfo *LastII = nullptr; - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false, + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false, /*MayBePseudoDtor=*/nullptr, /*IsTypename=*/false, /*LastII=*/&LastII); @@ -554,7 +554,7 @@ Decl *Parser::ParseUsingDeclaration(unsi /*AllowDestructorName=*/true, /*AllowConstructorName=*/!(Tok.is(tok::identifier) && NextToken().is(tok::equal)), - ParsedType(), TemplateKWLoc, Name)) { + nullptr, TemplateKWLoc, Name)) { SkipUntil(tok::semi); return nullptr; } @@ -944,7 +944,7 @@ TypeResult Parser::ParseBaseTypeSpecifie // Parse optional nested-name-specifier CXXScopeSpec SS; - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false); + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false); BaseLoc = Tok.getLocation(); @@ -1037,11 +1037,10 @@ TypeResult Parser::ParseBaseTypeSpecifie // We have an identifier; check whether it is actually a type. IdentifierInfo *CorrectedII = nullptr; - ParsedType Type = Actions.getTypeName(*Id, IdLoc, getCurScope(), &SS, true, - false, ParsedType(), - /*IsCtorOrDtorName=*/false, - /*NonTrivialTypeSourceInfo=*/true, - &CorrectedII); + ParsedType Type = + Actions.getTypeName(*Id, IdLoc, getCurScope(), &SS, true, false, nullptr, + /*IsCtorOrDtorName=*/false, + /*NonTrivialTypeSourceInfo=*/true, &CorrectedII); if (!Type) { Diag(IdLoc, diag::err_expected_class_name); return true; @@ -1352,7 +1351,7 @@ void Parser::ParseClassSpecifier(tok::To CXXScopeSpec Spec; bool HasValidSpec = true; - if (ParseOptionalCXXScopeSpecifier(Spec, ParsedType(), EnteringContext)) { + if (ParseOptionalCXXScopeSpecifier(Spec, nullptr, EnteringContext)) { DS.SetTypeSpecError(); HasValidSpec = false; } @@ -2281,7 +2280,7 @@ Parser::ParseCXXClassMemberDeclaration(A if (isAccessDecl) { // Collect the scope specifier token we annotated earlier. CXXScopeSpec SS; - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false); if (SS.isInvalid()) { @@ -2292,8 +2291,8 @@ Parser::ParseCXXClassMemberDeclaration(A // Try to parse an unqualified-id. SourceLocation TemplateKWLoc; UnqualifiedId Name; - if (ParseUnqualifiedId(SS, false, true, true, ParsedType(), - TemplateKWLoc, Name)) { + if (ParseUnqualifiedId(SS, false, true, true, nullptr, TemplateKWLoc, + Name)) { SkipUntil(tok::semi); return nullptr; } @@ -3234,7 +3233,7 @@ void Parser::ParseConstructorInitializer MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) { // parse '::'[opt] nested-name-specifier[opt] CXXScopeSpec SS; - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false); + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false); ParsedType TemplateTypeTy; if (Tok.is(tok::annot_template_id)) { TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok); Modified: cfe/trunk/lib/Parse/ParseExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseExpr.cpp (original) +++ cfe/trunk/lib/Parse/ParseExpr.cpp Fri Jan 15 17:43:34 2016 @@ -895,7 +895,7 @@ ExprResult Parser::ParseCastExpression(b ((Tok.is(tok::identifier) && (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) || Tok.is(tok::code_completion))) { - Res = ParseObjCMessageExpressionBody(SourceLocation(), ILoc, ParsedType(), + Res = ParseObjCMessageExpressionBody(SourceLocation(), ILoc, nullptr, nullptr); break; } @@ -1204,7 +1204,7 @@ ExprResult Parser::ParseCastExpression(b // type, translate it into a type and continue parsing as a // cast expression. CXXScopeSpec SS; - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false); AnnotateTemplateIdTokenAsType(); return ParseCastExpression(isUnaryExpression, isAddressOfOperand, @@ -1395,7 +1395,7 @@ Parser::ParsePostfixExpressionSuffix(Exp if (getLangOpts().ObjC1 && !InMessageExpression && (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) { LHS = ParseObjCMessageExpressionBody(SourceLocation(), SourceLocation(), - ParsedType(), LHS.get()); + nullptr, LHS.get()); break; } @@ -1606,7 +1606,7 @@ Parser::ParsePostfixExpressionSuffix(Exp /*EnteringContext=*/false, &MayBePseudoDestructor); if (SS.isNotEmpty()) - ObjectType = ParsedType(); + ObjectType = nullptr; } if (Tok.is(tok::code_completion)) { @@ -2160,7 +2160,7 @@ Parser::ParseParenExpression(ParenParseO ExprResult Result(true); bool isAmbiguousTypeId; - CastTy = ParsedType(); + CastTy = nullptr; if (Tok.is(tok::code_completion)) { Actions.CodeCompleteOrdinaryName(getCurScope(), @@ -2506,7 +2506,7 @@ ExprResult Parser::ParseGenericSelection return ExprError(); } DefaultLoc = ConsumeToken(); - Ty = ParsedType(); + Ty = nullptr; } else { ColonProtectionRAIIObject X(*this); TypeResult TR = ParseTypeName(); Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original) +++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Fri Jan 15 17:43:34 2016 @@ -283,8 +283,8 @@ bool Parser::ParseOptionalCXXScopeSpecif // // To implement this, we clear out the object type as soon as we've // seen a leading '::' or part of a nested-name-specifier. - ObjectType = ParsedType(); - + ObjectType = nullptr; + if (Tok.is(tok::code_completion)) { // Code completion for a nested-name-specifier, where the code // code completion token follows the '::'. @@ -597,7 +597,7 @@ ExprResult Parser::tryParseCXXIdExpressi /*EnteringContext=*/false, /*AllowDestructorName=*/false, /*AllowConstructorName=*/false, - /*ObjectType=*/ParsedType(), TemplateKWLoc, Name)) + /*ObjectType=*/nullptr, TemplateKWLoc, Name)) return ExprError(); // This is only the direct operand of an & operator if it is not @@ -659,7 +659,7 @@ ExprResult Parser::ParseCXXIdExpression( // '::' unqualified-id // CXXScopeSpec SS; - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false); + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false); Token Replacement; ExprResult Result = @@ -2413,9 +2413,8 @@ bool Parser::ParseUnqualifiedId(CXXScope if (AllowConstructorName && Actions.isCurrentClassName(*Id, getCurScope(), &SS)) { // We have parsed a constructor name. - ParsedType Ty = Actions.getTypeName(*Id, IdLoc, getCurScope(), - &SS, false, false, - ParsedType(), + ParsedType Ty = Actions.getTypeName(*Id, IdLoc, getCurScope(), &SS, false, + false, nullptr, /*IsCtorOrDtorName=*/true, /*NonTrivialTypeSourceInfo=*/true); Result.setConstructorName(Ty, IdLoc, IdLoc); @@ -2451,13 +2450,11 @@ bool Parser::ParseUnqualifiedId(CXXScope << TemplateId->Name << FixItHint::CreateRemoval( SourceRange(TemplateId->LAngleLoc, TemplateId->RAngleLoc)); - ParsedType Ty = Actions.getTypeName(*TemplateId->Name, - TemplateId->TemplateNameLoc, - getCurScope(), - &SS, false, false, - ParsedType(), - /*IsCtorOrDtorName=*/true, - /*NontrivialTypeSourceInfo=*/true); + ParsedType Ty = + Actions.getTypeName(*TemplateId->Name, TemplateId->TemplateNameLoc, + getCurScope(), &SS, false, false, nullptr, + /*IsCtorOrDtorName=*/true, + /*NontrivialTypeSourceInfo=*/true); Result.setConstructorName(Ty, TemplateId->TemplateNameLoc, TemplateId->RAngleLoc); ConsumeToken(); @@ -2541,7 +2538,7 @@ bool Parser::ParseUnqualifiedId(CXXScope if (ParseOptionalCXXScopeSpecifier(SS, ObjectType, EnteringContext)) return true; if (SS.isNotEmpty()) - ObjectType = ParsedType(); + ObjectType = nullptr; if (Tok.isNot(tok::identifier) || NextToken().is(tok::coloncolon) || !SS.isSet()) { Diag(TildeLoc, diag::err_destructor_tilde_scope); @@ -2563,7 +2560,7 @@ bool Parser::ParseUnqualifiedId(CXXScope SourceLocation ClassNameLoc = ConsumeToken(); if (TemplateSpecified || Tok.is(tok::less)) { - Result.setDestructorName(TildeLoc, ParsedType(), ClassNameLoc); + Result.setDestructorName(TildeLoc, nullptr, ClassNameLoc); return ParseUnqualifiedIdTemplateId(SS, TemplateKWLoc, ClassName, ClassNameLoc, EnteringContext, ObjectType, @@ -3029,7 +3026,7 @@ Parser::ParseCXXAmbiguousParenExpression assert(isTypeIdInParens() && "Not a type-id!"); ExprResult Result(true); - CastTy = ParsedType(); + CastTy = nullptr; // We need to disambiguate a very ugly part of the C++ syntax: // Modified: cfe/trunk/lib/Parse/ParseInit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseInit.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseInit.cpp (original) +++ cfe/trunk/lib/Parse/ParseInit.cpp Fri Jan 15 17:43:34 2016 @@ -216,10 +216,8 @@ ExprResult Parser::ParseInitializerWithP NextToken().isNot(tok::period) && getCurScope()->isInObjcMethodScope()) { CheckArrayDesignatorSyntax(*this, StartLoc, Desig); - return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, - ConsumeToken(), - ParsedType(), - nullptr); + return ParseAssignmentExprWithObjCMessageExprStart( + StartLoc, ConsumeToken(), nullptr, nullptr); } // Parse the receiver, which is either a type or an expression. @@ -257,10 +255,8 @@ ExprResult Parser::ParseInitializerWithP NextToken().is(tok::period), ReceiverType)) { case Sema::ObjCSuperMessage: CheckArrayDesignatorSyntax(*this, StartLoc, Desig); - return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, - ConsumeToken(), - ParsedType(), - nullptr); + return ParseAssignmentExprWithObjCMessageExprStart( + StartLoc, ConsumeToken(), nullptr, nullptr); case Sema::ObjCClassMessage: CheckArrayDesignatorSyntax(*this, StartLoc, Desig); @@ -320,10 +316,8 @@ ExprResult Parser::ParseInitializerWithP if (getLangOpts().ObjC1 && Tok.isNot(tok::ellipsis) && Tok.isNot(tok::r_square)) { CheckArrayDesignatorSyntax(*this, Tok.getLocation(), Desig); - return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, - SourceLocation(), - ParsedType(), - Idx.get()); + return ParseAssignmentExprWithObjCMessageExprStart( + StartLoc, SourceLocation(), nullptr, Idx.get()); } // If this is a normal array designator, remember it. Modified: cfe/trunk/lib/Parse/ParseObjc.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseObjc.cpp (original) +++ cfe/trunk/lib/Parse/ParseObjc.cpp Fri Jan 15 17:43:34 2016 @@ -334,16 +334,11 @@ Decl *Parser::ParseObjCAtInterfaceDeclar // Type arguments for the superclass or protocol conformances. if (Tok.is(tok::less)) { - parseObjCTypeArgsOrProtocolQualifiers(ParsedType(), - typeArgsLAngleLoc, - typeArgs, - typeArgsRAngleLoc, - LAngleLoc, - protocols, - protocolLocs, - EndProtoLoc, - /*consumeLastToken=*/true, - /*warnOnIncompleteProtocols=*/true); + parseObjCTypeArgsOrProtocolQualifiers( + nullptr, typeArgsLAngleLoc, typeArgs, typeArgsRAngleLoc, LAngleLoc, + protocols, protocolLocs, EndProtoLoc, + /*consumeLastToken=*/true, + /*warnOnIncompleteProtocols=*/true); } } @@ -459,14 +454,8 @@ ObjCTypeParamList *Parser::parseObjCType unsigned index = 0; for (const auto &pair : protocolIdents) { DeclResult typeParam = Actions.actOnObjCTypeParam( - getCurScope(), - ObjCTypeParamVariance::Invariant, - SourceLocation(), - index++, - pair.first, - pair.second, - SourceLocation(), - ParsedType()); + getCurScope(), ObjCTypeParamVariance::Invariant, SourceLocation(), + index++, pair.first, pair.second, SourceLocation(), nullptr); if (typeParam.isUsable()) typeParams.push_back(typeParam.get()); } @@ -542,16 +531,9 @@ ObjCTypeParamList *Parser::parseObjCType } // Create the type parameter. - DeclResult typeParam = Actions.actOnObjCTypeParam(getCurScope(), - variance, - varianceLoc, - typeParams.size(), - paramName, - paramLoc, - colonLoc, - boundType.isUsable() - ? boundType.get() - : ParsedType()); + DeclResult typeParam = Actions.actOnObjCTypeParam( + getCurScope(), variance, varianceLoc, typeParams.size(), paramName, + paramLoc, colonLoc, boundType.isUsable() ? boundType.get() : nullptr); if (typeParam.isUsable()) typeParams.push_back(typeParam.get()); } while (TryConsumeToken(tok::comma)); @@ -1361,8 +1343,8 @@ Decl *Parser::ParseObjCMethodDecl(Source ParsingDeclRAIIObject PD(*this, ParsingDeclRAIIObject::NoParent); if (Tok.is(tok::code_completion)) { - Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus, - /*ReturnType=*/ ParsedType()); + Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus, + /*ReturnType=*/nullptr); cutOffParsing(); return nullptr; } @@ -1432,7 +1414,7 @@ Decl *Parser::ParseObjCMethodDecl(Source if (ExpectAndConsume(tok::colon)) break; - ArgInfo.Type = ParsedType(); + ArgInfo.Type = nullptr; if (Tok.is(tok::l_paren)) // Parse the argument type if present. ArgInfo.Type = ParseObjCTypeName(ArgInfo.DeclSpec, Declarator::ObjCParameterContext, @@ -2977,8 +2959,8 @@ ExprResult Parser::ParseObjCMessageExpre // get in Objective-C. if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super && NextToken().isNot(tok::period) && getCurScope()->isInObjcMethodScope()) - return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), - ParsedType(), nullptr); + return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), nullptr, + nullptr); // Parse the receiver, which is either a type or an expression. bool IsExpr; @@ -2989,9 +2971,8 @@ ExprResult Parser::ParseObjCMessageExpre } if (IsExpr) - return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), - ParsedType(), - static_cast<Expr*>(TypeOrExpr)); + return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), nullptr, + static_cast<Expr *>(TypeOrExpr)); return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), ParsedType::getFromOpaquePtr(TypeOrExpr), @@ -3007,8 +2988,8 @@ ExprResult Parser::ParseObjCMessageExpre NextToken().is(tok::period), ReceiverType)) { case Sema::ObjCSuperMessage: - return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), - ParsedType(), nullptr); + return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), nullptr, + nullptr); case Sema::ObjCClassMessage: if (!ReceiverType) { @@ -3049,8 +3030,8 @@ ExprResult Parser::ParseObjCMessageExpre return Res; } - return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), - ParsedType(), Res.get()); + return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), nullptr, + Res.get()); } /// \brief Parse the remainder of an Objective-C message following the Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original) +++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Fri Jan 15 17:43:34 2016 @@ -367,11 +367,11 @@ bool Parser::ParseOpenMPSimpleVarList(Op NoIdentIsFound = false; if (AllowScopeSpecifier && getLangOpts().CPlusPlus && - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), false)) { + ParseOptionalCXXScopeSpecifier(SS, nullptr, false)) { IsCorrect = false; SkipUntil(tok::comma, tok::r_paren, tok::annot_pragma_openmp_end, StopBeforeMatch); - } else if (ParseUnqualifiedId(SS, false, false, false, ParsedType(), + } else if (ParseUnqualifiedId(SS, false, false, false, nullptr, TemplateKWLoc, Name)) { IsCorrect = false; SkipUntil(tok::comma, tok::r_paren, tok::annot_pragma_openmp_end, @@ -831,7 +831,7 @@ static bool ParseReductionId(Parser &P, } return P.ParseUnqualifiedId(ReductionIdScopeSpec, /*EnteringContext*/ false, /*AllowDestructorName*/ false, - /*AllowConstructorName*/ false, ParsedType(), + /*AllowConstructorName*/ false, nullptr, TemplateKWLoc, ReductionId); } @@ -898,7 +898,7 @@ OMPClause *Parser::ParseOpenMPVarListCla if (Kind == OMPC_reduction) { ColonProtectionRAIIObject ColonRAII(*this); if (getLangOpts().CPlusPlus) { - ParseOptionalCXXScopeSpecifier(ReductionIdScopeSpec, ParsedType(), false); + ParseOptionalCXXScopeSpecifier(ReductionIdScopeSpec, nullptr, false); } InvalidReductionId = ParseReductionId(*this, ReductionIdScopeSpec, ReductionId); Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original) +++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Fri Jan 15 17:43:34 2016 @@ -209,7 +209,7 @@ ExprResult Parser::ParseMSAsmIdentifier( // Parse an optional scope-specifier if we're in C++. CXXScopeSpec SS; if (getLangOpts().CPlusPlus) { - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false); + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false); } // Require an identifier here. @@ -221,12 +221,11 @@ ExprResult Parser::ParseMSAsmIdentifier( Result = ParseCXXThis(); Invalid = false; } else { - Invalid = - ParseUnqualifiedId(SS, - /*EnteringContext=*/false, - /*AllowDestructorName=*/false, - /*AllowConstructorName=*/false, - /*ObjectType=*/ParsedType(), TemplateKWLoc, Id); + Invalid = ParseUnqualifiedId(SS, + /*EnteringContext=*/false, + /*AllowDestructorName=*/false, + /*AllowConstructorName=*/false, + /*ObjectType=*/nullptr, TemplateKWLoc, Id); // Perform the lookup. Result = Actions.LookupInlineAsmIdentifier(SS, TemplateKWLoc, Id, Info, IsUnevaluatedContext); Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseTemplate.cpp (original) +++ cfe/trunk/lib/Parse/ParseTemplate.cpp Fri Jan 15 17:43:34 2016 @@ -1061,7 +1061,7 @@ void Parser::AnnotateTemplateIdTokenAsTy TemplateId->RAngleLoc); // Create the new "type" annotation token. Tok.setKind(tok::annot_typename); - setTypeAnnotation(Tok, Type.isInvalid() ? ParsedType() : Type.get()); + setTypeAnnotation(Tok, Type.isInvalid() ? nullptr : Type.get()); if (TemplateId->SS.isNotEmpty()) // it was a C++ qualified type name. Tok.setLocation(TemplateId->SS.getBeginLoc()); // End location stays the same @@ -1094,9 +1094,9 @@ ParsedTemplateArgument Parser::ParseTemp // followed by a token that terminates a template argument, such as ',', // '>', or (in some cases) '>>'. CXXScopeSpec SS; // nested-name-specifier, if present - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), + ParseOptionalCXXScopeSpecifier(SS, nullptr, /*EnteringContext=*/false); - + ParsedTemplateArgument Result; SourceLocation EllipsisLoc; if (SS.isSet() && Tok.is(tok::kw_template)) { @@ -1117,11 +1117,10 @@ ParsedTemplateArgument Parser::ParseTemp // template argument. TemplateTy Template; if (isEndOfTemplateArgument(Tok) && - Actions.ActOnDependentTemplateName(getCurScope(), - SS, TemplateKWLoc, Name, - /*ObjectType=*/ ParsedType(), - /*EnteringContext=*/false, - Template)) + Actions.ActOnDependentTemplateName( + getCurScope(), SS, TemplateKWLoc, Name, + /*ObjectType=*/nullptr, + /*EnteringContext=*/false, Template)) Result = ParsedTemplateArgument(SS, Template, Name.StartLocation); } } else if (Tok.is(tok::identifier)) { @@ -1135,13 +1134,11 @@ ParsedTemplateArgument Parser::ParseTemp if (isEndOfTemplateArgument(Tok)) { bool MemberOfUnknownSpecialization; - TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS, - /*hasTemplateKeyword=*/false, - Name, - /*ObjectType=*/ ParsedType(), - /*EnteringContext=*/false, - Template, - MemberOfUnknownSpecialization); + TemplateNameKind TNK = Actions.isTemplateName( + getCurScope(), SS, + /*hasTemplateKeyword=*/false, Name, + /*ObjectType=*/nullptr, + /*EnteringContext=*/false, Template, MemberOfUnknownSpecialization); if (TNK == TNK_Dependent_template_name || TNK == TNK_Type_template) { // We have an id-expression that refers to a class template or // (C++0x) alias template. Modified: cfe/trunk/lib/Parse/Parser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Parse/Parser.cpp (original) +++ cfe/trunk/lib/Parse/Parser.cpp Fri Jan 15 17:43:34 2016 @@ -1400,7 +1400,7 @@ Parser::TryAnnotateName(bool IsAddressOf CXXScopeSpec SS; if (getLangOpts().CPlusPlus && - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), EnteringContext)) + ParseOptionalCXXScopeSpecifier(SS, nullptr, EnteringContext)) return ANK_Error; if (Tok.isNot(tok::identifier) || SS.isInvalid()) { @@ -1588,9 +1588,9 @@ bool Parser::TryAnnotateTypeOrScopeToken // simple-template-id SourceLocation TypenameLoc = ConsumeToken(); CXXScopeSpec SS; - if (ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/ParsedType(), - /*EnteringContext=*/false, - nullptr, /*IsTypename*/ true)) + if (ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/nullptr, + /*EnteringContext=*/false, nullptr, + /*IsTypename*/ true)) return true; if (!SS.isSet()) { if (Tok.is(tok::identifier) || Tok.is(tok::annot_template_id) || @@ -1646,7 +1646,7 @@ bool Parser::TryAnnotateTypeOrScopeToken SourceLocation EndLoc = Tok.getLastLoc(); Tok.setKind(tok::annot_typename); - setTypeAnnotation(Tok, Ty.isInvalid() ? ParsedType() : Ty.get()); + setTypeAnnotation(Tok, Ty.isInvalid() ? nullptr : Ty.get()); Tok.setAnnotationEndLoc(EndLoc); Tok.setLocation(TypenameLoc); PP.AnnotateCachedTokens(Tok); @@ -1658,7 +1658,7 @@ bool Parser::TryAnnotateTypeOrScopeToken CXXScopeSpec SS; if (getLangOpts().CPlusPlus) - if (ParseOptionalCXXScopeSpecifier(SS, ParsedType(), EnteringContext)) + if (ParseOptionalCXXScopeSpecifier(SS, nullptr, EnteringContext)) return true; return TryAnnotateTypeOrScopeTokenAfterScopeSpec(EnteringContext, NeedType, @@ -1675,15 +1675,12 @@ bool Parser::TryAnnotateTypeOrScopeToken if (Tok.is(tok::identifier)) { IdentifierInfo *CorrectedII = nullptr; // Determine whether the identifier is a type name. - if (ParsedType Ty = Actions.getTypeName(*Tok.getIdentifierInfo(), - Tok.getLocation(), getCurScope(), - &SS, false, - NextToken().is(tok::period), - ParsedType(), - /*IsCtorOrDtorName=*/false, - /*NonTrivialTypeSourceInfo*/ true, - NeedType ? &CorrectedII - : nullptr)) { + if (ParsedType Ty = Actions.getTypeName( + *Tok.getIdentifierInfo(), Tok.getLocation(), getCurScope(), &SS, + false, NextToken().is(tok::period), nullptr, + /*IsCtorOrDtorName=*/false, + /*NonTrivialTypeSourceInfo*/ true, + NeedType ? &CorrectedII : nullptr)) { // A FixIt was applied as a result of typo correction if (CorrectedII) Tok.setIdentifierInfo(CorrectedII); @@ -1734,12 +1731,11 @@ bool Parser::TryAnnotateTypeOrScopeToken UnqualifiedId TemplateName; TemplateName.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation()); bool MemberOfUnknownSpecialization; - if (TemplateNameKind TNK - = Actions.isTemplateName(getCurScope(), SS, - /*hasTemplateKeyword=*/false, TemplateName, - /*ObjectType=*/ ParsedType(), - EnteringContext, - Template, MemberOfUnknownSpecialization)) { + if (TemplateNameKind TNK = + Actions.isTemplateName(getCurScope(), SS, + /*hasTemplateKeyword=*/false, TemplateName, + /*ObjectType=*/nullptr, EnteringContext, + Template, MemberOfUnknownSpecialization)) { // Consume the identifier. ConsumeToken(); if (AnnotateTemplateIdToken(Template, TNK, SS, SourceLocation(), @@ -1793,7 +1789,7 @@ bool Parser::TryAnnotateCXXScopeToken(bo "Cannot be a type or scope token!"); CXXScopeSpec SS; - if (ParseOptionalCXXScopeSpecifier(SS, ParsedType(), EnteringContext)) + if (ParseOptionalCXXScopeSpecifier(SS, nullptr, EnteringContext)) return true; if (SS.isEmpty()) return false; @@ -1897,7 +1893,7 @@ bool Parser::ParseMicrosoftIfExistsCondi // Parse nested-name-specifier. if (getLangOpts().CPlusPlus) - ParseOptionalCXXScopeSpecifier(Result.SS, ParsedType(), + ParseOptionalCXXScopeSpecifier(Result.SS, nullptr, /*EnteringContext=*/false); // Check nested-name specifier. @@ -1908,8 +1904,8 @@ bool Parser::ParseMicrosoftIfExistsCondi // Parse the unqualified-id. SourceLocation TemplateKWLoc; // FIXME: parsed, but unused. - if (ParseUnqualifiedId(Result.SS, false, true, true, ParsedType(), - TemplateKWLoc, Result.Name)) { + if (ParseUnqualifiedId(Result.SS, false, true, true, nullptr, TemplateKWLoc, + Result.Name)) { T.skipToEnd(); return true; } Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Jan 15 17:43:34 2016 @@ -207,7 +207,7 @@ static ParsedType recoverFromTypeInKnown FoundTypeDecl = lookupUnqualifiedTypeNameInBase(S, II, NameLoc, RD); } if (FoundTypeDecl != UnqualifiedTypeNameLookupResult::FoundType) - return ParsedType(); + return nullptr; // We found some types in dependent base classes. Recover as if the user // wrote 'typename MyClass::II' instead of 'II'. We'll fully resolve the @@ -266,8 +266,8 @@ ParsedType Sema::getTypeName(const Ident // We therefore do not perform any name lookup if the result would // refer to a member of an unknown specialization. if (!isClassName && !IsCtorOrDtorName) - return ParsedType(); - + return nullptr; + // We know from the grammar that this name refers to a type, // so build a dependent node to describe the type. if (WantNontrivialTypeSourceInfo) @@ -278,13 +278,13 @@ ParsedType Sema::getTypeName(const Ident II, NameLoc); return ParsedType::make(T); } - - return ParsedType(); + + return nullptr; } if (!LookupCtx->isDependentContext() && RequireCompleteDeclContext(*SS, LookupCtx)) - return ParsedType(); + return nullptr; } // FIXME: LookupNestedNameSpecifierName isn't the right kind of @@ -346,8 +346,8 @@ ParsedType Sema::getTypeName(const Ident // identifier is not a template (typo correction for template names // is handled elsewhere). !(getLangOpts().CPlusPlus && NewSSPtr && - isTemplateName(S, *NewSSPtr, false, TemplateName, ParsedType(), - false, Template, MemberOfUnknownSpecialization))) { + isTemplateName(S, *NewSSPtr, false, TemplateName, nullptr, false, + Template, MemberOfUnknownSpecialization))) { ParsedType Ty = getTypeName(*NewII, NameLoc, S, NewSSPtr, isClassName, HasTrailingDot, ObjectTypePtr, IsCtorOrDtorName, @@ -367,7 +367,7 @@ ParsedType Sema::getTypeName(const Ident case LookupResult::FoundOverloaded: case LookupResult::FoundUnresolvedValue: Result.suppressDiagnostics(); - return ParsedType(); + return nullptr; case LookupResult::Ambiguous: // Recover from type-hiding ambiguities by hiding the type. We'll @@ -377,7 +377,7 @@ ParsedType Sema::getTypeName(const Ident // that only makes sense if the identifier was treated like a type. if (Result.getAmbiguityKind() == LookupResult::AmbiguousTagHiding) { Result.suppressDiagnostics(); - return ParsedType(); + return nullptr; } // Look to see if we have a type anywhere in the list of results. @@ -399,7 +399,7 @@ ParsedType Sema::getTypeName(const Ident // will produce the ambiguity, or will complain that it expected // a type name. Result.suppressDiagnostics(); - return ParsedType(); + return nullptr; } // We found a type within the ambiguous lookup; diagnose the @@ -449,7 +449,7 @@ ParsedType Sema::getTypeName(const Ident if (T.isNull()) { // If it's not plausibly a type, suppress diagnostics. Result.suppressDiagnostics(); - return ParsedType(); + return nullptr; } return ParsedType::make(T); } @@ -559,8 +559,8 @@ void Sema::DiagnoseUnknownTypeName(Ident ParsedType &SuggestedType, bool AllowClassTemplates) { // We don't have anything to suggest (yet). - SuggestedType = ParsedType(); - + SuggestedType = nullptr; + // There may have been a typo in the name of the type. Look up typo // results, in case we have something that we can suggest. if (TypoCorrection Corrected = @@ -592,11 +592,11 @@ void Sema::DiagnoseUnknownTypeName(Ident if (Corrected.getCorrectionSpecifier()) tmpSS.MakeTrivial(Context, Corrected.getCorrectionSpecifier(), SourceRange(IILoc)); - SuggestedType = getTypeName(*Corrected.getCorrectionAsIdentifierInfo(), - IILoc, S, tmpSS.isSet() ? &tmpSS : SS, false, - false, ParsedType(), - /*IsCtorOrDtorName=*/false, - /*NonTrivialTypeSourceInfo=*/true); + SuggestedType = + getTypeName(*Corrected.getCorrectionAsIdentifierInfo(), IILoc, S, + tmpSS.isSet() ? &tmpSS : SS, false, false, nullptr, + /*IsCtorOrDtorName=*/false, + /*NonTrivialTypeSourceInfo=*/true); } return; } @@ -609,7 +609,7 @@ void Sema::DiagnoseUnknownTypeName(Ident TemplateTy TemplateResult; bool MemberOfUnknownSpecialization; if (isTemplateName(S, SS ? *SS : EmptySS, /*hasTemplateKeyword=*/false, - Name, ParsedType(), true, TemplateResult, + Name, nullptr, true, TemplateResult, MemberOfUnknownSpecialization) == TNK_Type_template) { TemplateName TplName = TemplateResult.get(); Diag(IILoc, diag::err_template_missing_args) << TplName; Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Jan 15 17:43:34 2016 @@ -113,7 +113,7 @@ ParsedType Sema::getDestructorName(Sourc bool LookInScope = false; if (SS.isInvalid()) - return ParsedType(); + return nullptr; // If we have an object type, it's because we are in a // pseudo-destructor-expression or a member access expression, and @@ -198,7 +198,7 @@ ParsedType Sema::getDestructorName(Sourc // FIXME: Should we be suppressing ambiguities here? if (Found.isAmbiguous()) - return ParsedType(); + return nullptr; if (TypeDecl *Type = Found.getAsSingle<TypeDecl>()) { QualType T = Context.getTypeDeclType(Type); @@ -320,12 +320,12 @@ ParsedType Sema::getDestructorName(Sourc } } - return ParsedType(); + return nullptr; } ParsedType Sema::getDestructorType(const DeclSpec& DS, ParsedType ObjectType) { if (DS.getTypeSpecType() == DeclSpec::TST_error || !ObjectType) - return ParsedType(); + return nullptr; assert(DS.getTypeSpecType() == DeclSpec::TST_decltype && "only get destructor types from declspecs"); QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc()); @@ -336,7 +336,7 @@ ParsedType Sema::getDestructorType(const Diag(DS.getTypeSpecTypeLoc(), diag::err_destructor_expr_type_mismatch) << T << SearchType; - return ParsedType(); + return nullptr; } bool Sema::checkLiteralOperatorId(const CXXScopeSpec &SS, @@ -5765,7 +5765,7 @@ ExprResult Sema::ActOnStartCXXMemberRefe MayBePseudoDestructor = true; return Base; } else if (!BaseType->isRecordType()) { - ObjectType = ParsedType(); + ObjectType = nullptr; MayBePseudoDestructor = true; return Base; } Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Jan 15 17:43:34 2016 @@ -2040,7 +2040,7 @@ Sema::ObjCMessageKind Sema::getObjCMessa bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType) { - ReceiverType = ParsedType(); + ReceiverType = nullptr; // If the identifier is "super" and there is no trailing dot, we're // messaging super. If the identifier is "super" and there is a Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=257958&r1=257957&r2=257958&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaTemplate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Jan 15 17:43:34 2016 @@ -583,7 +583,7 @@ Decl *Sema::ActOnTypeParameter(Scope *S, // template-parameter that is not a template parameter pack. if (DefaultArg && IsParameterPack) { Diag(EqualLoc, diag::err_template_param_pack_default_arg); - DefaultArg = ParsedType(); + DefaultArg = nullptr; } // Handle the default argument, if provided. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits