From: Reid Kleckner Date: Mon, 22 Jul 2013 13:07:10 +0000 (+0000) Subject: Rename D to GD to match the type, which is GlobalDecl X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73701ea646d067e5d26e83a95ae0e610f0e665ca;p=clang Rename D to GD to match the type, which is GlobalDecl Now we can save GD.getDecl() in D and shorten some casts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186826 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 53efaa6349..078edebb96 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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(D.getDecl()); + const FunctionDecl *FD = cast_or_null(D); if (FD && !FD->hasAttr()) 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(D.getDecl()); + const FunctionDecl *FD = cast(D); FD = FD->getMostRecentDecl(); do { if (isa(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; } }