[llvm] [libc] [libcxx] [clang-tools-extra] [clang] [compiler-rt] [flang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

Yeoul Na via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 17 22:58:19 PST 2023


================
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
       ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
     else
       ArrayLV = EmitLValue(Array);
+
     auto *Idx = EmitIdxAfterBase(/*Promote*/true);
 
+    if (SanOpts.has(SanitizerKind::ArrayBounds)) {
----------------
rapidsna wrote:

@rjmccall @bwendling I have documentation clarifying what are the restrictions for __counted_by https://github.com/rapidsna/llvm-project/pull/1/commits/4a6a041267b3399eab46c3bb88e3d023d4050836. I was planning to land it after my initial documentation lands https://github.com/llvm/llvm-project/pull/70749.

@bwendling In general, the same name/expression rules should apply to `__counted_by` used in pointers and arrays. I clarified that in https://github.com/rapidsna/llvm-project/pull/1/commits/4a6a041267b3399eab46c3bb88e3d023d4050836. I synched with GCC folks and they agreed that the syntax and semantics should not diverge between the full `-fbounds-safety` mode and the mode only using the annotations for `__bdos` and sanitizers.



https://github.com/llvm/llvm-project/pull/73730


More information about the cfe-commits mailing list