summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-11-22 09:01:48 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-11-22 09:01:48 +0000
commitf798172419f4acf7c784373e97ed79ced98e1159 (patch)
treef98bde80d6a5d5b3bc781fa128ad18a4b31cde82 /clang/lib/Sema
parentfe8ed4a5914afed12a7cff6e3f3ea65b39e2d909 (diff)
downloadbcm5719-llvm-f798172419f4acf7c784373e97ed79ced98e1159.tar.gz
bcm5719-llvm-f798172419f4acf7c784373e97ed79ced98e1159.zip
Add class-specific operator new to Decl hierarchy. This guarantees that Decls
can't accidentally be allocated the wrong way (missing prefix data for decls from AST files, for instance) and simplifies the CreateDeserialized functions a little. An extra DeclContext* parameter to the not-from-AST-file operator new allows us to ensure that we don't accidentally call the wrong one when deserializing (when we don't have a DeclContext), allows some extra checks, and prepares for some planned modules-related changes to Decl allocation. No functionality change intended. llvm-svn: 195426
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp6
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp8
2 files changed, 5 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 1eec2318e2b..54eef40043b 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -12793,11 +12793,9 @@ MSPropertyDecl *Sema::HandleMSProperty(Scope *S, RecordDecl *Record,
PrevDecl = 0;
SourceLocation TSSL = D.getLocStart();
- MSPropertyDecl *NewPD;
const AttributeList::PropertyData &Data = MSPropertyAttr->getPropertyData();
- NewPD = new (Context) MSPropertyDecl(Record, Loc,
- II, T, TInfo, TSSL,
- Data.GetterId, Data.SetterId);
+ MSPropertyDecl *NewPD = MSPropertyDecl::Create(
+ Context, Record, Loc, II, T, TInfo, TSSL, Data.GetterId, Data.SetterId);
ProcessDeclAttributes(TUScope, NewPD, D);
NewPD->setAccess(AS);
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index f5c4c72cb34..a0af0329530 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -488,11 +488,9 @@ Decl *TemplateDeclInstantiator::VisitMSPropertyDecl(MSPropertyDecl *D) {
SemaRef.MarkDeclarationsReferencedInType(D->getLocation(), DI->getType());
}
- MSPropertyDecl *Property = new (SemaRef.Context)
- MSPropertyDecl(Owner, D->getLocation(),
- D->getDeclName(), DI->getType(), DI,
- D->getLocStart(),
- D->getGetterId(), D->getSetterId());
+ MSPropertyDecl *Property = MSPropertyDecl::Create(
+ SemaRef.Context, Owner, D->getLocation(), D->getDeclName(), DI->getType(),
+ DI, D->getLocStart(), D->getGetterId(), D->getSetterId());
SemaRef.InstantiateAttrs(TemplateArgs, D, Property, LateAttrs,
StartingScope);
OpenPOWER on IntegriCloud