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