//===- UnsafeBufferUsage.h - Replace pointers with modern C++ ---*- 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 // //===----------------------------------------------------------------------===// // // This file defines an analysis that aids replacing buffer accesses through // raw pointers with safer C++ abstractions such as containers and views/spans. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_ANALYSIS_ANALYSES_UNSAFEBUFFERUSAGE_H #define LLVM_CLANG_ANALYSIS_ANALYSES_UNSAFEBUFFERUSAGE_H #include "clang/AST/Decl.h" #include "clang/AST/Stmt.h" #include "clang/Basic/SourceLocation.h" #include "llvm/Support/Debug.h" namespace clang { VarGrpTy; VarGrpRef; class VariableGroupsManager { … }; // FixitStrategy is a map from variables to the way we plan to emit fixes for // these variables. It is figured out gradually by trying different fixes // for different variables depending on gadgets in which these variables // participate. class FixitStrategy { … }; /// The interface that lets the caller handle unsafe buffer usage analysis /// results by overriding this class's handle... methods. class UnsafeBufferUsageHandler { … }; // This function invokes the analysis and allows the caller to react to it // through the handler class. void checkUnsafeBufferUsage(const Decl *D, UnsafeBufferUsageHandler &Handler, bool EmitSuggestions); namespace internal { // Tests if any two `FixItHint`s in `FixIts` conflict. Two `FixItHint`s // conflict if they have overlapping source ranges. bool anyConflict(const llvm::SmallVectorImpl<FixItHint> &FixIts, const SourceManager &SM); } // namespace internal } // end namespace clang #endif /* LLVM_CLANG_ANALYSIS_ANALYSES_UNSAFEBUFFERUSAGE_H */