BuildCache
ccc_analyzer_wrapper.hpp
1 //--------------------------------------------------------------------------------------------------
2 // Copyright (c) 2020 Marcus Geelnard
3 //
4 // This software is provided 'as-is', without any express or implied warranty. In no event will the
5 // authors be held liable for any damages arising from the use of this software.
6 //
7 // Permission is granted to anyone to use this software for any purpose, including commercial
8 // applications, and to alter it and redistribute it freely, subject to the following restrictions:
9 //
10 // 1. The origin of this software must not be misrepresented; you must not claim that you wrote
11 // the original software. If you use this software in a product, an acknowledgment in the
12 // product documentation would be appreciated but is not required.
13 //
14 // 2. Altered source versions must be plainly marked as such, and must not be misrepresented as
15 // being the original software.
16 //
17 // 3. This notice may not be removed or altered from any source distribution.
18 //--------------------------------------------------------------------------------------------------
19 
20 #ifndef BUILDCACHE_CCC_ANALYZER_WRAPPER_HPP_
21 #define BUILDCACHE_CCC_ANALYZER_WRAPPER_HPP_
22 
23 #include <wrappers/gcc_wrapper.hpp>
24 
25 namespace bcache {
30 public:
31  ccc_analyzer_wrapper_t(const file::exe_path_t& exe_path, const string_list_t& args);
32 
33  bool can_handle_command() override;
34 
35 private:
36  std::map<std::string, expected_file_t> get_build_files() override;
37  std::map<std::string, std::string> get_relevant_env_vars() override;
39 
40  static const int MAX_NUM_REPORTS = 10;
41  std::string m_report_paths[MAX_NUM_REPORTS];
42  file::tmp_file_t m_tmp_report_dir;
43 };
44 } // namespace bcache
45 
46 #endif // BUILDCACHE_CCC_ANALYZER_WRAPPER_HPP_
bcache::ccc_analyzer_wrapper_t::get_relevant_env_vars
std::map< std::string, std::string > get_relevant_env_vars() override
Get relevant environment variables for hashing.
Definition: ccc_analyzer_wrapper.cpp:66
bcache::file::exe_path_t
Path to an executable file.
Definition: file_utils.hpp:127
bcache::ccc_analyzer_wrapper_t
This is a wrapper for the scan-build ccc-analyzer (a Clang-based static analyzer).
Definition: ccc_analyzer_wrapper.hpp:29
bcache::ccc_analyzer_wrapper_t::can_handle_command
bool can_handle_command() override
Check if this class implements a wrapper for the given command.
Definition: ccc_analyzer_wrapper.cpp:35
bcache::file::tmp_file_t
A helper class for handling temporary files and directories.
Definition: file_utils.hpp:35
bcache::gcc_wrapper_t
A program wrapper for GCC and GCC-like C/C++ compilers.
Definition: gcc_wrapper.hpp:27
bcache::sys::run_result_t
Run results from an external command.
Definition: sys_utils.hpp:30
bcache
The top level namespace.
Definition: compressor.cpp:34
bcache::string_list_t
A convenient vector of strings container with support functions for program argument handling.
Definition: string_list.hpp:30
bcache::ccc_analyzer_wrapper_t::get_build_files
std::map< std::string, expected_file_t > get_build_files() override
Get the paths to the files that are to be generated by the command.
Definition: ccc_analyzer_wrapper.cpp:43
bcache::ccc_analyzer_wrapper_t::run_for_miss
sys::run_result_t run_for_miss() override
Run the actual command (when there is a cache miss).
Definition: ccc_analyzer_wrapper.cpp:92