File indexing completed on 2024-05-19 05:42:03
0001 // ct_lvtclp_physicaldepscanner.h -*-C++-*- 0002 0003 /* 0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk> 0005 // SPDX-License-Identifier: Apache-2.0 0006 // 0007 // Licensed under the Apache License, Version 2.0 (the "License"); 0008 // you may not use this file except in compliance with the License. 0009 // You may obtain a copy of the License at 0010 // 0011 // http://www.apache.org/licenses/LICENSE-2.0 0012 // 0013 // Unless required by applicable law or agreed to in writing, software 0014 // distributed under the License is distributed on an "AS IS" BASIS, 0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0016 // See the License for the specific language governing permissions and 0017 // limitations under the License. 0018 */ 0019 0020 #ifndef INCLUDED_CT_LVTCLP_PHYSICALDEPSCANNER 0021 #define INCLUDED_CT_LVTCLP_PHYSICALDEPSCANNER 0022 0023 //@PURPOSE: Quickly scan a codebase to find all physical dependencies 0024 // 0025 //@CLASSES: lvtclp::DepScanActionFactory Implements FrontendActionFactory 0026 // 0027 //@SEE_ALSO: clang::tooling::FrontendActionFactory 0028 0029 #include <lvtclp_export.h> 0030 0031 #include <ct_lvtclp_headercallbacks.h> 0032 0033 #include <clang/Tooling/Tooling.h> 0034 0035 #include <filesystem> 0036 #include <functional> 0037 #include <memory> 0038 #include <string> 0039 #include <vector> 0040 0041 #include <QString> 0042 0043 namespace Codethink::lvtmdb { 0044 class ObjectStore; 0045 } 0046 0047 namespace Codethink::lvtclp { 0048 0049 // ============================= 0050 // class DepScanActionFactory 0051 // ============================= 0052 0053 class LVTCLP_EXPORT DepScanActionFactory : public clang::tooling::FrontendActionFactory { 0054 // Quickly scan a codebase to find all physical dependencies 0055 0056 private: 0057 // TYPES 0058 struct Private; 0059 0060 // DATA 0061 std::unique_ptr<Private> d; 0062 0063 public: 0064 // CREATORS 0065 DepScanActionFactory( 0066 lvtmdb::ObjectStore& memDb, 0067 const std::filesystem::path& prefix, 0068 const std::vector<std::filesystem::path>& nonLakosians, 0069 const std::vector<std::pair<std::string, std::string>>& thirdPartyDirs, 0070 std::function<void(const std::string&)> filenameCallback, // callback that sends the current filename to the UI 0071 std::vector<llvm::GlobPattern> ignoreGlobs, 0072 std::optional<HeaderCallbacks::HeaderLocationCallback_f> headerLocationCallback = std::nullopt); 0073 0074 ~DepScanActionFactory() noexcept override; 0075 0076 // MANIPULATORS 0077 std::unique_ptr<clang::FrontendAction> create() override; 0078 // Construct a new clang::FrontendAction 0079 }; 0080 0081 } // namespace Codethink::lvtclp 0082 0083 #endif // INCLUDED_CT_LVTCLP_PHYSICALDEPSCANNER