[all-commits] [llvm/llvm-project] d9739f: Serialize PragmaAssumeNonNullLoc to support preambles

David Goldman via All-commits all-commits at lists.llvm.org
Thu Mar 31 08:08:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d9739f29cdd4c066763275d09e1d26ee315cfdf5
      https://github.com/llvm/llvm-project/commit/d9739f29cdd4c066763275d09e1d26ee315cfdf5
  Author: David Goldman <davg at google.com>
  Date:   2022-03-31 (Thu, 31 Mar 2022)

  Changed paths:
    M clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
    M clang/include/clang/Lex/Preprocessor.h
    M clang/include/clang/Lex/PreprocessorOptions.h
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/lib/Lex/PPLexerChange.cpp
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    A clang/test/Index/preamble-assume-nonnull.c

  Log Message:
  -----------
  Serialize PragmaAssumeNonNullLoc to support preambles

Previously, if a `#pragma clang assume_nonnull begin` was at the
end of a premable with a `#pragma clang assume_nonnull end` at the
end of the main file, clang would diagnose an unterminated begin in
the preamble and an unbalanced end in the main file.

With this change, those errors no longer occur and the case above is
now properly handled. I've added a corresponding test to clangd,
which makes use of preambles, in order to verify this works as
expected.

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




More information about the All-commits mailing list