//===- CLog.h - Logging Interface -------------------------------*- 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 // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_TOOLS_LIBCLANG_CLOG_H #define LLVM_CLANG_TOOLS_LIBCLANG_CLOG_H #include "clang-c/Index.h" #include "clang/Basic/FileEntry.h" #include "clang/Basic/LLVM.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/raw_ostream.h" #include <string> namespace llvm { class format_object_base; } namespace clang { namespace cxindex { class Logger; LogRef; /// Collects logging output and writes it to stderr when it's destructed. /// Common use case: /// \code /// if (LogRef Log = Logger::make(__func__)) { /// *Log << "stuff"; /// } /// \endcode class Logger : public RefCountedBase<Logger> { … }; } } /// Macros to automate common uses of Logger. Like this: /// \code /// LOG_FUNC_SECTION { /// *Log << "blah"; /// } /// \endcode #define LOG_SECTION(NAME) … #define LOG_FUNC_SECTION … #endif