@@ -49,11 +49,11 @@ void test_raw_codegen()
49
49
clang::CodeGenOptions &cgopt = ci.getCodeGenOpts ();
50
50
51
51
llvm::DataLayout dlo (" hehhe" );
52
- clang::CodeGen::CodeGenModule cgmod (astctx, cgopt, mod, dlo, diag);
52
+ // clang::CodeGen::CodeGenModule cgmod(astctx, cgopt, mod, dlo, diag);
53
53
54
- cgmod.EmitAnnotationString (" hhhh" );
54
+ // cgmod.EmitAnnotationString("hhhh");
55
55
56
- clang::CodeGen::CodeGenFunction cgf (cgmod);
56
+ // clang::CodeGen::CodeGenFunction cgf(cgmod);
57
57
}
58
58
59
59
@@ -697,7 +697,9 @@ llvm::Module* CompilerEngine::conv_ctor(clang::ASTContext &ctx, clang::CXXConstr
697
697
698
698
// llvm::DataLayout dlo("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
699
699
llvm::DataLayout dlo (ctx.getTargetInfo ().getTargetDescription ());
700
- clang::CodeGen::CodeGenModule cgmod (ctx, cgopt, *mod, dlo, diag);
700
+ clang::HeaderSearchOptions headersearchopts;
701
+ clang::PreprocessorOptions ppopts;
702
+ clang::CodeGen::CodeGenModule cgmod (ctx, headersearchopts, ppopts, cgopt, *mod, dlo, diag);
701
703
auto &cgtypes = cgmod.getTypes ();
702
704
auto cgf = new clang::CodeGen::CodeGenFunction (cgmod);
703
705
@@ -804,7 +806,9 @@ llvm::Module* CompilerEngine::conv_method(clang::ASTContext &ctx, clang::CXXMeth
804
806
805
807
// llvm::DataLayout dlo("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
806
808
llvm::DataLayout dlo (ctx.getTargetInfo ().getTargetDescription ());
807
- clang::CodeGen::CodeGenModule cgmod (ctx, cgopt, *mod, dlo, diag);
809
+ clang::HeaderSearchOptions headersearchopts;
810
+ clang::PreprocessorOptions ppopts;
811
+ clang::CodeGen::CodeGenModule cgmod (ctx, headersearchopts, ppopts, cgopt, *mod, dlo, diag);
808
812
auto &cgtypes = cgmod.getTypes ();
809
813
auto cgf = new clang::CodeGen::CodeGenFunction (cgmod);
810
814
@@ -926,7 +930,9 @@ QString CompilerEngine::mangle_ctor(clang::ASTContext &ctx, clang::CXXConstructo
926
930
927
931
// llvm::DataLayout dlo("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
928
932
llvm::DataLayout dlo (ctx.getTargetInfo ().getTargetDescription ());
929
- clang::CodeGen::CodeGenModule cgmod (ctx, cgopt, *mod, dlo, diag);
933
+ clang::HeaderSearchOptions headersearchopts;
934
+ clang::PreprocessorOptions ppopts;
935
+ clang::CodeGen::CodeGenModule cgmod (ctx, headersearchopts, ppopts, cgopt, *mod, dlo, diag);
930
936
auto &cgtypes = cgmod.getTypes ();
931
937
auto cgf = new clang::CodeGen::CodeGenFunction (cgmod);
932
938
@@ -952,7 +958,9 @@ QString CompilerEngine::mangle_dtor(clang::ASTContext &ctx, clang::CXXDestructor
952
958
953
959
// llvm::DataLayout dlo("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
954
960
llvm::DataLayout dlo (ctx.getTargetInfo ().getTargetDescription ());
955
- clang::CodeGen::CodeGenModule cgmod (ctx, cgopt, *mod, dlo, diag);
961
+ clang::HeaderSearchOptions headersearchopts;
962
+ clang::PreprocessorOptions ppopts;
963
+ clang::CodeGen::CodeGenModule cgmod (ctx, headersearchopts, ppopts, cgopt, *mod, dlo, diag);
956
964
auto &cgtypes = cgmod.getTypes ();
957
965
auto cgf = new clang::CodeGen::CodeGenFunction (cgmod);
958
966
@@ -978,7 +986,9 @@ QString CompilerEngine::mangle_method(clang::ASTContext &ctx, clang::CXXMethodDe
978
986
979
987
// llvm::DataLayout dlo("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
980
988
llvm::DataLayout dlo (ctx.getTargetInfo ().getTargetDescription ());
981
- clang::CodeGen::CodeGenModule cgmod (ctx, cgopt, *mod, dlo, diag);
989
+ clang::HeaderSearchOptions headersearchopts;
990
+ clang::PreprocessorOptions ppopts;
991
+ clang::CodeGen::CodeGenModule cgmod (ctx, headersearchopts, ppopts, cgopt, *mod, dlo, diag);
982
992
auto &cgtypes = cgmod.getTypes ();
983
993
auto cgf = new clang::CodeGen::CodeGenFunction (cgmod);
984
994
@@ -2059,7 +2069,10 @@ CompilerEngine::createCompilerUnit(clang::ASTUnit *unit, clang::NamedDecl *decl)
2059
2069
// llvm::DataLayout dlo("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
2060
2070
llvm::DataLayout *pdlo = new llvm::DataLayout (ctx.getTargetInfo ().getTargetDescription ());
2061
2071
auto &dlo = *pdlo;
2062
- cu->mcgm = new clang::CodeGen::CodeGenModule (ctx, cgopt, *cu->mmod , dlo, diag);
2072
+ clang::HeaderSearchOptions headersearchopts;
2073
+ clang::PreprocessorOptions ppopts;
2074
+ cu->mcgm = new clang::CodeGen::CodeGenModule (ctx, headersearchopts, ppopts, cgopt, *cu->mmod , dlo, diag);
2075
+ // cu->mcgm = new clang::CodeGen::CodeGenModule(ctx, cgopt, *cu->mmod, dlo, diag);
2063
2076
cu->mcgf = new clang::CodeGen::CodeGenFunction (*cu->mcgm );
2064
2077
2065
2078
//
@@ -2127,13 +2140,16 @@ bool CompilerEngine::tryCompile(clang::CXXRecordDecl *decl, clang::ASTContext &c
2127
2140
2128
2141
clang::ExternalASTSource *eas = ctx.getExternalSource ();
2129
2142
2130
- clang::CodeGenerator *cgtor = clang::CreateLLVMCodeGen (diag, " testmm" , cgopt, tgopt, vmctx);
2143
+ clang::HeaderSearchOptions HeaderSearchOpts;
2144
+ clang::PreprocessorOptions PreprocessorOpts;
2145
+ clang::CodeGenerator *cgtor =
2146
+ clang::CreateLLVMCodeGen (diag, " testmm" , HeaderSearchOpts, PreprocessorOpts, cgopt, vmctx);
2131
2147
qDebug ()<<cgtor<<eas;
2132
2148
2133
2149
2134
2150
cgtor->Initialize (ctx);
2135
2151
cgtor->HandleTranslationUnit (ctx);
2136
- cgtor->HandleVTable (decl, true );
2152
+ cgtor->HandleVTable (decl);
2137
2153
cgtor->HandleTagDeclDefinition (decl);
2138
2154
2139
2155
int cnter = 0 ;
@@ -2159,7 +2175,9 @@ bool CompilerEngine::tryCompile(clang::CXXRecordDecl *decl, clang::ASTContext &c
2159
2175
2160
2176
std::string stmc;
2161
2177
llvm::raw_string_ostream stmo (stmc);
2162
- clang::EmitBackendOutput (diag, cgopt, tgopt, lgopt, " thisok" , mod, clang::Backend_EmitLL, &stmo);
2178
+ llvm::buffer_ostream bufstm (stmo);
2179
+ // clang::EmitBackendOutput(diag, cgopt, tgopt, lgopt, "thisok", mod, clang::Backend_EmitLL, &stmo);
2180
+ clang::EmitBackendOutput (diag, cgopt, tgopt, lgopt, " thisok" , mod, clang::Backend_EmitLL, &bufstm);
2163
2181
/*
2164
2182
void EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts,
2165
2183
const TargetOptions &TOpts, const LangOptions &LOpts,
@@ -2322,7 +2340,9 @@ bool CompilerEngine::tryCompile2(clang::CXXRecordDecl *decl, clang::ASTContext &
2322
2340
// llvm::DataLayout dlo("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
2323
2341
llvm::DataLayout dlo (ctx.getTargetInfo ().getTargetDescription ());
2324
2342
qDebug ()<<" heeeeee..." ;
2325
- clang::CodeGen::CodeGenModule cgmod (ctx, cgopt, mod, dlo, diag);
2343
+ clang::HeaderSearchOptions headersearchopts;
2344
+ clang::PreprocessorOptions ppopts;
2345
+ clang::CodeGen::CodeGenModule cgmod (ctx, headersearchopts, ppopts, cgopt, mod, dlo, diag);
2326
2346
2327
2347
// cgmod.EmitAnnotationString("hhhh");
2328
2348
@@ -2619,13 +2639,6 @@ void testGenerateCode(clang::CodeGen::CodeGenModule &CGM, clang::GlobalDecl GD,
2619
2639
// Emit the standard function prologue.
2620
2640
// StartFunction(GD, ResTy, Fn, FnInfo, Args, Loc, BodyRange.getBegin());
2621
2641
2622
- FunctionDecl *UnsizedDealloc =
2623
- FD->getCorrespondingUnsizedGlobalDeallocationFunction ();
2624
- bool ok = (UnsizedDealloc != NULL );
2625
- qDebug ()<<UnsizedDealloc<<ok;
2626
- if (UnsizedDealloc) {
2627
- qDebug ()<<" error match if" ;
2628
- }
2629
2642
// Generate the body of the function.
2630
2643
// PGO.assignRegionCounters(GD.getDecl(), CurFn);
2631
2644
if (isa<CXXDestructorDecl>(FD)) {
@@ -2664,13 +2677,6 @@ void testGenerateCode(clang::CodeGen::CodeGenModule &CGM, clang::GlobalDecl GD,
2664
2677
// EmitFunctionBody(Args, Body);
2665
2678
qDebug ()<<" hhhhhhhhhhh" ;
2666
2679
// } else if (UnsizedDealloc != NULL) {
2667
- } else if (FunctionDecl *UnsizedDealloc =
2668
- FD->getCorrespondingUnsizedGlobalDeallocationFunction ()) {
2669
- // Global sized deallocation functions get an implicit weak definition if
2670
- // they don't have an explicit definition.
2671
- // EmitSizedDeallocationFunction(*this, UnsizedDealloc);
2672
- // EmitSizedDeallocationFunction(CGM, UnsizedDealloc);
2673
- qDebug ()<<" why hereeeeeeeeee" <<UnsizedDealloc<<(UnsizedDealloc != NULL );
2674
2680
} else {
2675
2681
qDebug ()<<" hhhhhhhhhhh" ;
2676
2682
llvm_unreachable (" no definition for emitted function" );
@@ -2763,13 +2769,14 @@ bool CompilerEngine::tryCompile_tpl(clang::ClassTemplateDecl *decl, clang::ASTCo
2763
2769
2764
2770
// llvm::DataLayout dlo("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128");
2765
2771
llvm::DataLayout dlo (ctx.getTargetInfo ().getTargetDescription ());
2766
-
2767
- clang::CodeGen::CodeGenModule cgmod (ctx, cgopt, mod, dlo, diag);
2772
+ clang::HeaderSearchOptions HeaderSearchOpts;
2773
+ clang::PreprocessorOptions PreprocessorOpts;
2774
+ clang::CodeGen::CodeGenModule cgmod (ctx, HeaderSearchOpts, PreprocessorOpts, cgopt, mod, dlo, diag);
2768
2775
2769
2776
qDebug ()<<" heeeeee..." ;
2770
2777
clang::CodeGen::CodeGenFunction cgf (cgmod, false );
2771
2778
2772
- qDebug ()<<cgmod.getMangledName (mthdecl).data ();
2779
+ // qDebug()<<cgmod.getMangledName(mthdecl).data();
2773
2780
auto mgctx = ctx.createMangleContext ();
2774
2781
std::string stms;
2775
2782
llvm::raw_string_ostream stmo (stms);
@@ -2823,7 +2830,7 @@ bool CompilerEngine::tryCompile_tpl(clang::ClassTemplateDecl *decl, clang::ASTCo
2823
2830
qDebug ()<<cnter++<<sd;
2824
2831
int jcnter = 0 ;
2825
2832
auto &al = sd->getTemplateArgs ();
2826
- for (int j = 0 ; j < al.size (); j++) {
2833
+ for (unsigned int j = 0 ; j < al.size (); j++) {
2827
2834
qDebug ()<<jcnter++<<al.get (j).getAsType ().getAsString ().data ();
2828
2835
QString tplat = al.get (j).getAsType ().getAsString ().data ();
2829
2836
if (tplat == " char" ) {
@@ -2897,7 +2904,7 @@ bool CompilerEngine::tryCompile_tpl(clang::ClassTemplateDecl *decl, clang::ASTCo
2897
2904
// Ty = getTypes().ConvertType(cast<ValueDecl>(GD.getDecl())->getType());
2898
2905
// cgtypes.ConvertType(clang::cast<clang::ValueDecl>(td)->getType());
2899
2906
qDebug ()<<cgm.getMangledName (clang::GlobalDecl (td)).data ();
2900
- qDebug ()<<td<<td->getCorrespondingUnsizedGlobalDeallocationFunction ()
2907
+ qDebug ()<<td // <<td->getCorrespondingUnsizedGlobalDeallocationFunction()
2901
2908
<<td->isLambdaStaticInvoker ()<<td->isInstance (); // 0x12345, 0x0, false
2902
2909
cgf.GenerateCode (td, f, FI);
2903
2910
// testGenerateCode(cgm, clang::GlobalDecl(td), f, FI);
0 commit comments