[all-commits] [llvm/llvm-project] 9f2414: [clangd] Fix crash in bugprone-bad-signal-to-kill-...

Aleksandr Platonov via All-commits all-commits at lists.llvm.org
Thu Aug 6 11:46:52 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f24148b212698aca220ac923d215c2073e443ce
      https://github.com/llvm/llvm-project/commit/9f24148b212698aca220ac923d215c2073e443ce
  Author: Aleksandr Platonov <platonov.aleksandr at huawei.com>
  Date:   2020-08-06 (Thu, 06 Aug 2020)

  Changed paths:
    M clang-tools-extra/clang-tidy/bugprone/BadSignalToKillThreadCheck.cpp
    M clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp

  Log Message:
  -----------
  [clangd] Fix crash in bugprone-bad-signal-to-kill-thread clang-tidy check.

Inside clangd, clang-tidy checks don't see preprocessor events in the preamble.
This leads to `Token::PtrData == nullptr` for tokens that the macro is defined to.
E.g. `#define SIGTERM 15`:
- Token::Kind == tok::numeric_constant (Token::isLiteral() == true)
- Token::UintData == 2
- Token::PtrData == nullptr

As the result of this, bugprone-bad-signal-to-kill-thread check crashes at null-dereference inside clangd.

Reviewed By: hokein

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




More information about the All-commits mailing list