diff options
author | John McCall <rjmccall@apple.com> | 2011-04-12 00:42:48 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-04-12 00:42:48 +0000 |
commit | 755d8497e39071aa24acc173ff07083e3256b8f8 (patch) | |
tree | 47914f058b5de1a56c791ed102573f17d36f1d5a /lib/CodeGen/CodeGenModule.cpp | |
parent | 235c02f79e0ece9463490aa87eaaa02bad300dac (diff) |
After some discussion with Doug, we decided that it made a lot more sense
for __unknown_anytype resolution to destructively modify the AST. So that's
what it does now, which significantly simplifies some of the implementation.
Normal member calls work pretty cleanly now, and I added support for
propagating unknown-ness through &.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129331 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 8f304ff580..944b24cbd3 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1072,54 +1072,6 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, return GetOrCreateLLVMGlobal(MangledName, PTy, D); } -/// getAddrOfUnknownAnyDecl - Return an llvm::Constant for the address -/// of a global which was declared with unknown type. It is possible -/// for a VarDecl to end up getting resolved to have function type, -/// which complicates this substantially; on the other hand, these are -/// always external references, which does simplify the logic a lot. -llvm::Constant * -CodeGenModule::getAddrOfUnknownAnyDecl(const NamedDecl *decl, QualType type) { - GlobalDecl global; - - // FunctionDecls will always end up with function types, but - // VarDecls can end up with them too. - if (isa<FunctionDecl>(decl)) - global = GlobalDecl(cast<FunctionDecl>(decl)); - else - global = GlobalDecl(cast<VarDecl>(decl)); - llvm::StringRef mangledName = getMangledName(global); - - const llvm::Type *ty = getTypes().ConvertTypeForMem(type); - const llvm::PointerType *pty = - llvm::PointerType::get(ty, getContext().getTargetAddressSpace(type)); - - - // Check for an existing global value with this name. - llvm::GlobalValue *entry = GetGlobalValue(mangledName); - if (entry) - return llvm::ConstantExpr::getBitCast(entry, pty); - - // If we're creating something with function type, go ahead and - // create a function. - if (const llvm::FunctionType *fnty = dyn_cast<llvm::FunctionType>(ty)) { - llvm::Function *fn = llvm::Function::Create(fnty, - llvm::Function::ExternalLinkage, - mangledName, &getModule()); - return fn; - - // Otherwise, make a global variable. - } else { - llvm::GlobalVariable *var - = new llvm::GlobalVariable(getModule(), ty, false, - llvm::GlobalValue::ExternalLinkage, - 0, mangledName, 0, - false, pty->getAddressSpace()); - if (isa<VarDecl>(decl) && cast<VarDecl>(decl)->isThreadSpecified()) - var->setThreadLocal(true); - return var; - } -} - /// CreateRuntimeVariable - Create a new runtime global variable with the /// specified type and name. llvm::Constant * |