[cfe-commits] r68170 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h test/CodeGenCXX/mangle.cpp
Anders Carlsson
andersca at mac.com
Tue Mar 31 17:58:26 PDT 2009
Author: andersca
Date: Tue Mar 31 19:58:25 2009
New Revision: 68170
URL: http://llvm.org/viewvc/llvm-project?rev=68170&view=rev
Log:
Implement code generation of namespaces and add mangling tests.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/test/CodeGenCXX/mangle.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=68170&r1=68169&r2=68170&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Mar 31 19:58:25 2009
@@ -1218,6 +1218,12 @@
}
}
+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 @@
break;
case Decl::Namespace:
- ErrorUnsupported(D, "namespace");
+ EmitNamespace(cast<NamespaceDecl>(D));
break;
// Objective-C Decls
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=68170&r1=68169&r2=68170&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Tue Mar 31 19:58:25 2009
@@ -324,7 +324,8 @@
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);
Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=68170&r1=68169&r2=68170&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Tue Mar 31 19:58:25 2009
@@ -26,3 +26,9 @@
// 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() { } } }
More information about the cfe-commits
mailing list