فهرست منبع

Cleanup setFunctionDefinitionAttributes.

Use more specific type, update comments and name style.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208328 91177308-0d34-0410-b5e6-96231b3b80d8
Rafael Espindola 11 سال پیش
والد
کامیت
c9727ea1c3
3فایلهای تغییر یافته به همراه10 افزوده شده و 15 حذف شده
  1. 2 2
      lib/CodeGen/CGCXX.cpp
  2. 5 10
      lib/CodeGen/CodeGenModule.cpp
  3. 3 3
      lib/CodeGen/CodeGenModule.h

+ 2 - 2
lib/CodeGen/CGCXX.cpp

@@ -217,7 +217,7 @@ void CodeGenModule::EmitCXXConstructor(const CXXConstructorDecl *ctor,
 
 
   CodeGenFunction(*this).GenerateCode(GlobalDecl(ctor, ctorType), fn, fnInfo);
   CodeGenFunction(*this).GenerateCode(GlobalDecl(ctor, ctorType), fn, fnInfo);
 
 
-  SetFunctionDefinitionAttributes(ctor, fn);
+  setFunctionDefinitionAttributes(ctor, fn);
   SetLLVMFunctionAttributesForDefinition(ctor, fn);
   SetLLVMFunctionAttributesForDefinition(ctor, fn);
 }
 }
 
 
@@ -274,7 +274,7 @@ void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *dtor,
 
 
   CodeGenFunction(*this).GenerateCode(GlobalDecl(dtor, dtorType), fn, fnInfo);
   CodeGenFunction(*this).GenerateCode(GlobalDecl(dtor, dtorType), fn, fnInfo);
 
 
-  SetFunctionDefinitionAttributes(dtor, fn);
+  setFunctionDefinitionAttributes(dtor, fn);
   SetLLVMFunctionAttributesForDefinition(dtor, fn);
   SetLLVMFunctionAttributesForDefinition(dtor, fn);
 }
 }
 
 

+ 5 - 10
lib/CodeGen/CodeGenModule.cpp

@@ -594,14 +594,9 @@ CodeGenModule::getFunctionLinkage(GlobalDecl GD) {
                                      UseThunkForDtorVariant);
                                      UseThunkForDtorVariant);
 }
 }
 
 
-
-/// SetFunctionDefinitionAttributes - Set attributes for a global.
-///
-/// FIXME: This is currently only done for aliases and functions, but not for
-/// variables (these details are set in EmitGlobalVarDefinition for variables).
-void CodeGenModule::SetFunctionDefinitionAttributes(const FunctionDecl *D,
-                                                    llvm::GlobalValue *GV) {
-  setNonAliasAttributes(D, GV);
+void CodeGenModule::setFunctionDefinitionAttributes(const FunctionDecl *D,
+                                                    llvm::Function *F) {
+  setNonAliasAttributes(D, F);
 }
 }
 
 
 void CodeGenModule::SetLLVMFunctionAttributes(const Decl *D,
 void CodeGenModule::SetLLVMFunctionAttributes(const Decl *D,
@@ -2247,14 +2242,14 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD,
   llvm::Function *Fn = cast<llvm::Function>(GV);
   llvm::Function *Fn = cast<llvm::Function>(GV);
   setFunctionLinkage(GD, Fn);
   setFunctionLinkage(GD, Fn);
 
 
-  // FIXME: this is redundant with part of SetFunctionDefinitionAttributes
+  // FIXME: this is redundant with part of setFunctionDefinitionAttributes
   setGlobalVisibility(Fn, D);
   setGlobalVisibility(Fn, D);
 
 
   MaybeHandleStaticInExternC(D, Fn);
   MaybeHandleStaticInExternC(D, Fn);
 
 
   CodeGenFunction(*this).GenerateCode(D, Fn, FI);
   CodeGenFunction(*this).GenerateCode(D, Fn, FI);
 
 
-  SetFunctionDefinitionAttributes(D, Fn);
+  setFunctionDefinitionAttributes(D, Fn);
   SetLLVMFunctionAttributesForDefinition(D, Fn);
   SetLLVMFunctionAttributesForDefinition(D, Fn);
 
 
   if (const ConstructorAttr *CA = D->getAttr<ConstructorAttr>())
   if (const ConstructorAttr *CA = D->getAttr<ConstructorAttr>())

+ 3 - 3
lib/CodeGen/CodeGenModule.h

@@ -1061,9 +1061,9 @@ private:
 
 
   void setNonAliasAttributes(const Decl *D, llvm::GlobalValue *GV);
   void setNonAliasAttributes(const Decl *D, llvm::GlobalValue *GV);
 
 
-  /// SetFunctionDefinitionAttributes - Set attributes for a global definition.
-  void SetFunctionDefinitionAttributes(const FunctionDecl *D,
-                                       llvm::GlobalValue *GV);
+  /// Set attributes for a global definition.
+  void setFunctionDefinitionAttributes(const FunctionDecl *D,
+                                       llvm::Function *F);
 
 
   /// SetFunctionAttributes - Set function attributes for a function
   /// SetFunctionAttributes - Set function attributes for a function
   /// declaration.
   /// declaration.