[PATCH] D26452: Make output of -ast-print a valid C++ code.

Serge Pavlov via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 9 08:27:02 PST 2016


sepavloff created this revision.
sepavloff added reviewers: ABataev, gribozavr, rtrieu.
sepavloff added a subscriber: cfe-commits.

Output generated by option -ast-print looks like C/C++ code, and it
really is for plain C. For C++ the produced output was not valid C++
code, but the differences were small. With this change the output
is fixed and can be compiled. Tests are changed so that output produced
by -ast-print is compiled again with the same flags and both outputs are
compared.

Option -ast-print is extensively used in clang tests but it itself
was tested poorly, existing tests only checked that compiler did not
crash. There are unit tests in file DeclPrinterTest.cpp, but they test
only terse output mode.

The change affects many test files but the changes are mostly
mechanical. Two main reasons why the test files require update are:

- change in form of template specialization output,
- template now is printed before its specializations.


https://reviews.llvm.org/D26452

Files:
  lib/AST/DeclPrinter.cpp
  test/Analysis/cfg.cpp
  test/Coverage/ast-print-func.cpp
  test/Coverage/ast-print-temp-class.cpp
  test/Coverage/ast-print-temp-func.cpp
  test/Coverage/ast-printing.cpp
  test/Index/comment-cplus-decls.cpp
  test/Index/comment-to-html-xml-conversion.cpp
  test/Misc/ast-dump-templates.cpp
  test/OpenMP/atomic_ast_print.cpp
  test/OpenMP/barrier_ast_print.cpp
  test/OpenMP/critical_ast_print.cpp
  test/OpenMP/declare_reduction_ast_print.cpp
  test/OpenMP/declare_simd_ast_print.cpp
  test/OpenMP/declare_target_ast_print.cpp
  test/OpenMP/distribute_ast_print.cpp
  test/OpenMP/distribute_dist_schedule_ast_print.cpp
  test/OpenMP/distribute_parallel_for_ast_print.cpp
  test/OpenMP/distribute_parallel_for_simd_ast_print.cpp
  test/OpenMP/distribute_simd_ast_print.cpp
  test/OpenMP/flush_ast_print.cpp
  test/OpenMP/for_ast_print.cpp
  test/OpenMP/for_simd_ast_print.cpp
  test/OpenMP/ordered_ast_print.cpp
  test/OpenMP/parallel_ast_print.cpp
  test/OpenMP/parallel_for_ast_print.cpp
  test/OpenMP/parallel_for_simd_ast_print.cpp
  test/OpenMP/parallel_sections_ast_print.cpp
  test/OpenMP/sections_ast_print.cpp
  test/OpenMP/simd_ast_print.cpp
  test/OpenMP/single_ast_print.cpp
  test/OpenMP/target_ast_print.cpp
  test/OpenMP/target_data_ast_print.cpp
  test/OpenMP/target_data_use_device_ptr_ast_print.cpp
  test/OpenMP/target_enter_data_ast_print.cpp
  test/OpenMP/target_exit_data_ast_print.cpp
  test/OpenMP/target_is_device_ptr_ast_print.cpp
  test/OpenMP/target_parallel_ast_print.cpp
  test/OpenMP/target_parallel_for_ast_print.cpp
  test/OpenMP/target_parallel_for_simd_ast_print.cpp
  test/OpenMP/target_simd_ast_print.cpp
  test/OpenMP/target_update_ast_print.cpp
  test/OpenMP/task_ast_print.cpp
  test/OpenMP/taskloop_ast_print.cpp
  test/OpenMP/taskloop_simd_ast_print.cpp
  test/OpenMP/taskwait_ast_print.cpp
  test/OpenMP/taskyield_ast_print.cpp
  test/OpenMP/teams_ast_print.cpp
  test/OpenMP/teams_distribute_ast_print.cpp
  test/OpenMP/teams_distribute_simd_ast_print.cpp
  test/OpenMP/threadprivate_ast_print.cpp
  test/SemaTemplate/temp_arg_enum_printing.cpp
  unittests/AST/ASTTypeTraitsTest.cpp
  unittests/AST/DeclPrinterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26452.77354.patch
Type: text/x-patch
Size: 100810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161109/795949c8/attachment-0001.bin>


More information about the cfe-commits mailing list