r223937 - DebugInfo: Location information for scalar new expressions

David Blaikie dblaikie at gmail.com
Wed Dec 10 11:04:09 PST 2014


Author: dblaikie
Date: Wed Dec 10 13:04:09 2014
New Revision: 223937

URL: http://llvm.org/viewvc/llvm-project?rev=223937&view=rev
Log:
DebugInfo: Location information for scalar new expressions

Modified:
    cfe/trunk/lib/CodeGen/CGExprCXX.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-line.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=223937&r1=223936&r2=223937&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Wed Dec 10 13:04:09 2014
@@ -754,14 +754,15 @@ static llvm::Value *EmitCXXNewAllocSize(
 }
 
 static void StoreAnyExprIntoOneUnit(CodeGenFunction &CGF, const Expr *Init,
-                                    QualType AllocType, llvm::Value *NewPtr) {
+                                    QualType AllocType, llvm::Value *NewPtr,
+                                    SourceLocation DbgLoc = SourceLocation()) {
   // FIXME: Refactor with EmitExprAsInit.
   CharUnits Alignment = CGF.getContext().getTypeAlignInChars(AllocType);
   switch (CGF.getEvaluationKind(AllocType)) {
   case TEK_Scalar:
-    CGF.EmitScalarInit(Init, nullptr, CGF.MakeAddrLValue(NewPtr, AllocType,
-                                                         Alignment),
-                       false);
+    CGF.EmitScalarInit(Init, nullptr,
+                       CGF.MakeAddrLValue(NewPtr, AllocType, Alignment), false,
+                       DbgLoc);
     return;
   case TEK_Complex:
     CGF.EmitComplexExprIntoLValue(Init, CGF.MakeAddrLValue(NewPtr, AllocType,
@@ -1023,7 +1024,8 @@ static void EmitNewInitializer(CodeGenFu
     CGF.EmitNewArrayInitializer(E, ElementType, NewPtr, NumElements,
                                 AllocSizeWithoutCookie);
   else if (const Expr *Init = E->getInitializer())
-    StoreAnyExprIntoOneUnit(CGF, Init, E->getAllocatedType(), NewPtr);
+    StoreAnyExprIntoOneUnit(CGF, Init, E->getAllocatedType(), NewPtr,
+                            E->getStartLoc());
 }
 
 /// Emit a call to an operator new or operator delete function, as implicitly

Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=223937&r1=223936&r2=223937&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Wed Dec 10 13:04:09 2014
@@ -99,6 +99,16 @@ void f9(int i) {
       src1)[src2()];
 }
 
+void *operator new(unsigned long, void *);
+
+// CHECK-LABEL: define
+void f10() {
+  void *void_src();
+  ( // CHECK: store {{.*}} !dbg [[DBG_F10:!.*]]
+#line 1100
+      new (void_src()) int(src()));
+}
+
 // CHECK: [[DBG_F1]] = metadata !{i32 100,
 // CHECK: [[DBG_FOO_VALUE]] = metadata !{i32 200,
 // CHECK: [[DBG_FOO_REF]] = metadata !{i32 202,
@@ -111,3 +121,4 @@ void f9(int i) {
 // CHECK: [[DBG_F7]] = metadata !{i32 800,
 // CHECK: [[DBG_F8]] = metadata !{i32 900,
 // CHECK: [[DBG_F9]] = metadata !{i32 1000,
+// CHECK: [[DBG_F10]] = metadata !{i32 1100,





More information about the cfe-commits mailing list