diff options
author | John McCall <rjmccall@apple.com> | 2010-08-26 23:41:50 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-26 23:41:50 +0000 |
commit | f312b1ea179f1c44371f9ee0cd0bc006f612de11 (patch) | |
tree | 41c3e6944395d783ebe193409578392f9e37d4d1 /lib/Sema | |
parent | 468e8fbda71a02eba31b4d8282fc1d509b552fbe (diff) |
One who seeks knowledge learns something new every day.
One who seeks the Tao unlearns something new every day.
Less and less remains until you arrive at non-action.
When you arrive at non-action,
nothing will be left undone.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/Action.cpp | 38 | ||||
-rw-r--r-- | lib/Sema/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/Sema/Sema.cpp | 19 | ||||
-rw-r--r-- | lib/Sema/SemaAttr.cpp | 10 | ||||
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 7 | ||||
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 124 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 10 | ||||
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 29 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 36 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 60 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 23 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 32 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 26 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/TreeTransform.h | 425 |
18 files changed, 408 insertions, 451 deletions
diff --git a/lib/Sema/Action.cpp b/lib/Sema/Action.cpp deleted file mode 100644 index 1df0e01a74..0000000000 --- a/lib/Sema/Action.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===--- Action.cpp - Implement the Action class --------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the Action interface. -// -//===----------------------------------------------------------------------===// - -#include "clang/Sema/Action.h" -#include "clang/Sema/DeclSpec.h" -#include "clang/Sema/Scope.h" -#include "clang/Basic/TargetInfo.h" -#include "llvm/Support/Allocator.h" -#include "llvm/Support/RecyclingAllocator.h" -#include "llvm/Support/raw_ostream.h" -using namespace clang; - -void PrettyStackTraceActionsDecl::print(llvm::raw_ostream &OS) const { - if (Loc.isValid()) { - Loc.print(OS, SM); - OS << ": "; - } - OS << Message; - - std::string Name = Actions.getDeclName(TheDecl); - if (!Name.empty()) - OS << " '" << Name << '\''; - - OS << '\n'; -} - -/// Out-of-line virtual destructor to provide home for Action class. -Action::~Action() {} diff --git a/lib/Sema/CMakeLists.txt b/lib/Sema/CMakeLists.txt index 2144bfefb1..e65bb227f1 100644 --- a/lib/Sema/CMakeLists.txt +++ b/lib/Sema/CMakeLists.txt @@ -1,7 +1,6 @@ set(LLVM_NO_RTTI 1) add_clang_library(clangSema - Action.cpp AnalysisBasedWarnings.cpp AttributeList.cpp CodeCompleteConsumer.cpp diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 2de4d28cab..60e308a982 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -20,6 +20,7 @@ #include "llvm/ADT/APFloat.h" #include "clang/Sema/CXXFieldCollector.h" #include "clang/Sema/ExternalSemaSource.h" +#include "clang/Sema/PrettyDeclStackTrace.h" #include "clang/Sema/Scope.h" #include "clang/Sema/ScopeInfo.h" #include "clang/Sema/SemaConsumer.h" @@ -555,3 +556,21 @@ BlockScopeInfo *Sema::getCurBlock() { // Pin this vtable to this file. ExternalSemaSource::~ExternalSemaSource() {} + +void PrettyDeclStackTraceEntry::print(llvm::raw_ostream &OS) const { + SourceLocation Loc = this->Loc; + if (!Loc.isValid() && TheDecl) Loc = TheDecl->getLocation(); + if (Loc.isValid()) { + Loc.print(OS, S.getSourceManager()); + OS << ": "; + } + OS << Message; + + if (TheDecl && isa<NamedDecl>(TheDecl)) { + std::string Name = cast<NamedDecl>(TheDecl)->getNameAsString(); + if (!Name.empty()) + OS << " '" << Name << '\''; + } + + OS << '\n'; +} diff --git a/lib/Sema/SemaAttr.cpp b/lib/Sema/SemaAttr.cpp index 917bf2bc3b..0921156b93 100644 --- a/lib/Sema/SemaAttr.cpp +++ b/lib/Sema/SemaAttr.cpp @@ -139,7 +139,7 @@ void Sema::ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, // Reset just pops the top of the stack, or resets the current alignment to // default. - if (Kind == Action::POAK_Reset) { + if (Kind == Sema::POAK_Reset) { if (!Context->pop(0, /*IsReset=*/true)) { Diag(PragmaLoc, diag::warn_pragma_options_align_reset_failed) << "stack empty"; @@ -212,11 +212,11 @@ void Sema::ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name, PragmaPackStack *Context = static_cast<PragmaPackStack*>(PackContext); switch (Kind) { - case Action::PPK_Default: // pack([n]) + case Sema::PPK_Default: // pack([n]) Context->setAlignment(AlignmentVal); break; - case Action::PPK_Show: // pack(show) + case Sema::PPK_Show: // pack(show) // Show the current alignment, making sure to show the right value // for the default. AlignmentVal = Context->getAlignment(); @@ -229,14 +229,14 @@ void Sema::ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name, Diag(PragmaLoc, diag::warn_pragma_pack_show) << AlignmentVal; break; - case Action::PPK_Push: // pack(push [, id] [, [n]) + case Sema::PPK_Push: // pack(push [, id] [, [n]) Context->push(Name); // Set the new alignment if specified. if (Alignment) Context->setAlignment(AlignmentVal); break; - case Action::PPK_Pop: // pack(pop [, id] [, n]) + case Sema::PPK_Pop: // pack(pop [, id] [, n]) // MSDN, C/C++ Preprocessor Reference > Pragma Directives > pack: // "#pragma pack(pop, identifier, n) is undefined" if (Alignment && Name) diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index c58c92cfce..21b1a73aa3 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -120,7 +120,7 @@ ExprResult Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, ParsedType Ty, SourceLocation RAngleBracketLoc, - SourceLocation LParenLoc, ExprArg E, + SourceLocation LParenLoc, Expr *E, SourceLocation RParenLoc) { TypeSourceInfo *DestTInfo; @@ -135,7 +135,7 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, ExprResult Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, - TypeSourceInfo *DestTInfo, ExprArg Ex, + TypeSourceInfo *DestTInfo, Expr *Ex, SourceRange AngleBrackets, SourceRange Parens) { QualType DestType = DestTInfo->getType(); @@ -965,8 +965,7 @@ TryStaticImplicitCast(Sema &Self, Expr *&SrcExpr, QualType DestType, return TC_NotApplicable; ExprResult Result - = InitSeq.Perform(Self, Entity, InitKind, - Action::MultiExprArg(Self, &SrcExpr, 1)); + = InitSeq.Perform(Self, Entity, InitKind, MultiExprArg(Self, &SrcExpr, 1)); if (Result.isInvalid()) { msg = 0; return TC_Failed; diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 4c06fac012..aade62710c 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -1113,7 +1113,7 @@ static void AddTypeSpecifierResults(const LangOptions &LangOpts, } } -static void AddStorageSpecifiers(Action::ParserCompletionContext CCC, +static void AddStorageSpecifiers(Sema::ParserCompletionContext CCC, const LangOptions &LangOpts, ResultBuilder &Results) { typedef CodeCompletionResult Result; @@ -1124,13 +1124,13 @@ static void AddStorageSpecifiers(Action::ParserCompletionContext CCC, Results.AddResult(Result("static")); } -static void AddFunctionSpecifiers(Action::ParserCompletionContext CCC, +static void AddFunctionSpecifiers(Sema::ParserCompletionContext CCC, const LangOptions &LangOpts, ResultBuilder &Results) { typedef CodeCompletionResult Result; switch (CCC) { - case Action::PCC_Class: - case Action::PCC_MemberTemplate: + case Sema::PCC_Class: + case Sema::PCC_MemberTemplate: if (LangOpts.CPlusPlus) { Results.AddResult(Result("explicit")); Results.AddResult(Result("friend")); @@ -1139,21 +1139,21 @@ static void AddFunctionSpecifiers(Action::ParserCompletionContext CCC, } // Fall through - case Action::PCC_ObjCInterface: - case Action::PCC_ObjCImplementation: - case Action::PCC_Namespace: - case Action::PCC_Template: + case Sema::PCC_ObjCInterface: + case Sema::PCC_ObjCImplementation: + case Sema::PCC_Namespace: + case Sema::PCC_Template: if (LangOpts.CPlusPlus || LangOpts.C99) Results.AddResult(Result("inline")); break; - case Action::PCC_ObjCInstanceVariableList: - case Action::PCC_Expression: - case Action::PCC_Statement: - case Action::PCC_ForInit: - case Action::PCC_Condition: - case Action::PCC_RecoveryInFunction: - case Action::PCC_Type: + case Sema::PCC_ObjCInstanceVariableList: + case Sema::PCC_Expression: + case Sema::PCC_Statement: + case Sema::PCC_ForInit: + case Sema::PCC_Condition: + case Sema::PCC_RecoveryInFunction: + case Sema::PCC_Type: break; } } @@ -1181,29 +1181,29 @@ static void AddTypedefResult(ResultBuilder &Results) { Results.AddResult(CodeCompletionResult(Pattern)); } -static bool WantTypesInContext(Action::ParserCompletionContext CCC, +static bool WantTypesInContext(Sema::ParserCompletionContext CCC, const LangOptions &LangOpts) { if (LangOpts.CPlusPlus) return true; switch (CCC) { - case Action::PCC_Namespace: - case Action::PCC_Class: - case Action::PCC_ObjCInstanceVariableList: - case Action::PCC_Template: - case Action::PCC_MemberTemplate: - case Action::PCC_Statement: - case Action::PCC_RecoveryInFunction: - case Action::PCC_Type: + case Sema::PCC_Namespace: + case Sema::PCC_Class: + case Sema::PCC_ObjCInstanceVariableList: + case Sema::PCC_Template: + case Sema::PCC_MemberTemplate: + case Sema::PCC_Statement: + case Sema::PCC_RecoveryInFunction: + case Sema::PCC_Type: return true; - case Action::PCC_ObjCInterface: - case Action::PCC_ObjCImplementation: - case Action::PCC_Expression: - case Action::PCC_Condition: + case Sema::PCC_ObjCInterface: + case Sema::PCC_ObjCImplementation: + case Sema::PCC_Expression: + case Sema::PCC_Condition: return false; - case Action::PCC_ForInit: + case Sema::PCC_ForInit: return LangOpts.ObjC1 || LangOpts.C99; } @@ -1211,13 +1211,13 @@ static bool WantTypesInContext(Action::ParserCompletionContext CCC, } /// \brief Add language constructs that show up for "ordinary" names. -static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC, +static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Scope *S, Sema &SemaRef, ResultBuilder &Results) { typedef CodeCompletionResult Result; switch (CCC) { - case Action::PCC_Namespace: + case Sema::PCC_Namespace: if (SemaRef.getLangOptions().CPlusPlus) { CodeCompletionString *Pattern = 0; @@ -1276,7 +1276,7 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC, AddTypedefResult(Results); // Fall through - case Action::PCC_Class: + case Sema::PCC_Class: if (SemaRef.getLangOptions().CPlusPlus) { // Using declaration CodeCompletionString *Pattern = new CodeCompletionString; @@ -1300,7 +1300,7 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC, Results.AddResult(Result(Pattern)); } - if (CCC == Action::PCC_Class) { + if (CCC == Sema::PCC_Class) { AddTypedefResult(Results); // public: @@ -1324,8 +1324,8 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC, } // Fall through - case Action::PCC_Template: - case Action::PCC_MemberTemplate: + case Sema::PCC_Template: + case Sema::PCC_MemberTemplate: if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns()) { // template < parameters > CodeCompletionString *Pattern = new CodeCompletionString; @@ -1340,24 +1340,24 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC, AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results); break; - case Action::PCC_ObjCInterface: + case Sema::PCC_ObjCInterface: AddObjCInterfaceResults(SemaRef.getLangOptions(), Results, true); AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results); break; - case Action::PCC_ObjCImplementation: + case Sema::PCC_ObjCImplementation: AddObjCImplementationResults(SemaRef.getLangOptions(), Results, true); AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results); break; - case Action::PCC_ObjCInstanceVariableList: + case Sema::PCC_ObjCInstanceVariableList: AddObjCVisibilityResults(SemaRef.getLangOptions(), Results, true); break; - case Action::PCC_RecoveryInFunction: - case Action::PCC_Statement: { + case Sema::PCC_RecoveryInFunction: + case Sema::PCC_Statement: { AddTypedefResult(Results); CodeCompletionString *Pattern = 0; @@ -1529,12 +1529,12 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC, } // Fall through (for statement expressions). - case Action::PCC_ForInit: - case Action::PCC_Condition: + case Sema::PCC_ForInit: + case Sema::PCC_Condition: AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); // Fall through: conditions and statements can have expressions. - case Action::PCC_Expression: { + case Sema::PCC_Expression: { CodeCompletionString *Pattern = 0; if (SemaRef.getLangOptions().CPlusPlus) { // 'this', if we're in a non-static member function. @@ -1670,14 +1670,14 @@ static void AddOrdinaryNameResults(Action::ParserCompletionContext CCC, break; } - case Action::PCC_Type: + case Sema::PCC_Type: break; } if (WantTypesInContext(CCC, SemaRef.getLangOptions())) AddTypeSpecifierResults(SemaRef.getLangOptions(), Results); - if (SemaRef.getLangOptions().CPlusPlus && CCC != Action::PCC_Type) + if (SemaRef.getLangOptions().CPlusPlus && CCC != Sema::PCC_Type) Results.AddResult(Result("operator")); } @@ -2322,35 +2322,35 @@ static void HandleCodeCompleteResults(Sema *S, static enum CodeCompletionContext::Kind mapCodeCompletionContext(Sema &S, Sema::ParserCompletionContext PCC) { switch (PCC) { - case Action::PCC_Namespace: + case Sema::PCC_Namespace: return CodeCompletionContext::CCC_TopLevel; - case Action::PCC_Class: + case Sema::PCC_Class: return CodeCompletionContext::CCC_ClassStructUnion; - case Action::PCC_ObjCInterface: + case Sema::PCC_ObjCInterface: return CodeCompletionContext::CCC_ObjCInterface; - case Action::PCC_ObjCImplementation: + case Sema::PCC_ObjCImplementation: return CodeCompletionContext::CCC_ObjCImplementation; - case Action::PCC_ObjCInstanceVariableList: + case Sema::PCC_ObjCInstanceVariableList: return CodeCompletionContext::CCC_ObjCIvarList; - case Action::PCC_Template: - case Action::PCC_MemberTemplate: - case Action::PCC_RecoveryInFunction: + case Sema::PCC_Template: + case Sema::PCC_MemberTemplate: + case Sema::PCC_RecoveryInFunction: return CodeCompletionContext::CCC_Other; - case Action::PCC_Expression: - case Action::PCC_ForInit: - case Action::PCC_Condition: + case Sema::PCC_Expression: + case Sema::PCC_ForInit: + case Sema::PCC_Condition: return CodeCompletionContext::CCC_Expression; - case Action::PCC_Statement: + case Sema::PCC_Statement: return CodeCompletionContext::CCC_Statement; - case Action::PCC_Type: + case Sema::PCC_Type: return CodeCompletionContext::CCC_Type; } @@ -4855,8 +4855,8 @@ void Sema::CodeCompletePreprocessorDirective(bool InConditional) { void Sema::CodeCompleteInPreprocessorConditionalExclusion(Scope *S) { CodeCompleteOrdinaryName(S, - S->getFnParent()? Action::PCC_RecoveryInFunction - : Action::PCC_Namespace); + S->getFnParent()? Sema::PCC_RecoveryInFunction + : Sema::PCC_Namespace); } void Sema::CodeCompletePreprocessorMacroName(bool IsDefinition) { @@ -4912,8 +4912,8 @@ void Sema::CodeCompletePreprocessorMacroArgument(Scope *S, // do for function calls. CodeCompleteOrdinaryName(S, - S->getFnParent()? Action::PCC_RecoveryInFunction - : Action::PCC_Namespace); + S->getFnParent()? Sema::PCC_RecoveryInFunction + : Sema::PCC_Namespace); } void Sema::CodeCompleteNaturalLanguage() { diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3473bffce8..122a956cb3 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -42,14 +42,6 @@ using namespace clang; using namespace sema; -/// getDeclName - Return a pretty name for the specified decl if possible, or -/// an empty string if not. This is used for pretty crash reporting. -std::string Sema::getDeclName(Decl *D) { - if (NamedDecl *DN = dyn_cast_or_null<NamedDecl>(D)) - return DN->getQualifiedNameAsString(); - return ""; -} - Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr) { return DeclGroupPtrTy::make(DeclGroupRef(Ptr)); } @@ -4921,7 +4913,7 @@ static void ComputeNRVO(Stmt *Body, FunctionScopeInfo *Scope) { const_cast<VarDecl*>(NRVOCandidate)->setNRVOVariable(true); } -Decl *Sema::ActOnFinishFunctionBody(Decl *D, StmtArg BodyArg) { +Decl *Sema::ActOnFinishFunctionBody(Decl *D, Stmt *BodyArg) { return ActOnFinishFunctionBody(D, move(BodyArg), false); } diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 177013e6d5..9b36b31e7e 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -2412,7 +2412,7 @@ void Sema::ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD) { /// /// The state token we use is the start index of this scope /// on the warning stack. -Action::ParsingDeclStackState Sema::PushParsingDeclaration() { +Sema::ParsingDeclStackState Sema::PushParsingDeclaration() { ParsingDeclDepth++; return (ParsingDeclStackState) DelayedDiagnostics.size(); } diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 223569d9d4..513836a002 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -584,7 +584,7 @@ void Sema::SetClassDeclAttributesFromBase(CXXRecordDecl *Class, /// example: /// class foo : public bar, virtual private baz { /// 'public bar' and 'virtual private baz' are each base-specifiers. -Sema::BaseResult +BaseResult Sema::ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc) { @@ -1056,7 +1056,7 @@ static bool FindBaseInitializer(Sema &SemaRef, } /// ActOnMemInitializer - Handle a C++ member initializer. -Sema::MemInitResult +MemInitResult Sema::ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, @@ -1262,7 +1262,7 @@ static bool InitExprContainsUninitializedFields(const Stmt *S, return false; } -Sema::MemInitResult +MemInitResult Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args, unsigned NumArgs, SourceLocation IdLoc, SourceLocation LParenLoc, @@ -1359,7 +1359,7 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args, RParenLoc); } -Sema::MemInitResult +MemInitResult Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr **Args, unsigned NumArgs, SourceLocation LParenLoc, SourceLocation RParenLoc, @@ -1519,7 +1519,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, = InitializationKind::CreateDefault(Constructor->getLocation()); InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, 0, 0); BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, - Sema::MultiExprArg(SemaRef, 0, 0)); + MultiExprArg(SemaRef, 0, 0)); break; } @@ -1548,8 +1548,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, &CopyCtorArg, 1); BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, - Sema::MultiExprArg(SemaRef, - &CopyCtorArg, 1)); + MultiExprArg(&CopyCtorArg, 1)); break; } @@ -1673,7 +1672,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, ExprResult MemberInit = InitSeq.Perform(SemaRef, Entities.back(), InitKind, - Sema::MultiExprArg(SemaRef, &CopyCtorArgE, 1)); + MultiExprArg(&CopyCtorArgE, 1)); MemberInit = SemaRef.MaybeCreateCXXExprWithTemporaries(MemberInit.get()); if (MemberInit.isInvalid()) return true; @@ -1698,8 +1697,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, 0, 0); ExprResult MemberInit = - InitSeq.Perform(SemaRef, InitEntity, InitKind, - Sema::MultiExprArg(SemaRef, 0, 0)); + InitSeq.Perform(SemaRef, InitEntity, InitKind, MultiExprArg()); if (MemberInit.isInvalid()) return true; @@ -4621,7 +4619,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, /*TemplateArgs=*/0, /*SuppressQualifierCheck=*/true); if (OpEqualRef.isInvalid()) - return S.StmtError(); + return StmtError(); // Build the call to the assignment operator. @@ -4629,7 +4627,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, OpEqualRef.takeAs<Expr>(), Loc, &From, 1, 0, Loc); if (Call.isInvalid()) - return S.StmtError(); + return StmtError(); return S.Owned(Call.takeAs<Stmt>()); } @@ -4640,7 +4638,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, if (!ArrayTy) { ExprResult Assignment = S.CreateBuiltinBinOp(Loc, BO_Assign, To, From); if (Assignment.isInvalid()) - return S.StmtError(); + return StmtError(); return S.Owned(Assignment.takeAs<Stmt>()); } @@ -4707,7 +4705,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, To, From, CopyingBaseSubobject, Depth+1); if (Copy.isInvalid()) - return S.StmtError(); + return StmtError(); // Construct the loop that copies all elements of this array. return S.ActOnForStmt(Loc, Loc, InitStmt, @@ -6947,8 +6945,7 @@ void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) { InitializationSequence InitSeq(*this, InitEntity, InitKind, 0, 0); ExprResult MemberInit = - InitSeq.Perform(*this, InitEntity, InitKind, - Sema::MultiExprArg(*this, 0, 0)); + InitSeq.Perform(*this, InitEntity, InitKind, MultiExprArg()); MemberInit = MaybeCreateCXXExprWithTemporaries(MemberInit.get()); // Note, MemberInit could actually come back empty if no initialization // is required (e.g., because it would call a trivial default constructor) diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 8f61933626..2f8cfe2d2f 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1587,16 +1587,16 @@ static ExprResult BuildCXXCastArgument(Sema &S, ASTOwningVector<Expr*> ConstructorArgs(S); if (S.CompleteConstructorCall(cast<CXXConstructorDecl>(Method), - Sema::MultiExprArg(S, &From, 1), + MultiExprArg(&From, 1), CastLoc, ConstructorArgs)) - return S.ExprError(); + return ExprError(); ExprResult Result = S.BuildCXXConstructExpr(CastLoc, Ty, cast<CXXConstructorDecl>(Method), move_arg(ConstructorArgs), /*ZeroInit*/ false, CXXConstructExpr::CK_Complete); if (Result.isInvalid()) - return S.ExprError(); + return ExprError(); return S.MaybeBindToTemporary(Result.takeAs<Expr>()); } @@ -2182,8 +2182,7 @@ static bool ConvertForConditional(Sema &Self, Expr *&E, QualType T) { InitializationKind Kind = InitializationKind::CreateCopy(E->getLocStart(), SourceLocation()); InitializationSequence InitSeq(Self, Entity, Kind, &E, 1); - ExprResult Result = InitSeq.Perform(Self, Entity, Kind, - Sema::MultiExprArg(Self, &E, 1)); + ExprResult Result = InitSeq.Perform(Self, Entity, Kind, MultiExprArg(&E, 1)); if (Result.isInvalid()) return true; @@ -2784,7 +2783,7 @@ ExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc, return ActOnCallExpr(/*Scope*/ 0, MemExpr, /*LPLoc*/ ExpectedLParenLoc, - Sema::MultiExprArg(*this, 0, 0), + MultiExprArg(), /*CommaLocs*/ 0, /*RPLoc*/ ExpectedLParenLoc); } diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 56d80a0288..b56159c453 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -24,9 +24,9 @@ using namespace clang; -Sema::ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs, - ExprTy **strings, - unsigned NumStrings) { +ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs, + Expr **strings, + unsigned NumStrings) { StringLiteral **Strings = reinterpret_cast<StringLiteral**>(strings); // Most ObjC strings are formed out of a single piece. However, we *can* @@ -133,11 +133,11 @@ Expr *Sema::BuildObjCEncodeExpression(SourceLocation AtLoc, return new (Context) ObjCEncodeExpr(StrTy, EncodedTypeInfo, AtLoc, RParenLoc); } -Sema::ExprResult Sema::ParseObjCEncodeExpression(SourceLocation AtLoc, - SourceLocation EncodeLoc, - SourceLocation LParenLoc, - ParsedType ty, - SourceLocation RParenLoc) { +ExprResult Sema::ParseObjCEncodeExpression(SourceLocation AtLoc, + SourceLocation EncodeLoc, + SourceLocation LParenLoc, + ParsedType ty, + SourceLocation RParenLoc) { // FIXME: Preserve type source info ? TypeSourceInfo *TInfo; QualType EncodedType = GetTypeFromParser(ty, &TInfo); @@ -148,11 +148,11 @@ Sema::ExprResult Sema::ParseObjCEncodeExpression(SourceLocation AtLoc, return BuildObjCEncodeExpression(AtLoc, TInfo, RParenLoc); } -Sema::ExprResult Sema::ParseObjCSelectorExpression(Selector Sel, - SourceLocation AtLoc, - SourceLocation SelLoc, - SourceLocation LParenLoc, - SourceLocation RParenLoc) { +ExprResult Sema::ParseObjCSelectorExpression(Selector Sel, + SourceLocation AtLoc, + SourceLocation SelLoc, + SourceLocation LParenLoc, + SourceLocation RParenLoc) { ObjCMethodDecl *Method = LookupInstanceMethodInGlobalPool(Sel, SourceRange(LParenLoc, RParenLoc), false, false); if (!Method) @@ -170,11 +170,11 @@ Sema::ExprResult Sema::ParseObjCSelectorExpression(Selector Sel, return new (Context) ObjCSelectorExpr(Ty, Sel, AtLoc, RParenLoc); } -Sema::ExprResult Sema::ParseObjCProtocolExpression(IdentifierInfo *ProtocolId, - SourceLocation AtLoc, - SourceLocation ProtoLoc, - SourceLocation LParenLoc, - SourceLocation RParenLoc) { +ExprResult Sema::ParseObjCProtocolExpression(IdentifierInfo *ProtocolId, + SourceLocation AtLoc, + SourceLocation ProtoLoc, + SourceLocation LParenLoc, + SourceLocation RParenLoc) { ObjCProtocolDecl* PDecl = LookupProtocol(ProtocolId, ProtoLoc); if (!PDecl) { Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId; diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index fdac476272..a719590d6a 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -265,8 +265,7 @@ void InitListChecker::FillInValueInitForField(unsigned Init, FieldDecl *Field, } ExprResult MemberInit - = InitSeq.Perform(SemaRef, MemberEntity, Kind, - Sema::MultiExprArg(SemaRef, 0, 0)); + = InitSeq.Perform(SemaRef, MemberEntity, Kind, MultiExprArg()); if (MemberInit.isInvalid()) { hadError = true; return; @@ -375,8 +374,7 @@ InitListChecker::FillInValueInitializations(const InitializedEntity &Entity, } ExprResult ElementInit - = InitSeq.Perform(SemaRef, ElementEntity, Kind, - Sema::MultiExprArg(SemaRef, 0, 0)); + = InitSeq.Perform(SemaRef, ElementEntity, Kind, MultiExprArg()); if (ElementInit.isInvalid()) { hadError = true; return; @@ -680,8 +678,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, if (Seq) { ExprResult Result = - Seq.Perform(SemaRef, Entity, Kind, - Sema::MultiExprArg(SemaRef, &expr, 1)); + Seq.Perform(SemaRef, Entity, Kind, MultiExprArg(&expr, 1)); if (Result.isInvalid()) hadError = true; @@ -3369,7 +3366,7 @@ static ExprResult CopyObject(Sema &S, << CurInitExpr->getSourceRange(); CandidateSet.NoteCandidates(S, OCD_AllCandidates, &CurInitExpr, 1); if (!IsExtraneousCopy || S.isSFINAEContext()) - return S.ExprError(); + return ExprError(); return move(CurInit); case OR_Ambiguous: @@ -3377,7 +3374,7 @@ static ExprResult CopyObject(Sema &S, << (int)Entity.getKind() << CurInitExpr->getType() << CurInitExpr->getSourceRange(); CandidateSet.NoteCandidates(S, OCD_ViableCandidates, &CurInitExpr, 1); - return S.ExprError(); + return ExprError(); |