}
}
+void CodeGenModule::EmitNamespace(const NamespaceDecl *ND) {
+ for (RecordDecl::decl_iterator I = ND->decls_begin(), E = ND->decls_end();
+ I != E; ++I)
+ EmitTopLevelDecl(*I);
+}
+
/// EmitTopLevelDecl - Emit code for a single top level declaration.
void CodeGenModule::EmitTopLevelDecl(Decl *D) {
// If an error has occurred, stop code generation, but continue
break;
case Decl::Namespace:
- ErrorUnsupported(D, "namespace");
+ EmitNamespace(cast<NamespaceDecl>(D));
break;
// Objective-C Decls
void EmitGlobalVarDefinition(const VarDecl *D);
void EmitAliasDefinition(const ValueDecl *D);
void EmitObjCPropertyImplementations(const ObjCImplementationDecl *D);
-
+ void EmitNamespace(const NamespaceDecl *D);
+
// FIXME: Hardcoding priority here is gross.
void AddGlobalCtor(llvm::Function * Ctor, int Priority=65535);
void AddGlobalDtor(llvm::Function * Dtor, int Priority=65535);
// RUN: grep _Z1fv %t | count 1
void f() { }
+
+// RUN: grep _ZN1N1fEv %t | count 1
+namespace N { void f() { } }
+
+// RUN: grep _ZN1N1N1fEv %t | count 1
+namespace N { namespace N { void f() { } } }