summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-19 08:27:24 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-19 08:27:24 +0000
commit4e004ed124bb2a85d285c38bcd44aa4b5ee20e7c (patch)
treedcd88cd8ead1241dacde44dc6511ec2a3ad71554 /clang/lib/CodeGen/CodeGenModule.cpp
parent8d6ab2afa6a1927d5eedcf930198b3508263d89b (diff)
downloadbcm5719-llvm-4e004ed124bb2a85d285c38bcd44aa4b5ee20e7c.tar.gz
bcm5719-llvm-4e004ed124bb2a85d285c38bcd44aa4b5ee20e7c.zip
IRgen support for alias of global variable.
- PR3818. llvm-svn: 67297
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index aed067617eb..cc460c59593 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -369,7 +369,7 @@ void CodeGenModule::SetFunctionAttributes(const FunctionDecl *FD,
void CodeGenModule::EmitAliases() {
for (unsigned i = 0, e = Aliases.size(); i != e; ++i) {
- const FunctionDecl *D = Aliases[i];
+ const ValueDecl *D = Aliases[i];
const AliasAttr *AA = D->getAttr<AliasAttr>();
// This is something of a hack, if the FunctionDecl got overridden
@@ -380,7 +380,7 @@ void CodeGenModule::EmitAliases() {
continue;
const std::string& aliaseeName = AA->getAliasee();
- llvm::Function *aliasee = getModule().getFunction(aliaseeName);
+ llvm::GlobalValue *aliasee = getModule().getNamedValue(aliaseeName);
if (!aliasee) {
// FIXME: This isn't unsupported, this is just an error, which
// sema should catch, but...
@@ -539,16 +539,14 @@ bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {
}
void CodeGenModule::EmitGlobal(const ValueDecl *Global) {
- if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(Global)) {
- // Aliases are deferred until code for everything else has been
- // emitted.
- if (FD->getAttr<AliasAttr>()) {
- assert(!FD->isThisDeclarationADefinition() &&
- "Function alias cannot have a definition!");
- Aliases.push_back(FD);
- return;
- }
+ // Aliases are deferred until code for everything else has been
+ // emitted.
+ if (Global->getAttr<AliasAttr>()) {
+ Aliases.push_back(Global);
+ return;
+ }
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(Global)) {
// Forward declarations are emitted lazily on first use.
if (!FD->isThisDeclarationADefinition())
return;
OpenPOWER on IntegriCloud