[all-commits] [llvm/llvm-project] 5fedc2: [Clang] Avoid crashing when generating crash diagn...

Alexandre Ganea via All-commits all-commits at lists.llvm.org
Thu Feb 6 12:49:00 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5fedc2b410853a6aef05e8edf19ebfc4e071e28f
      https://github.com/llvm/llvm-project/commit/5fedc2b410853a6aef05e8edf19ebfc4e071e28f
  Author: Alexandre Ganea <alexandre.ganea at ubisoft.com>
  Date:   2020-02-06 (Thu, 06 Feb 2020)

  Changed paths:
    M clang/include/clang/Driver/CC1Options.td
    M clang/include/clang/Lex/PreprocessorOptions.h
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/lib/Lex/Pragma.cpp
    M clang/test/Driver/crash-report.c
    M clang/test/Driver/output-file-cleanup.c

  Log Message:
  -----------
  [Clang] Avoid crashing when generating crash diagnostics when '#pragma clang __debug [assert|crash|parser_crash|llvm_fatal_error|llvm_unreachable|overflow_stack]' are used

Previously, when the above '#pragma clang __debug' were used, Driver::generateCompilationDiagnostics() wouldn't work as expected.
The 'clang -E' process created for diagnostics would crash, because it would reach again the intended crash in Pragma.cpp, PragmaDebugHandler::HandlePragma() while preprocessing.

When generating crash diagnostics, we now disable the intended crashing behavior with a new cc1 flag -disable-pragma-debug-crash.

Notes:
- #pragma clang __debug llvm_report_fatal isn't currently tested by crash-report.c, because it needs exit() to be handled differently in -fintegrated-cc1 mode. See https://reviews.llvm.org/D73742 for an upcoming fix.
- This is also needed to further validate that -MF is removed from the 'clang -E ' crash diagnostic cmd-line (currently not the case). See https://reviews.llvm.org/D74076 for an upcoming fix.

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




More information about the All-commits mailing list