diff options
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 12 | ||||
| -rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 10 | ||||
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 23 | 
3 files changed, 20 insertions, 25 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 982ca7faa17..c92a7d14cc6 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2927,7 +2927,7 @@ QualType ASTContext::getCFConstantStringType() {        CFConstantStringTypeDecl->addDecl(Field);      } -    CFConstantStringTypeDecl->completeDefinition(*this); +    CFConstantStringTypeDecl->completeDefinition();    }    return getTagDeclType(CFConstantStringTypeDecl); @@ -2964,7 +2964,7 @@ QualType ASTContext::getObjCFastEnumerationStateType() {        ObjCFastEnumerationStateTypeDecl->addDecl(Field);      } -    ObjCFastEnumerationStateTypeDecl->completeDefinition(*this); +    ObjCFastEnumerationStateTypeDecl->completeDefinition();    }    return getTagDeclType(ObjCFastEnumerationStateTypeDecl); @@ -3001,7 +3001,7 @@ QualType ASTContext::getBlockDescriptorType() {      T->addDecl(Field);    } -  T->completeDefinition(*this); +  T->completeDefinition();    BlockDescriptorType = T; @@ -3049,7 +3049,7 @@ QualType ASTContext::getBlockDescriptorExtendedType() {      T->addDecl(Field);    } -  T->completeDefinition(*this); +  T->completeDefinition();    BlockDescriptorExtendedType = T; @@ -3126,7 +3126,7 @@ QualType ASTContext::BuildByRefType(const char *DeclName, QualType Ty) {      T->addDecl(Field);    } -  T->completeDefinition(*this); +  T->completeDefinition();    return getPointerType(getTagDeclType(T));  } @@ -3190,7 +3190,7 @@ QualType ASTContext::getBlockParmType(      T->addDecl(Field);    } -  T->completeDefinition(*this); +  T->completeDefinition();    return getPointerType(getTagDeclType(T));  } diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 710a4635c15..3a6a3a13dab 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -759,7 +759,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {           ++FromMem)        Importer.Import(*FromMem); -    ToRecord->completeDefinition(Importer.getToContext()); +    ToRecord->completeDefinition();    }    return ToRecord; @@ -851,8 +851,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {      Parameters[I]->setOwningFunction(ToFunction);      ToFunction->addDecl(Parameters[I]);    } -  ToFunction->setParams(Importer.getToContext(),  -                        Parameters.data(), Parameters.size()); +  ToFunction->setParams(Parameters.data(), Parameters.size());    // FIXME: Other bits to merge? @@ -963,7 +962,7 @@ Decl *ASTNodeImporter::VisitVarDecl(VarDecl *D) {            Importer.FromDiag(DDef->getLocation(), diag::note_odr_defined_here);          } else {            Expr *Init = Importer.Import(DDef->getInit()); -          MergeWithVar->setInit(Importer.getToContext(), Init); +          MergeWithVar->setInit(Init);          }        } @@ -992,8 +991,7 @@ Decl *ASTNodeImporter::VisitVarDecl(VarDecl *D) {    // FIXME: Can we really import any initializer? Alternatively, we could force    // ourselves to import every declaration of a variable and then only use    // getInit() here. -  ToVar->setInit(Importer.getToContext(), -                 Importer.Import(const_cast<Expr *>(D->getAnyInitializer()))); +  ToVar->setInit(Importer.Import(const_cast<Expr *>(D->getAnyInitializer())));    // FIXME: Other bits to merge? diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 80c1244698f..48516364c67 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -717,10 +717,10 @@ VarDecl *VarDecl::getOutOfLineDefinition() {    return 0;  } -void VarDecl::setInit(ASTContext &C, Expr *I) { +void VarDecl::setInit(Expr *I) {    if (EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>()) {      Eval->~EvaluatedStmt(); -    C.Deallocate(Eval); +    getASTContext().Deallocate(Eval);    }    Init = I; @@ -984,14 +984,13 @@ unsigned FunctionDecl::getNumParams() const {  } -void FunctionDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo, -                             unsigned NumParams) { +void FunctionDecl::setParams(ParmVarDecl **NewParamInfo, unsigned NumParams) {    assert(ParamInfo == 0 && "Already has param info!");    assert(NumParams == getNumParams() && "Parameter count mismatch!");    // Zero params -> null pointer.    if (NumParams) { -    void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams); +    void *Mem = getASTContext().Allocate(sizeof(ParmVarDecl*)*NumParams);      ParamInfo = new (Mem) ParmVarDecl*[NumParams];      memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams); @@ -1228,8 +1227,7 @@ FunctionDecl::getTemplateSpecializationArgs() const {  }  void -FunctionDecl::setFunctionTemplateSpecialization(ASTContext &Context, -                                                FunctionTemplateDecl *Template, +FunctionDecl::setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,                                       const TemplateArgumentList *TemplateArgs,                                                  void *InsertPos,                                                TemplateSpecializationKind TSK) { @@ -1238,7 +1236,7 @@ FunctionDecl::setFunctionTemplateSpecialization(ASTContext &Context,    FunctionTemplateSpecializationInfo *Info      = TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>();    if (!Info) -    Info = new (Context) FunctionTemplateSpecializationInfo; +    Info = new (getASTContext()) FunctionTemplateSpecializationInfo;    Info->Function = this;    Info->Template.setPointer(Template); @@ -1436,8 +1434,7 @@ void EnumDecl::Destroy(ASTContext& C) {    Decl::Destroy(C);  } -void EnumDecl::completeDefinition(ASTContext &C, -                                  QualType NewType, +void EnumDecl::completeDefinition(QualType NewType,                                    QualType NewPromotionType) {    assert(!isDefinition() && "Cannot redefine enums!");    IntegerType = NewType; @@ -1482,7 +1479,7 @@ bool RecordDecl::isInjectedClassName() const {  /// completeDefinition - Notes that the definition of this type is now  /// complete. -void RecordDecl::completeDefinition(ASTContext& C) { +void RecordDecl::completeDefinition() {    assert(!isDefinition() && "Cannot redefine record!");    TagDecl::completeDefinition();  } @@ -1505,14 +1502,14 @@ void BlockDecl::Destroy(ASTContext& C) {    Decl::Destroy(C);  } -void BlockDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo, +void BlockDecl::setParams(ParmVarDecl **NewParamInfo,                            unsigned NParms) {    assert(ParamInfo == 0 && "Already has param info!");    // Zero params -> null pointer.    if (NParms) {      NumParams = NParms; -    void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams); +    void *Mem = getASTContext().Allocate(sizeof(ParmVarDecl*)*NumParams);      ParamInfo = new (Mem) ParmVarDecl*[NumParams];      memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams);    }  | 

