DiagOutputUtils.h 1.1 KB

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