@@ -116,7 +116,7 @@ namespace printer {
116
116
}
117
117
118
118
NativeMakefilePrinter::NativeMakefilePrinter (
119
- const BaseTestGen& testGen,
119
+ const BaseTestGen* testGen,
120
120
fs::path const &rootPath,
121
121
fs::path primaryCompiler,
122
122
CollectionUtils::FileSet const *stubSources,
@@ -135,7 +135,7 @@ namespace printer {
135
135
CompilationUtils::getCoverageLinkFlags (primaryCxxCompilerName), " ")),
136
136
sanitizerLinkFlags(SanitizerUtils::getSanitizeLinkFlags(primaryCxxCompilerName)),
137
137
138
- buildDirectory(Paths::getUtbotBuildDir(testGen. projectContext)),
138
+ buildDirectory(Paths::getUtbotBuildDir(testGen-> projectContext)),
139
139
dependencyDirectory(buildDirectory / " dependencies" ),
140
140
stubSources(stubSources) {
141
141
@@ -164,13 +164,13 @@ namespace printer {
164
164
}
165
165
166
166
fs::path NativeMakefilePrinter::getTemporaryDependencyFile (fs::path const &file) {
167
- fs::path relativePath = fs::relative (file, testGen. projectContext .projectPath );
167
+ fs::path relativePath = fs::relative (file, testGen-> projectContext .projectPath );
168
168
return getRelativePath (dependencyDirectory) /
169
169
Paths::addExtension (relativePath, " .Td" );
170
170
}
171
171
172
172
fs::path NativeMakefilePrinter::getDependencyFile (fs::path const &file) {
173
- fs::path relativePath = fs::relative (file, testGen. projectContext .projectPath );
173
+ fs::path relativePath = fs::relative (file, testGen-> projectContext .projectPath );
174
174
return getRelativePath (dependencyDirectory) /
175
175
Paths::addExtension (relativePath, " .d" );
176
176
}
@@ -270,25 +270,25 @@ namespace printer {
270
270
BuildResult NativeMakefilePrinter::addObjectFile (const fs::path &objectFile,
271
271
const std::string &suffixForParentOfStubs) {
272
272
273
- auto compilationUnitInfo = testGen. getClientCompilationUnitInfo (objectFile);
273
+ auto compilationUnitInfo = testGen-> getClientCompilationUnitInfo (objectFile);
274
274
fs::path sourcePath = compilationUnitInfo->getSourcePath ();
275
275
276
276
fs::path pathToCompile;
277
277
fs::path recompiledFile;
278
278
BuildResult::Type buildResultType;
279
279
BuildResult buildResult;
280
280
if (CollectionUtils::contains (*stubSources, sourcePath)) {
281
- pathToCompile = Paths::sourcePathToStubPath (testGen. projectContext , sourcePath);
282
- recompiledFile = Paths::getRecompiledFile (testGen. projectContext , pathToCompile);
281
+ pathToCompile = Paths::sourcePathToStubPath (testGen-> projectContext , sourcePath);
282
+ recompiledFile = Paths::getRecompiledFile (testGen-> projectContext , pathToCompile);
283
283
buildResultType = BuildResult::Type::ALL_STUBS;
284
284
} else {
285
285
if (Paths::isCXXFile (sourcePath)) {
286
286
pathToCompile = sourcePath;
287
287
} else {
288
- pathToCompile = Paths::getWrapperFilePath (testGen. projectContext , sourcePath);
288
+ pathToCompile = Paths::getWrapperFilePath (testGen-> projectContext , sourcePath);
289
289
}
290
290
recompiledFile =
291
- Paths::getRecompiledFile (testGen. projectContext , compilationUnitInfo->getOutputFile ());
291
+ Paths::getRecompiledFile (testGen-> projectContext , compilationUnitInfo->getOutputFile ());
292
292
buildResultType = BuildResult::Type::NO_STUBS;
293
293
}
294
294
@@ -299,7 +299,7 @@ namespace printer {
299
299
}
300
300
301
301
void NativeMakefilePrinter::addTestTarget (const fs::path &sourcePath) {
302
- auto compilationUnitInfo = testGen. getClientCompilationUnitInfo (sourcePath);
302
+ auto compilationUnitInfo = testGen-> getClientCompilationUnitInfo (sourcePath);
303
303
auto testCompilationCommand = compilationUnitInfo->command ;
304
304
testCompilationCommand.setBuildTool (getRelativePathForLinker (primaryCxxCompiler));
305
305
testCompilationCommand.setOptimizationLevel (OPTIMIZATION_FLAG);
@@ -314,10 +314,10 @@ namespace printer {
314
314
testCompilationCommand.addFlagToBegin (FPIC_FLAG);
315
315
testCompilationCommand.addFlagsToBegin (SANITIZER_NEEDED_FLAGS);
316
316
317
- fs::path testSourcePath = Paths::sourcePathToTestPath (testGen. projectContext , sourcePath);
317
+ fs::path testSourcePath = Paths::sourcePathToTestPath (testGen-> projectContext , sourcePath);
318
318
fs::path compilationDirectory = compilationUnitInfo->getDirectory ();
319
- fs::path testObjectDir = Paths::getTestObjectDir (testGen. projectContext );
320
- fs::path testSourceRelativePath = fs::relative (testSourcePath, testGen. projectContext .testDirPath );
319
+ fs::path testObjectDir = Paths::getTestObjectDir (testGen-> projectContext );
320
+ fs::path testSourceRelativePath = fs::relative (testSourcePath, testGen-> projectContext .testDirPath );
321
321
fs::path testObjectPathRelative = getRelativePath (
322
322
testObjectDir / Paths::addExtension (testSourceRelativePath, " .o" ));
323
323
testCompilationCommand.setOutput (
@@ -332,7 +332,7 @@ namespace printer {
332
332
333
333
artifacts.push_back (testCompilationCommand.getOutput ());
334
334
335
- auto rootLinkUnitInfo = testGen. getTargetBuildDatabase ()->getClientLinkUnitInfo (rootPath);
335
+ auto rootLinkUnitInfo = testGen-> getTargetBuildDatabase ()->getClientLinkUnitInfo (rootPath);
336
336
fs::path testExecutablePath = getTestExecutablePath (sourcePath);
337
337
338
338
std::vector<std::string> filesToLink{ " $(GTEST_MAIN)" , " $(GTEST_ALL)" , testCompilationCommand.getOutput (),
@@ -399,7 +399,7 @@ namespace printer {
399
399
}
400
400
fs::path NativeMakefilePrinter::getTestExecutablePath (const fs::path &sourcePath) const {
401
401
return Paths::removeExtension (
402
- Paths::removeExtension (Paths::getRecompiledFile (testGen. projectContext , sourcePath)));
402
+ Paths::removeExtension (Paths::getRecompiledFile (testGen-> projectContext , sourcePath)));
403
403
}
404
404
405
405
NativeMakefilePrinter::NativeMakefilePrinter (const NativeMakefilePrinter &baseMakefilePrinter,
@@ -426,7 +426,7 @@ namespace printer {
426
426
427
427
fs::path testExecutablePath = getTestExecutablePath (sourcePath);
428
428
429
- auto rootLinkUnitInfo = testGen. getTargetBuildDatabase ()->getClientLinkUnitInfo (rootPath);
429
+ auto rootLinkUnitInfo = testGen-> getTargetBuildDatabase ()->getClientLinkUnitInfo (rootPath);
430
430
431
431
fs::path coverageInfoBinary = sharedOutput.value ();
432
432
if (!Paths::isLibraryFile (coverageInfoBinary)) {
@@ -468,7 +468,7 @@ namespace printer {
468
468
return buildResults[unitFile] = buildResult;
469
469
}
470
470
471
- auto linkUnitInfo = testGen. getTargetBuildDatabase ()->getClientLinkUnitInfo (unitFile);
471
+ auto linkUnitInfo = testGen-> getTargetBuildDatabase ()->getClientLinkUnitInfo (unitFile);
472
472
BuildResult::Type unitType = BuildResult::Type::NONE;
473
473
CollectionUtils::MapFileTo<fs::path> fileMapping;
474
474
auto unitBuildResults = CollectionUtils::transformTo<std::vector<BuildResult>>(
@@ -489,7 +489,7 @@ namespace printer {
489
489
bool isExecutable = !Paths::isLibraryFile (unitFile);
490
490
491
491
fs::path recompiledFile =
492
- Paths::getRecompiledFile (testGen. projectContext , linkUnitInfo->getOutput ());
492
+ Paths::getRecompiledFile (testGen-> projectContext , linkUnitInfo->getOutput ());
493
493
if (isExecutable && !transformExeToLib) {
494
494
recompiledFile = Paths::isObjectFile (recompiledFile) ?
495
495
recompiledFile : Paths::addExtension (recompiledFile, " .o" );
@@ -529,9 +529,9 @@ namespace printer {
529
529
getLibraryAbsolutePath (argument, linkCommand.getDirectory ());
530
530
if (optionalLibraryAbsolutePath.has_value ()) {
531
531
const fs::path &absolutePath = optionalLibraryAbsolutePath.value ();
532
- if (Paths::isSubPathOf (testGen. projectContext .buildDir (), absolutePath)) {
532
+ if (Paths::isSubPathOf (testGen-> projectContext .buildDir (), absolutePath)) {
533
533
fs::path recompiledDir =
534
- Paths::getRecompiledFile (testGen. projectContext , absolutePath);
534
+ Paths::getRecompiledFile (testGen-> projectContext , absolutePath);
535
535
std::string directoryFlag = getLibraryDirectoryFlag (recompiledDir);
536
536
libraryDirectoriesFlags.push_back (directoryFlag);
537
537
}
@@ -613,11 +613,11 @@ namespace printer {
613
613
void NativeMakefilePrinter::addStubs (const CollectionUtils::FileSet &stubsSet) {
614
614
auto stubObjectFiles = CollectionUtils::transformTo<CollectionUtils::FileSet>(
615
615
Synchronizer::dropHeaders (stubsSet), [this ](fs::path const &stub) {
616
- fs::path sourcePath = Paths::stubPathToSourcePath (testGen. projectContext , stub);
616
+ fs::path sourcePath = Paths::stubPathToSourcePath (testGen-> projectContext , stub);
617
617
fs::path stubBuildFilePath =
618
- Paths::getStubBuildFilePath (testGen. projectContext , sourcePath);
619
- auto compilationUnitInfo = testGen. getClientCompilationUnitInfo (sourcePath, true );
620
- fs::path target = Paths::getRecompiledFile (testGen. projectContext , stub);
618
+ Paths::getStubBuildFilePath (testGen-> projectContext , sourcePath);
619
+ auto compilationUnitInfo = testGen-> getClientCompilationUnitInfo (sourcePath, true );
620
+ fs::path target = Paths::getRecompiledFile (testGen-> projectContext , stub);
621
621
addCompileTarget (stub, target, *compilationUnitInfo);
622
622
return target;
623
623
});
0 commit comments