diff options
author | John McCall <rjmccall@apple.com> | 2009-10-01 00:25:31 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-10-01 00:25:31 +0000 |
commit | 4fa53427585ceea6e5e947bc19e7cfbce17bb4fa (patch) | |
tree | 0bad8cf4cb2935a36ae940f4db40ae6e0ceab28c /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | e0709cfc9247239ea4e083c2b8f0a6e570bd3666 (diff) | |
download | bcm5719-llvm-4fa53427585ceea6e5e947bc19e7cfbce17bb4fa.tar.gz bcm5719-llvm-4fa53427585ceea6e5e947bc19e7cfbce17bb4fa.zip |
Anonymous namespaces, sema + codegen. A lot of semantics are still broken,
apparently because using directives aren't quite working correctly.
llvm-svn: 83184
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index bc8cc2652d9..f93c6048a74 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -247,6 +247,11 @@ void CodeGenModule::EmitAnnotations() { static CodeGenModule::GVALinkage GetLinkageForFunction(ASTContext &Context, const FunctionDecl *FD, const LangOptions &Features) { + // Everything located semantically within an anonymous namespace is + // always internal. + if (FD->isInAnonymousNamespace()) + return CodeGenModule::GVA_Internal; + // The kind of external linkage this function will have, if it is not // inline or static. CodeGenModule::GVALinkage External = CodeGenModule::GVA_StrongExternal; @@ -1000,7 +1005,9 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { GV->setAlignment(getContext().getDeclAlignInBytes(D)); // Set the llvm linkage type as appropriate. - if (D->getStorageClass() == VarDecl::Static) + if (D->isInAnonymousNamespace()) + GV->setLinkage(llvm::Function::InternalLinkage); + else if (D->getStorageClass() == VarDecl::Static) GV->setLinkage(llvm::Function::InternalLinkage); else if (D->hasAttr<DLLImportAttr>()) GV->setLinkage(llvm::Function::DLLImportLinkage); |