[PATCH] D83997: [os_log] Improve the way we extend the lifetime of objects passed to __builtin_os_log_format

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 19:08:10 PDT 2020


ahatanak created this revision.
ahatanak added reviewers: rjmccall, erik.pilkington.
ahatanak added a project: clang.
Herald added subscribers: ributzka, dexonsmith, jkorous, martong.
Herald added a reviewer: shafik.

This patch fixes several shortcomings of the way we currently extend the lifetime of objects passed to calls to __builtin_os_log_format:

- Sema doesn't diagnose code that jumps into or out of the scope of a lifetime-extended object.
- Lifetime of objects in comma operators or expressions for ObjC property access isn't extended.
- We extend the lifetime of an object by emitting an extra pair of retain and release calls instead of delaying the release call.
- Calls to clang.arc.use are emitted on exception paths even though they are needed only on normal paths.

rdar://problem/62610583


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83997

Files:
  clang/include/clang/AST/ExprCXX.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExprAgg.cpp
  clang/lib/CodeGen/CGExprComplex.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/JumpDiagnostics.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/AST/ast-dump-objc-arc-json.m
  clang/test/AST/ast-dump-stmt.m
  clang/test/CodeGenObjC/os_log.m
  clang/test/CodeGenObjCXX/os_log.mm
  clang/test/PCH/Inputs/arc.h
  clang/test/PCH/arc.m
  clang/test/SemaObjC/format-strings-oslog.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83997.278647.patch
Type: text/x-patch
Size: 48848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200717/b21ca884/attachment-0001.bin>


More information about the cfe-commits mailing list