[all-commits] [llvm/llvm-project] 19e984: Properly print unnamed TagDecl objects in diagnostics

Aaron Ballman via All-commits all-commits at lists.llvm.org
Fri Oct 14 05:18:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 19e984ef8f49bc3ccced15621989fa9703b2cd5b
      https://github.com/llvm/llvm-project/commit/19e984ef8f49bc3ccced15621989fa9703b2cd5b
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2022-10-14 (Fri, 14 Oct 2022)

  Changed paths:
    M clang-tools-extra/clangd/unittests/FindTargetTests.cpp
    M clang/include/clang/AST/Decl.h
    M clang/include/clang/AST/DeclCXX.h
    M clang/include/clang/AST/DeclTemplate.h
    M clang/lib/AST/ASTDiagnostic.cpp
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/DeclCXX.cpp
    M clang/lib/AST/DeclPrinter.cpp
    M clang/lib/AST/DeclTemplate.cpp
    M clang/lib/AST/NestedNameSpecifier.cpp
    M clang/lib/AST/TemplateName.cpp
    M clang/lib/CodeGen/CodeGenTypes.cpp
    M clang/lib/Sema/SemaTemplateInstantiate.cpp
    M clang/test/AST/ast-dump-record-definition-data-json.cpp
    M clang/test/ExtractAPI/enum.c
    M clang/test/Index/annotate-comments-typedef.m
    M clang/test/Index/c-index-api-loadTU-test.m
    M clang/test/Index/c-index-getCursor-test.m
    M clang/test/Index/print-type.c
    M clang/test/Index/print-type.cpp
    M clang/test/Index/targeted-annotation.c
    M clang/test/Index/targeted-cursor.c
    M clang/test/Index/usrs.m
    M clang/test/Sema/address-packed.c
    M clang/test/Sema/attr-flag-enum.c
    M clang/test/SemaCXX/attr-unused.cpp
    M clang/test/SemaCXX/lambda-expressions.cpp
    M clang/test/SemaCXX/ms-interface.cpp
    M clang/test/SemaObjCXX/arc-0x.mm
    M clang/test/Templight/templight-empty-entries-fix.cpp
    M clang/unittests/AST/ASTTraverserTest.cpp
    M llvm/utils/lit/lit/TestRunner.py

  Log Message:
  -----------
  Properly print unnamed TagDecl objects in diagnostics

The diagnostics engine is very smart about being passed a NamedDecl to
print as part of a diagnostic; it gets the "right" form of the name,
quotes it properly, etc. However, the result of using an unnamed tag
declaration was to print '' instead of anything useful.

This patch causes us to print the same information we'd have gotten if
we had printed the type of the declaration rather than the name of it,
as that's the most relevant information we can display.

Differential Revision: https://reviews.llvm.org/D134813




More information about the All-commits mailing list