1*ec727ea7Spatrick //=======- DiagOutputUtils.h -------------------------------------*- C++ -*-==// 2*ec727ea7Spatrick // 3*ec727ea7Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*ec727ea7Spatrick // See https://llvm.org/LICENSE.txt for license information. 5*ec727ea7Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*ec727ea7Spatrick // 7*ec727ea7Spatrick //===----------------------------------------------------------------------===// 8*ec727ea7Spatrick 9*ec727ea7Spatrick #ifndef LLVM_CLANG_ANALYZER_WEBKIT_DIAGPRINTUTILS_H 10*ec727ea7Spatrick #define LLVM_CLANG_ANALYZER_WEBKIT_DIAGPRINTUTILS_H 11*ec727ea7Spatrick 12*ec727ea7Spatrick #include "clang/AST/Decl.h" 13*ec727ea7Spatrick #include "llvm/Support/raw_ostream.h" 14*ec727ea7Spatrick 15*ec727ea7Spatrick namespace clang { 16*ec727ea7Spatrick 17*ec727ea7Spatrick template <typename NamedDeclDerivedT> printQuotedQualifiedName(llvm::raw_ostream & Os,const NamedDeclDerivedT & D)18*ec727ea7Spatrickvoid printQuotedQualifiedName(llvm::raw_ostream &Os, 19*ec727ea7Spatrick const NamedDeclDerivedT &D) { 20*ec727ea7Spatrick Os << "'"; 21*ec727ea7Spatrick D->getNameForDiagnostic(Os, D->getASTContext().getPrintingPolicy(), 22*ec727ea7Spatrick /*Qualified=*/true); 23*ec727ea7Spatrick Os << "'"; 24*ec727ea7Spatrick } 25*ec727ea7Spatrick 26*ec727ea7Spatrick template <typename NamedDeclDerivedT> printQuotedName(llvm::raw_ostream & Os,const NamedDeclDerivedT & D)27*ec727ea7Spatrickvoid printQuotedName(llvm::raw_ostream &Os, const NamedDeclDerivedT &D) { 28*ec727ea7Spatrick Os << "'"; 29*ec727ea7Spatrick D->getNameForDiagnostic(Os, D->getASTContext().getPrintingPolicy(), 30*ec727ea7Spatrick /*Qualified=*/false); 31*ec727ea7Spatrick Os << "'"; 32*ec727ea7Spatrick } 33*ec727ea7Spatrick 34*ec727ea7Spatrick } // namespace clang 35*ec727ea7Spatrick 36*ec727ea7Spatrick #endif 37