0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
src
util
query_driver_output_extractor.h
Go to the documentation of this file.
1
/**
2
* @file src/util/query_driver_include_extractor.h
3
*
4
* Copyright (c) 2021-2025 Bartek Kryza <bkryza@gmail.com>
5
*
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
#pragma once
19
20
#include <stdexcept>
21
#include <string>
22
#include <vector>
23
24
namespace
clanguml::util
{
25
26
/**
27
* @brief Executed compiler frontend and extract default system paths
28
*
29
* This class - inspired by the `clangd` language server - will invoke the
30
* provided compiler command and query it for its default system paths,
31
* which then will be added to each compile command in the database.
32
*/
33
class
query_driver_output_extractor
{
34
public
:
35
/**
36
* @brief Constructor.
37
*
38
* @param command Command to execute the compiler frontend
39
* @param language Language name to query for (C or C++)
40
*/
41
query_driver_output_extractor
(std::string command, std::string language);
42
43
~query_driver_output_extractor
() =
default
;
44
45
/**
46
* @brief Execute the command and extract compiler flags and include paths
47
*/
48
void
execute
();
49
50
/**
51
* @brief Extract target name from the compiler output
52
*
53
* @param output Compiler query driver output
54
*/
55
void
extract_target
(
const
std::string &output);
56
57
/**
58
* @brief Extract system include paths from the compiler output
59
*
60
* @param output Compiler query driver output
61
*/
62
void
extract_system_include_paths
(
const
std::string &output);
63
64
/**
65
* @brief Name of the target of the compiler command (e.g. x86_64-linux-gnu)
66
*
67
* @return Target name
68
*/
69
const
std::string &
target
()
const
;
70
71
/**
72
* @brief Return list of include system paths
73
*
74
* @return List of include system paths
75
*/
76
const
std::vector<std::string> &
system_include_paths
()
const
;
77
78
private
:
79
std::string
command_
;
80
std::string
language_
;
81
std::string
target_
;
82
std::vector<std::string>
system_include_paths_
;
83
};
84
}
// namespace clanguml::util
Copyright © 2022-present
Bartek Kryza
Generated by
1.9.7