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