//===- ThreadSafetyUtil.h ---------------------------------------*- 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 some basic utility classes for use by ThreadSafetyTIL.h // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYUTIL_H #define LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYUTIL_H #include "clang/AST/Decl.h" #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Support/Allocator.h" #include <cassert> #include <cstddef> #include <cstring> #include <iterator> #include <ostream> #include <string> #include <vector> namespace clang { class Expr; namespace threadSafety { namespace til { // Simple wrapper class to abstract away from the details of memory management. // SExprs are allocated in pools, and deallocated all at once. class MemRegionRef { … }; } // namespace til } // namespace threadSafety } // namespace clang inline void *operator new(size_t Sz, clang::threadSafety::til::MemRegionRef &R) { … } namespace clang { namespace threadSafety { std::string getSourceLiteralString(const Expr *CE); namespace til { // A simple fixed size array class that does not manage its own memory, // suitable for use with bump pointer allocation. template <class T> class SimpleArray { … }; } // namespace til // A copy on write vector. // The vector can be in one of three states: // * invalid -- no operations are permitted. // * read-only -- read operations are permitted. // * writable -- read and write operations are permitted. // The init(), destroy(), and makeWritable() methods will change state. template<typename T> class CopyOnWriteVector { … }; inline std::ostream& operator<<(std::ostream& ss, const StringRef str) { … } } // namespace threadSafety } // namespace clang #endif // LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETYUTIL_H