diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 3 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/mangle.cpp | 6 |
3 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 6419e27e63e..4cee5c8f373 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1218,6 +1218,12 @@ void CodeGenModule::EmitObjCPropertyImplementations(const } } +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 @@ -1233,7 +1239,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { break; case Decl::Namespace: - ErrorUnsupported(D, "namespace"); + EmitNamespace(cast<NamespaceDecl>(D)); break; // Objective-C Decls diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 01b8d02fb8e..4fbacdc25c9 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -324,7 +324,8 @@ private: 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); diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp index 7acb31cc69e..0a76dddaff9 100644 --- a/clang/test/CodeGenCXX/mangle.cpp +++ b/clang/test/CodeGenCXX/mangle.cpp @@ -26,3 +26,9 @@ void f(y) { } // 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() { } } } |