[all-commits] [llvm/llvm-project] 2e7b95: [Safe Buffers] Serialize unsafe_buffer_usage pragm...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Thu Jun 13 22:44:45 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e7b95e4c080426e5085c38cec01176b56798534
      https://github.com/llvm/llvm-project/commit/2e7b95e4c080426e5085c38cec01176b56798534
  Author: Ziqing Luo <ziqing at udel.edu>
  Date:   2024-06-13 (Thu, 13 Jun 2024)

  Changed paths:
    M clang/include/clang/Basic/SourceManager.h
    M clang/include/clang/Lex/Preprocessor.h
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/lib/Basic/SourceManager.cpp
    M clang/lib/Lex/Preprocessor.cpp
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    A clang/test/Modules/safe_buffers_optout.cpp
    A clang/test/PCH/unsafe-buffer-usage-pragma-pch-complex.cpp
    A clang/test/PCH/unsafe-buffer-usage-pragma-pch-cross-files-2.cpp
    A clang/test/PCH/unsafe-buffer-usage-pragma-pch-cross-files.cpp
    A clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-pch.cpp

  Log Message:
  -----------
  [Safe Buffers] Serialize unsafe_buffer_usage pragmas  (#92031)

The commit adds serialization and de-serialization implementations for
the stored regions. Basically, the serialized representation of the
regions of a PP is a (ordered) sequence of source location encodings.
For de-serialization, regions from loaded files are stored by their ASTs.
When later one queries if a loaded location L is in an opt-out
region, PP looks up the regions of the loaded AST where L is at.

(Background if helps: a pair of `#pragma clang unsafe_buffer_usage begin/end` pragmas marks a
warning-opt-out region. The begin and end locations (opt-out regions)
are stored in preprocessor instances (PP) and will be queried by the
`-Wunsafe-buffer-usage` analyzer.)

The reported issue at upstream: https://github.com/llvm/llvm-project/issues/90501
rdar://124035402



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list