File tree Expand file tree Collapse file tree 6 files changed +14
-23
lines changed Expand file tree Collapse file tree 6 files changed +14
-23
lines changed Original file line number Diff line number Diff line change @@ -534,7 +534,6 @@ fs::path BuildDatabase::newDirForFile(const fs::path &file) const {
534
534
}
535
535
536
536
CollectionUtils::FileSet BuildDatabase::getSourceFilesForTarget (const fs::path &_target) {
537
- LOG_IF_S (WARNING, !hasAutoTarget () && getTargetPath () != _target.c_str ()) << " Try get sources for different target" ;
538
537
return CollectionUtils::transformTo<CollectionUtils::FileSet>(
539
538
getArchiveObjectFiles (_target),
540
539
[this ](fs::path const &objectPath) {
Original file line number Diff line number Diff line change @@ -212,11 +212,11 @@ class BuildDatabase {
212
212
*/
213
213
std::vector<std::shared_ptr<ObjectFileInfo>> getAllCompileCommands () const ;
214
214
215
- std::vector<std::shared_ptr<TargetInfo>> getRootTargets () const ;
215
+ virtual std::vector<std::shared_ptr<TargetInfo>> getRootTargets () const ;
216
216
217
- std::vector<std::shared_ptr<TargetInfo>> getAllTargets () const ;
217
+ virtual std::vector<std::shared_ptr<TargetInfo>> getAllTargets () const ;
218
218
219
- std::vector<fs::path> getAllTargetPaths () const ;
219
+ virtual std::vector<fs::path> getAllTargetPaths () const ;
220
220
221
221
virtual std::vector<fs::path> getTargetPathsForSourceFile (const fs::path &sourceFilePath) const ;
222
222
@@ -228,10 +228,6 @@ class BuildDatabase {
228
228
229
229
std::shared_ptr<TargetInfo> getTargetInfo (const fs::path &_target);
230
230
231
- virtual bool hasAutoTarget () const = 0;
232
-
233
- virtual fs::path getTargetPath () const = 0;
234
-
235
231
std::shared_ptr<CompilationDatabase> compilationDatabase;
236
232
237
233
protected:
Original file line number Diff line number Diff line change @@ -20,10 +20,6 @@ class ProjectBuildDatabase : public BuildDatabase {
20
20
utbot::ProjectContext _projectContext);
21
21
22
22
static std::shared_ptr<ProjectBuildDatabase> create (const utbot::ProjectContext &projectContext);
23
-
24
- bool hasAutoTarget () const override ;
25
-
26
- fs::path getTargetPath () const override ;
27
23
};
28
24
29
25
Original file line number Diff line number Diff line change @@ -233,12 +233,3 @@ void ProjectBuildDatabase::fillTargetInfoParents() {
233
233
targetInfos[library]->parentLinkUnits = std::move (parents);
234
234
}
235
235
}
236
-
237
-
238
- bool ProjectBuildDatabase::hasAutoTarget () const {
239
- return true ;
240
- }
241
-
242
- fs::path ProjectBuildDatabase::getTargetPath () const {
243
- throw CompilationDatabaseException (" Incorrect method for project build database" );
244
- }
Original file line number Diff line number Diff line change @@ -51,6 +51,13 @@ std::shared_ptr<TargetBuildDatabase> TargetBuildDatabase::createForSourceOrTarge
51
51
return std::make_shared<TargetBuildDatabase>(std::move (TargetBuildDatabase (baseBuildDatabase, _target)));
52
52
}
53
53
54
+ std::vector<std::shared_ptr<BuildDatabase::TargetInfo>> TargetBuildDatabase::getRootTargets () const {
55
+ if (!hasAutoTarget ()) {
56
+ return {targetInfos.at (target)};
57
+ }
58
+ return BuildDatabase::getRootTargets ();
59
+ }
60
+
54
61
std::vector<fs::path> TargetBuildDatabase::getTargetPathsForSourceFile (const fs::path &sourceFilePath) const {
55
62
if (!hasAutoTarget ()) {
56
63
return {target};
Original file line number Diff line number Diff line change @@ -14,9 +14,11 @@ class TargetBuildDatabase : public BuildDatabase {
14
14
static std::shared_ptr<TargetBuildDatabase> createForSourceOrTarget (BuildDatabase *baseBuildDatabase,
15
15
const std::string &_targetOrSourcePath);
16
16
17
- bool hasAutoTarget () const override ;
17
+ bool hasAutoTarget () const ;
18
18
19
- fs::path getTargetPath () const override ;
19
+ fs::path getTargetPath () const ;
20
+
21
+ std::vector<std::shared_ptr<TargetInfo>> getRootTargets () const override ;
20
22
21
23
std::vector<fs::path> getTargetPathsForSourceFile (const fs::path &sourceFilePath) const override ;
22
24
You can’t perform that action at this time.
0 commit comments