]> granicus.if.org Git - clang/commitdiff
Call UpdateLineDirectiveRegion every time we want to emit a stop
authorEric Christopher <echristo@apple.com>
Thu, 29 Sep 2011 00:00:35 +0000 (00:00 +0000)
committerEric Christopher <echristo@apple.com>
Thu, 29 Sep 2011 00:00:35 +0000 (00:00 +0000)
point in the code. Ensures that we don't miss any places and the
check is reasonably cheap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140737 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGStmt.cpp

index b48475f432aeaded9ec126e3d9b3bf9e19b78d65..2edb065dd6e88f48029879f083109924aa7ae0f0 100644 (file)
@@ -1763,6 +1763,10 @@ void CGDebugInfo::EmitStopPoint(CGBuilderTy &Builder) {
     if (!Builder.getCurrentDebugLocation().isUnknown())
       return;
 
+  // The file may have had a line directive change. Process any of
+  // those before updating the state.
+  UpdateLineDirectiveRegion(Builder);
+  
   // Update last state.
   PrevLoc = CurLoc;
 
index fdc3baf2f370eca85dfc510ca1ab53816ebef76a..e59aed91a6a3d67dbed39ce834de348276bbd086 100644 (file)
@@ -149,6 +149,10 @@ class CGDebugInfo {
                          llvm::DIFile F,
                          SmallVectorImpl<llvm::Value *> &EltTys);
 
+  // UpdateLineDirectiveRegion - Update region stack only if #line directive
+  // has introduced scope change.
+  void UpdateLineDirectiveRegion(CGBuilderTy &Builder);
+
 public:
   CGDebugInfo(CodeGenModule &CGM);
   ~CGDebugInfo();
@@ -170,10 +174,6 @@ public:
   /// EmitFunctionEnd - Constructs the debug code for exiting a function.
   void EmitFunctionEnd(CGBuilderTy &Builder);
 
-  /// UpdateLineDirectiveRegion - Update region stack only if #line directive
-  /// has introduced scope change.
-  void UpdateLineDirectiveRegion(CGBuilderTy &Builder);
-
   /// UpdateCompletedType - Update type cache because the type is now
   /// translated.
   void UpdateCompletedType(const TagDecl *TD);
index 22f264b8e9f7466c827d6992688d1d22374945c7..5fe33ff1d3f18f31c5188c018ff6eb82bf84009c 100644 (file)
@@ -2170,7 +2170,6 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
                                      ReturnValueSlot ReturnValue) {
   if (CGDebugInfo *DI = getDebugInfo()) {
     DI->setLocation(E->getLocStart());
-    DI->UpdateLineDirectiveRegion(Builder);
     DI->EmitStopPoint(Builder);
   }
 
index 93763e31438c8d0d720367ad07f4e30d066636ed..e070cc312a993dd3556803dc9be9c1e66e98decf 100644 (file)
@@ -35,7 +35,6 @@ void CodeGenFunction::EmitStopPoint(const Stmt *S) {
       DI->setLocation(S->getLocEnd());
     else
       DI->setLocation(S->getLocStart());
-    DI->UpdateLineDirectiveRegion(Builder);
     DI->EmitStopPoint(Builder);
   }
 }