[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 7 09:00:53 PST 2023


================
@@ -3022,18 +3022,24 @@ class CodeGenFunction : public CodeGenTypeCache {
   void EmitBoundsCheck(const Expr *E, const Expr *Base, llvm::Value *Index,
                        QualType IndexType, bool Accessed);
 
+  void EmitBoundsCheck(const Expr *E, llvm::Value *Bound, llvm::Value *Index,
----------------
nickdesaulniers wrote:

This needs a comment added.

https://github.com/llvm/llvm-project/pull/73730/commits/424fe03d6c04eea6a323ba8adec9160e8cf1c980 demonstrates that having multiple fields with very similar parameter names is error prone.

I'm surprised that https://github.com/llvm/llvm-project/pull/73730/commits/424fe03d6c04eea6a323ba8adec9160e8cf1c980 didn't result in test breakage.

I'm kind of curious if we even need another overload of EmitBoundsCheck? Can this be implemented within the existing EmitBoundsCheck? Or given a different identifier that better distinguishes what it's doing differently than the existing EmitsBoundsCheck?  As a fellow developer, it's not clear at the moment when I should call one vs the other.

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


More information about the cfe-commits mailing list