summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-09 19:42:16 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-09 19:42:16 +0000
commit020713e308b1fac0e9e27a6071fb4f1303120637 (patch)
tree9a3b5c9e0c7d053227512b06d873a7c41d78fa10 /clang/lib/Sema
parent06b9ee567b4dacc0f97fcac2923fa3cc1da947c9 (diff)
downloadbcm5719-llvm-020713e308b1fac0e9e27a6071fb4f1303120637.tar.gz
bcm5719-llvm-020713e308b1fac0e9e27a6071fb4f1303120637.zip
Replace DeclContext's vector of ScopedDecl pointers with a linked list
of ScopedDecls (using the new ScopedDecl::NextDeclInScope pointer). Performance-wise: - It's a net win in memory utilization, since DeclContext is now one pointer smaller than it used to be (std::vectors are typically 3 pointers; we now use 2 pointers) and - Parsing Cocoa.h with -fsyntax-only (with a Release-Asserts Clang) is about 1.9% faster than before, most likely because we no longer have the memory allocations and copying associated with the std::vector. I'll re-enable serialization of DeclContexts once I've sorted out the NextDeclarator/NextDeclInScope question. llvm-svn: 62001
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp10
2 files changed, 7 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index ecf6de9d96f..ee72a98295c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -515,7 +515,7 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) {
Diag(New->getLocation(), diag::err_redefinition_different_typedef)
<< New->getUnderlyingType() << Old->getUnderlyingType();
Diag(Old->getLocation(), diag::note_previous_definition);
- return Old;
+ return New;
}
if (getLangOptions().Microsoft) return New;
@@ -768,7 +768,8 @@ VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) {
QualType OldCType = Context.getCanonicalType(Old->getType());
QualType NewCType = Context.getCanonicalType(New->getType());
if (OldCType != NewCType && !Context.typesAreCompatible(OldCType, NewCType)) {
- Diag(New->getLocation(), diag::err_redefinition) << New->getDeclName();
+ Diag(New->getLocation(), diag::err_redefinition_different_type)
+ << New->getDeclName();
Diag(Old->getLocation(), diag::note_previous_definition);
return New;
}
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index f39b84c2701..49a8c835c5c 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -1078,6 +1078,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
ObjCPropertyDecl::Optional) ?
ObjCMethodDecl::Optional :
ObjCMethodDecl::Required);
+ CD->addDecl(Context, GetterMethod);
} else
// A user declared getter will be synthesize when @synthesize of
// the property with the same name is seen in the @implementation
@@ -1108,6 +1109,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
VarDecl::None,
0, 0);
SetterMethod->setMethodParams(&Argument, 1);
+ CD->addDecl(Context, SetterMethod);
} else
// A user declared setter will be synthesize when @synthesize of
// the property with the same name is seen in the @implementation
@@ -1126,14 +1128,10 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
// double bar = [foo bar];
// }
//
- if (GetterMethod) {
- CD->addDecl(Context, GetterMethod);
+ if (GetterMethod)
AddInstanceMethodToGlobalPool(GetterMethod);
- }
- if (SetterMethod) {
- CD->addDecl(Context, SetterMethod);
+ if (SetterMethod)
AddInstanceMethodToGlobalPool(SetterMethod);
- }
}
// Note: For class/category implemenations, allMethods/allProperties is
OpenPOWER on IntegriCloud