[llvm-branch-commits] [llvm-gcc-branch] r108867 - in /llvm-gcc-4.2/branches/Apple/Morbo: ./ gcc/cp/pt.c gcc/llvm-convert.cpp gcc/llvm-debug.cpp

Stuart Hastings stuart at apple.com
Tue Jul 20 10:20:11 PDT 2010


Author: stuart
Date: Tue Jul 20 12:20:11 2010
New Revision: 108867

URL: http://llvm.org/viewvc/llvm-project?rev=108867&view=rev
Log:
Merge r108784, r108785, r108786 into Morbo branch.  Radar 8063111.

Modified:
    llvm-gcc-4.2/branches/Apple/Morbo/   (props changed)
    llvm-gcc-4.2/branches/Apple/Morbo/gcc/cp/pt.c
    llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp
    llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-debug.cpp

Propchange: llvm-gcc-4.2/branches/Apple/Morbo/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 20 12:20:11 2010
@@ -1,2 +1,2 @@
 /llvm/trunk:100565
-/llvm-gcc-4.2/trunk:98728,98841,98893,99196,99305,99592-99593,99629,99670,99982,99984-99986,99988,99992-99993,99995,99997-99999,100035,100149,100303,100565,100624-100626,100712,100721,101090-101091,101199,101216,101304,101333,101804,101959,102139,102148,102433,102444,102506-102507,102511,102532,102561,102589,102636,102648,102745,103361,103366-103367,103394,103414,103644,103800,103918,104181,104384,104420,104423,104523,104726,105504,105828-105829,105902,105948-105949,106005,106243-106244,106270,106352,106564,106611-106612,106681,106690,106711,107062,107843
+/llvm-gcc-4.2/trunk:98728,98841,98893,99196,99305,99592-99593,99629,99670,99982,99984-99986,99988,99992-99993,99995,99997-99999,100035,100149,100303,100565,100624-100626,100712,100721,101090-101091,101199,101216,101304,101333,101804,101959,102139,102148,102433,102444,102506-102507,102511,102532,102561,102589,102636,102648,102745,103361,103366-103367,103394,103414,103644,103800,103918,104181,104384,104420,104423,104523,104726,105504,105828-105829,105902,105948-105949,106005,106243-106244,106270,106352,106564,106611-106612,106681,106690,106711,107062,107843,108784-108786

Modified: llvm-gcc-4.2/branches/Apple/Morbo/gcc/cp/pt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Morbo/gcc/cp/pt.c?rev=108867&r1=108866&r2=108867&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Morbo/gcc/cp/pt.c (original)
+++ llvm-gcc-4.2/branches/Apple/Morbo/gcc/cp/pt.c Tue Jul 20 12:20:11 2010
@@ -6696,8 +6696,6 @@
 	   template, and in any case are considered separate under the
 	   discrete model.  */
 	r = copy_decl (t);
-        /* LLVM LOCAL 7514620 */
-        DECL_SOURCE_LOCATION(r) = saved_loc;
 	DECL_USE_TEMPLATE (r) = 0;
 	TREE_TYPE (r) = type;
 	/* Clear out the mangled name and RTL for the instantiation.  */

Modified: llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp?rev=108867&r1=108866&r2=108867&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp Tue Jul 20 12:20:11 2010
@@ -960,19 +960,20 @@
 
   Value *Result = 0;
 
+  bool emitdebuginfo = EmitDebugInfo();
+
+  if (emitdebuginfo && EXPR_HAS_LOCATION(exp)) {
+    // Set new location on the way up the tree.
+    TheDebugInfo->setLocationFile(EXPR_FILENAME(exp));
+    TheDebugInfo->setLocationLine(EXPR_LINENO(exp));
+  }
+
   // If we've just changed lexical blocks, emit any local variables
   // declared in the new block.
   TreeToLLVM::switchLexicalBlock(exp);
 
-  if (EmitDebugInfo()) {
-    if (EXPR_HAS_LOCATION(exp)) {
-      // Set new location on the way up the tree.
-      TheDebugInfo->setLocationFile(EXPR_FILENAME(exp));
-      TheDebugInfo->setLocationLine(EXPR_LINENO(exp));
-    }
-
+  if (emitdebuginfo)
     TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
-  }
 
   switch (TREE_CODE(exp)) {
   default:

Modified: llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-debug.cpp?rev=108867&r1=108866&r2=108867&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-debug.cpp Tue Jul 20 12:20:11 2010
@@ -286,13 +286,7 @@
     RegionStack.pop_back();
   }
   DebugInfo::push_regions(desired, grand);
-  // There's no point in declaring an empty (declares no variables)
-  // lexical BLOCK as the current lexical BLOCK.  Locate nearest
-  // non-empty ancestor BLOCK and declare that.
-  for (t = desired; TREE_CODE(t) == BLOCK; t = BLOCK_SUPERCONTEXT(t))
-    if (BLOCK_VARS(t))
-      break;
-  setCurrentLexicalBlock(t);
+  setCurrentLexicalBlock(desired);
 }
 
 /// CreateSubprogramFromFnDecl - Constructs the debug code for
@@ -422,11 +416,41 @@
   return DNS;
 }
 
-/// findRegion - Find tree_node N's region.
-DIDescriptor DebugInfo::findRegion(tree Node) {
-  if (Node == NULL_TREE)
+/// findRegion - Find the region (context) of a GCC tree.
+DIDescriptor DebugInfo::findRegion(tree exp) {
+  if (exp == NULL_TREE)
     return getOrCreateFile(main_input_filename);
 
+  tree Node = exp;
+  location_t *p_locus = 0;
+  tree_code code = TREE_CODE(exp);
+  enum tree_code_class tree_cc = TREE_CODE_CLASS(code);
+  switch (tree_cc) {
+  case tcc_declaration:  /* A decl node */
+    p_locus = &DECL_SOURCE_LOCATION(exp);
+    break;
+
+  case tcc_expression:  /* an expression */
+  case tcc_comparison:  /* a comparison expression */
+  case tcc_unary:  /* a unary arithmetic expression */
+  case tcc_binary:  /* a binary arithmetic expression */
+    Node = TREE_BLOCK(exp);
+    p_locus = EXPR_LOCUS(exp);
+    break;
+
+  case tcc_exceptional:
+    switch (code) {
+    case BLOCK:
+      p_locus = &BLOCK_SOURCE_LOCATION(Node);
+      break;
+    default:
+      gcc_unreachable ();
+    }
+    break;
+  default:
+    break;
+  }
+
   std::map<tree_node *, WeakVH>::iterator I = RegionMap.find(Node);
   if (I != RegionMap.end())
     if (MDNode *R = dyn_cast_or_null<MDNode>(I->second))
@@ -451,11 +475,21 @@
     }
     }
   } else if (TREE_CODE(Node) == BLOCK) {
-    // TREE_BLOCK is GCC's lexical block.
-    // Recursively create all necessary contexts:
+    // Recursively establish ancestor scopes.
     DIDescriptor context = findRegion(BLOCK_SUPERCONTEXT(Node));
+    // If we don't have a location, use the last-seen info.
+    unsigned int line;
+    const char *fullpath;
+    if (LOCATION_FILE(*p_locus) == (char*)0) {
+      fullpath = CurFullPath;
+      line = CurLineNo;
+    } else {
+      fullpath = LOCATION_FILE(*p_locus);
+      line = LOCATION_LINE(*p_locus);
+    }
+    DIFile F(getOrCreateFile(fullpath));
     DILexicalBlock lexical_block = 
-      DebugFactory.CreateLexicalBlock(context, CurLineNo);
+      DebugFactory.CreateLexicalBlock(context, F, line, 0U);
     RegionMap[Node] = WeakVH(lexical_block.getNode());
     return DIDescriptor(lexical_block);
   }





More information about the llvm-branch-commits mailing list