[PATCH] D47097: [WIP][DebugInfo] Preserve scope in auto generated StoreInst

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 21 12:46:40 PDT 2018


vsk added inline comments.


================
Comment at: lib/CodeGen/CGDecl.cpp:2062
     EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true);
+    ApplyDebugLocation::CreateArtificial(*this);
+  }
----------------
There are two issues here:
1) ApplyDebugLocation is a RAII helper, which means that it installs the proper debug location in its constructor, and restores the old debug location in its destructor. Since you are not assigning the result of the static constructor (CreateArtificial) to anything, the ApplyDebugLocation instance is immediately destroyed, so it's a no-op.
2) This is being applied in the wrong place, because it sets a debug location *after* the store is emitted. The right location needs to be applied before the store or alloca are emitted.


Repository:
  rC Clang

https://reviews.llvm.org/D47097





More information about the cfe-commits mailing list