[all-commits] [llvm/llvm-project] c6c8d4: [modules] Fix crash in call to `FunctionDecl::setP...

andrewjcg via All-commits all-commits at lists.llvm.org
Wed Nov 18 11:56:06 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c6c8d4a13ebd5ce1c3c7e8632312ab8c2dc6afa0
      https://github.com/llvm/llvm-project/commit/c6c8d4a13ebd5ce1c3c7e8632312ab8c2dc6afa0
  Author: Andrew Gallagher <andrewjcg at gmail.com>
  Date:   2020-11-18 (Wed, 18 Nov 2020)

  Changed paths:
    M clang/lib/Serialization/ASTReaderDecl.cpp
    A clang/test/Modules/Inputs/set-pure-crash/a.h
    A clang/test/Modules/Inputs/set-pure-crash/b.h
    A clang/test/Modules/Inputs/set-pure-crash/c.h
    A clang/test/Modules/Inputs/set-pure-crash/module.modulemap
    A clang/test/Modules/set-pure-crash.cpp

  Log Message:
  -----------
  [modules] Fix crash in call to `FunctionDecl::setPure()`

In some cases, when deserializing a `CXXMethodDecl` of a `CXXSpecializationTemplateDecl`,
the call to `FunctionDecl::setPure()` happens before the `DefinitionData` member has been
populated (which appears to happen lower down in a `mergeRedeclarable` call), causing a
crash (https://reviews.llvm.org/P8228).

This diff fixes this by deferring the `FunctionDecl::setPure()` till after the `DefinitionData` has
been filled in.

Reviewed By: lxfind

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




More information about the All-commits mailing list