diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-11 11:37:55 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-11 11:37:55 +0000 |
commit | c42e1183846228a7fa5143ad76507d6d60f5c6f3 (patch) | |
tree | 04bcf44fb748f6c8e9296e4601dcdb64edc7258b /lib/Sema/SemaDecl.cpp | |
parent | d57a871339c7c98d58d93108b806f59bdf4e13e2 (diff) |
Implement C++ 'typeid' parsing and sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 879a79b633..b595ad7f31 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -193,7 +193,8 @@ ObjCInterfaceDecl *Sema::getObjCInterfaceDecl(IdentifierInfo *Id) { /// LookupDecl - Look up the inner-most declaration in the specified /// namespace. Decl *Sema::LookupDecl(const IdentifierInfo *II, unsigned NSI, Scope *S, - DeclContext *LookupCtx, bool enableLazyBuiltinCreation) { + const DeclContext *LookupCtx, + bool enableLazyBuiltinCreation) { if (II == 0) return 0; unsigned NS = NSI; if (getLangOptions().CPlusPlus && (NS & Decl::IDNS_Ordinary)) @@ -278,6 +279,18 @@ ScopedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, return New; } +/// GetStdNamespace - This method gets the C++ "std" namespace. This is where +/// everything from the standard library is defined. +NamespaceDecl *Sema::GetStdNamespace() { + if (!StdNamespace) { + DeclContext *Global = Context.getTranslationUnitDecl(); + Decl *Std = LookupDecl(Ident_StdNs, Decl::IDNS_Tag | Decl::IDNS_Ordinary, + 0, Global, /*enableLazyBuiltinCreation=*/false); + StdNamespace = dyn_cast_or_null<NamespaceDecl>(Std); + } + return StdNamespace; +} + /// MergeTypeDefDecl - We just parsed a typedef 'New' which has the same name /// and scope as a previous declaration 'Old'. Figure out how to resolve this /// situation, merging decls or emitting diagnostics as appropriate. |