]> granicus.if.org Git - clang/commitdiff
Simplify the constructor to CodeGenABITypes.
authorMark Lacey <mark.lacey@apple.com>
Thu, 5 Dec 2013 01:23:01 +0000 (01:23 +0000)
committerMark Lacey <mark.lacey@apple.com>
Thu, 5 Dec 2013 01:23:01 +0000 (01:23 +0000)
The CodeGenOptions are not used for ABI type selection, so we will just
create one with the default constructor (there is a FloatABI option in
CodeGenOptions that is passed on to LLVM, but not used in Clang for LLVM
IR type generation).

We can use the DiagnosticsEngine on the ASTContext rather than making a
client pass one in explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196450 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/CodeGen/CodeGenABITypes.h
lib/CodeGen/CodeGenABITypes.cpp

index 81e2cdc1901b19d38d9f6f412a5c6ff10a269b58..0cefef3d57ac007b83b670aac99b76137140066e 100644 (file)
@@ -47,10 +47,7 @@ class CodeGenModule;
 class CodeGenABITypes
 {
 public:
-  CodeGenABITypes(ASTContext &C, const CodeGenOptions &CodeGenOpts,
-                  llvm::Module &M, const llvm::DataLayout &TD,
-                  DiagnosticsEngine &Diags);
-
+  CodeGenABITypes(ASTContext &C, llvm::Module &M, const llvm::DataLayout &TD);
   ~CodeGenABITypes();
 
   /// These methods all forward to methods in the private implementation class
@@ -71,6 +68,12 @@ public:
                                          RequiredArgs args);
 
 private:
+  /// Default CodeGenOptions object used to initialize the
+  /// CodeGenModule and otherwise not used. More specifically, it is
+  /// not used in ABI type generation, so none of the options matter.
+  CodeGenOptions *CGO;
+
+  /// The CodeGenModule we use get to the CodeGenTypes object.
   CodeGen::CodeGenModule *CGM;
 };
 
index 18c836cf2f4cafafa25eb7381d762b490fdc22e8..d78b47bfb61f99a37532d54f3ce2919298b60053 100644 (file)
 #include "clang/CodeGen/CodeGenABITypes.h"
 
 #include "clang/CodeGen/CGFunctionInfo.h"
+#include "clang/Frontend/CodeGenOptions.h"
 #include "CodeGenModule.h"
 
 using namespace clang;
 using namespace CodeGen;
 
 CodeGenABITypes::CodeGenABITypes(ASTContext &C,
-                                 const CodeGenOptions &CodeGenOpts,
                                  llvm::Module &M,
-                                 const llvm::DataLayout &TD,
-                                 DiagnosticsEngine &Diags)
-  : CGM(new CodeGen::CodeGenModule(C, CodeGenOpts, M, TD, Diags)) {
+                                 const llvm::DataLayout &TD)
+  : CGO(new CodeGenOptions),
+    CGM(new CodeGen::CodeGenModule(C, *CGO, M, TD, C.getDiagnostics())) {
 }
 
 CodeGenABITypes::~CodeGenABITypes()
 {
+  delete CGO;
   delete CGM;
 }