|
|
|||
File indexing completed on 2026-05-10 08:37:11
0001 //===--- HeaderAnalysis.h -----------------------------------------*-C++-*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 0009 #ifndef LLVM_CLANG_TOOLING_INCLUSIONS_HEADER_ANALYSIS_H 0010 #define LLVM_CLANG_TOOLING_INCLUSIONS_HEADER_ANALYSIS_H 0011 0012 #include "clang/Basic/FileEntry.h" 0013 #include "llvm/ADT/StringRef.h" 0014 #include <optional> 0015 0016 namespace clang { 0017 class SourceManager; 0018 class HeaderSearch; 0019 0020 namespace tooling { 0021 0022 /// Returns true if the given physical file is a self-contained header. 0023 /// 0024 /// A header is considered self-contained if 0025 // - it has a proper header guard or has been #imported or contains #import(s) 0026 // - *and* it doesn't have a dont-include-me pattern. 0027 /// 0028 /// This function can be expensive as it may scan the source code to find out 0029 /// dont-include-me pattern heuristically. 0030 bool isSelfContainedHeader(FileEntryRef FE, const SourceManager &SM, 0031 const HeaderSearch &HeaderInfo); 0032 0033 /// This scans the given source code to see if it contains #import(s). 0034 bool codeContainsImports(llvm::StringRef Code); 0035 0036 /// If Text begins an Include-What-You-Use directive, returns it. 0037 /// Given "// IWYU pragma: keep", returns "keep". 0038 /// Input is a null-terminated char* as provided by SM.getCharacterData(). 0039 /// (This should not be StringRef as we do *not* want to scan for its length). 0040 /// For multi-line comments, we return only the first line. 0041 std::optional<llvm::StringRef> parseIWYUPragma(const char *Text); 0042 0043 } // namespace tooling 0044 } // namespace clang 0045 0046 #endif // LLVM_CLANG_TOOLING_INCLUSIONS_HEADER_ANALYSIS_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|