//===--- HeaderAnalysis.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "clang/Tooling/Inclusions/HeaderAnalysis.h" #include "clang/Basic/SourceLocation.h" #include "clang/Lex/HeaderSearch.h" namespace clang::tooling { namespace { // Is Line an #if or #ifdef directive? // FIXME: This makes headers with #ifdef LINUX/WINDOWS/MACOS marked as non // self-contained and is probably not what we want. bool isIf(llvm::StringRef Line) { … } // Is Line an #error directive mentioning includes? bool isErrorAboutInclude(llvm::StringRef Line) { … } // Heuristically headers that only want to be included via an umbrella. bool isDontIncludeMeHeader(StringRef Content) { … } bool isImportLine(llvm::StringRef Line) { … } llvm::StringRef getFileContents(FileEntryRef FE, const SourceManager &SM) { … } } // namespace bool isSelfContainedHeader(FileEntryRef FE, const SourceManager &SM, const HeaderSearch &HeaderInfo) { … } bool codeContainsImports(llvm::StringRef Code) { … } std::optional<StringRef> parseIWYUPragma(const char *Text) { … } } // namespace clang::tooling