[PATCH] D58035: [clang/DIVar] Emit flag for params that have unchanged values

Adrian Prantl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 16 15:33:25 PDT 2019


aprantl added inline comments.


================
Comment at: lib/CodeGen/CGDebugInfo.cpp:4537
+      CGM.getLangOpts().Optimize) {
+    for (auto &SP : DeclCache) {
+      auto *D = SP.first;
----------------
djtodoro wrote:
> aprantl wrote:
> > Just looking at the type declarations in CGDebugInfo.h: Why not iterate over the `SPCache`  directly? Shouldn't that contain all Function declarations only?
> I tried it, but `SPCache` is empty at this point.
Where is it emptied? Just grepping through CGDebugInfo did not make this obvious to me.


================
Comment at: lib/CodeGen/CGDebugInfo.cpp:3885
+  if (CGM.getCodeGenOpts().EnableDebugEntryValues &&
+      CGM.getLangOpts().Optimize && ArgNo) {
+    if (auto *PD = dyn_cast<ParmVarDecl>(VD))
----------------
We shouldn't query CGM.getLangOpts().Optimize. If we don't want this to happen at -O0, we shouldn't set EnableDebugEntryValues at a higher level (Driver, CompilerInvocation, ...) ..Otherwise inevitably someone will query one but not the other and things will go out of sync.


================
Comment at: lib/CodeGen/CGDebugInfo.cpp:4535
       DBuilder.retainType(cast<llvm::DIType>(MD));
 
+  if (CGM.getCodeGenOpts().EnableDebugEntryValues &&
----------------
Please add either a top-level comment about what this block is doing or perhaps factor this out into a descriptively named static function.


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

https://reviews.llvm.org/D58035





More information about the cfe-commits mailing list