Fznamznon added inline comments.

================
Comment at: clang/lib/Sema/TreeTransform.h:15216-15217
 
-  if (Op == OO_Subscript) {
-    SourceLocation LBrace;
-    SourceLocation RBrace;
-
-    if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Callee)) {
-      DeclarationNameLoc NameLoc = DRE->getNameInfo().getInfo();
-      LBrace = NameLoc.getCXXOperatorNameBeginLoc();
-      RBrace = NameLoc.getCXXOperatorNameEndLoc();
-    } else {
-      LBrace = Callee->getBeginLoc();
-      RBrace = OpLoc;
-    }
-
-    return SemaRef.CreateOverloadedArraySubscriptExpr(LBrace, RBrace,
-                                                      First, Second);
-  }
+  // FIXME: The following code for subscript expression is either never 
executed
+  // or not tested by check-clang.
+  if (Op == OO_Subscript)
----------------
cor3ntin wrote:
> Maybe it would be worth investigating that further before merging the PR? 
> Although the pr is a clear improvement so I'll let you decide what to do!
I've noticed that it is likely a dead code, so I didn't want to pass more 
parameters to `RebuildCXXOperatorCallExpr` in order to support dead code, but 
didn't feel confident enough to remove it. So I left this FIXME.
`RebuildCXXOperatorCallExpr` is only called by `TransformCXXOperatorCallExpr` 
and `TransformCXXFoldExpr`. When subscript expression comes to 
`TransformCXXOperatorCallExpr`, it never falls down to 
`RebuildCXXOperatorCallExpr` after c1512250960bd247519a9f959ad4af202402dcc4 , 
and I don't think that it is possible to have subscript expression as a part of 
a fold expression. So, for me, it seems the whole `if` and FIXME actually can 
be removed. WDYT? 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151553/new/

https://reviews.llvm.org/D151553

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to