DebugInfo: Correct location information for array accesses to elements of variable array type.
llvm-svn: 223902
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index ca06e85..9348b17 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2407,6 +2407,9 @@
// The element count here is the total number of non-VLA elements.
llvm::Value *numElements = getVLASize(vla).first;
+ if (auto *DI = getDebugInfo())
+ DI->EmitLocation(Builder, E->getLocStart());
+
// Effectively, the multiply by the VLA size is part of the GEP.
// GEP indexes are signed, and scaling an index isn't permitted to
// signed-overflow, so we use the same semantics for our explicit