diff options
author | Reid Kleckner <reid@kleckner.net> | 2013-07-22 13:07:10 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2013-07-22 13:07:10 +0000 |
commit | f6ce2b5f2e6ab7a01b61f68393c1bf6bd9a49909 (patch) | |
tree | 11dd75806405107bdb704e2771ff03ec1bd9e513 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 5f08421e2d7adc98b358379850e393cc7f446e5b (diff) | |
download | bcm5719-llvm-f6ce2b5f2e6ab7a01b61f68393c1bf6bd9a49909.tar.gz bcm5719-llvm-f6ce2b5f2e6ab7a01b61f68393c1bf6bd9a49909.zip |
Rename D to GD to match the type, which is GlobalDecl
Now we can save GD.getDecl() in D and shorten some casts.
llvm-svn: 186826
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 53efaa6349f..078edebb965 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1328,13 +1328,15 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) { llvm::Constant * CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName, llvm::Type *Ty, - GlobalDecl D, bool ForVTable, + GlobalDecl GD, bool ForVTable, llvm::AttributeSet ExtraAttrs) { + const Decl *D = GD.getDecl(); + // Lookup the entry, lazily creating it if necessary. llvm::GlobalValue *Entry = GetGlobalValue(MangledName); if (Entry) { if (WeakRefReferences.erase(Entry)) { - const FunctionDecl *FD = cast_or_null<FunctionDecl>(D.getDecl()); + const FunctionDecl *FD = cast_or_null<FunctionDecl>(D); if (FD && !FD->hasAttr<WeakAttr>()) Entry->setLinkage(llvm::Function::ExternalLinkage); } @@ -1363,8 +1365,8 @@ CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName, llvm::Function::ExternalLinkage, MangledName, &getModule()); assert(F->getName() == MangledName && "name was uniqued!"); - if (D.getDecl()) - SetFunctionAttributes(D, F, IsIncompleteFunction); + if (D) + SetFunctionAttributes(GD, F, IsIncompleteFunction); if (ExtraAttrs.hasAttributes(llvm::AttributeSet::FunctionIndex)) { llvm::AttrBuilder B(ExtraAttrs, llvm::AttributeSet::FunctionIndex); F->addAttributes(llvm::AttributeSet::FunctionIndex, @@ -1394,18 +1396,18 @@ CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName, // // We also don't emit a definition for a function if it's going to be an entry // in a vtable, unless it's already marked as used. - } else if (getLangOpts().CPlusPlus && D.getDecl()) { + } else if (getLangOpts().CPlusPlus && D) { // Look for a declaration that's lexically in a record. - const FunctionDecl *FD = cast<FunctionDecl>(D.getDecl()); + const FunctionDecl *FD = cast<FunctionDecl>(D); FD = FD->getMostRecentDecl(); do { if (isa<CXXRecordDecl>(FD->getLexicalDeclContext())) { if (FD->isImplicit() && !ForVTable) { assert(FD->isUsed() && "Sema didn't mark implicit function as used!"); - DeferredDeclsToEmit.push_back(D.getWithDecl(FD)); + DeferredDeclsToEmit.push_back(GD.getWithDecl(FD)); break; } else if (FD->doesThisDeclarationHaveABody()) { - DeferredDeclsToEmit.push_back(D.getWithDecl(FD)); + DeferredDeclsToEmit.push_back(GD.getWithDecl(FD)); break; } } |