[PATCH] D146358: [clang][AST] Print name instead of type when diagnosing uninitialized subobject in constexpr variables

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 18 12:24:35 PDT 2023


shafik added a comment.

Thank you for submitting this fix.



================
Comment at: clang/lib/AST/ExprConstant.cpp:2270
+                                 Info, MTE->getExprLoc(), TempType, *V, Kind,
+                                 nullptr, CheckedTemps))
         return false;
----------------
To conform to [clang-tidy bugprone-argument-comment format](https://clang.llvm.org/extra/clang-tidy/checks/bugprone/argument-comment.html)


================
Comment at: clang/lib/AST/ExprConstant.cpp:2399
                                    Value.getStructBase(BaseIndex), Kind,
-                                   BS.getBeginLoc(), CheckedTemps))
+                                   nullptr, CheckedTemps))
           return false;
----------------
same here.


================
Comment at: clang/lib/AST/ExprConstant.cpp:2443
   return CheckEvaluationResult(CheckEvaluationResultKind::ConstantExpression,
-                               Info, DiagLoc, Type, Value, Kind,
-                               SourceLocation(), CheckedTemps);
+                               Info, DiagLoc, Type, Value, Kind, nullptr,
+                               CheckedTemps);
----------------
Also here


================
Comment at: clang/lib/AST/ExprConstant.cpp:2454
+                               Info, DiagLoc, Type, Value,
+                               ConstantExprKind::Normal, nullptr, CheckedTemps);
 }
----------------
and here


================
Comment at: clang/lib/AST/Interp/Interp.cpp:373
+                                           const FieldDecl *SubObjDecl) {
+  S.FFDiag(SI, diag::note_constexpr_uninitialized) << SubObjDecl;
+  S.Note(SubObjDecl->getLocation(),
----------------
Do we need to check that `SubObjDecl` is not `nullptr` ever?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146358



More information about the cfe-commits mailing list