diff mbox series

[02/11] cp_tree::maybe_add_location_wrapper: no-op for template decls

Message ID 1510973563-10046-3-git-send-email-dmalcolm@redhat.com
State New
Headers show
Series C++: locations for (almost) everything (PR 43486) | expand

Commit Message

David Malcolm Nov. 18, 2017, 2:52 a.m. UTC
For simplicity, add a gate on !processing_template_decl
to cp_tree::maybe_add_location_wrapper.

gcc/cp/ChangeLog:
	* cp-tree.h (cp_expr::maybe_add_location_wrapper): Do nothing if
	processing_template_decl.
---
 gcc/cp/cp-tree.h | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 03087f0..63e9bff 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -93,11 +93,7 @@  public:
     set_location (make_location (m_loc, start, finish));
   }
 
-  cp_expr& maybe_add_location_wrapper ()
-  {
-    m_value = maybe_wrap_with_location (m_value, m_loc);
-    return *this;
-  }
+  cp_expr& maybe_add_location_wrapper ();
 
  private:
   tree m_value;
@@ -1642,6 +1638,16 @@  struct warning_sentinel
   ~warning_sentinel() { flag = val; }
 };
 
+inline cp_expr&
+cp_expr::maybe_add_location_wrapper ()
+{
+  /* For now, don't add wrappers when processing template decls.  */
+  if (!processing_template_decl)
+    m_value = maybe_wrap_with_location (m_value, m_loc);
+  return *this;
+}
+
+
 /* The cached class binding level, from the most recently exited
    class, or NULL if none.  */