aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-07-20 20:16:53 +0000
committerJeffrey Yasskin <jyasskin@gcc.gnu.org>2010-07-20 20:16:53 +0000
commit0603fe683c89ccf3c1663817c44f0d320a57ba5e (patch)
treed182d7caab0a17dadf100fabc2f21a970aaac53e /gcc/testsuite/lib
parent1b47fe3fe5a6ddc89896e73a8ec831750bcf69b0 (diff)
downloadgcc-0603fe683c89ccf3c1663817c44f0d320a57ba5e.zip
gcc-0603fe683c89ccf3c1663817c44f0d320a57ba5e.tar.gz
gcc-0603fe683c89ccf3c1663817c44f0d320a57ba5e.tar.bz2
re PR c++/44641 (Generated constructors and destructors get wrong debug location when a typedef uses a forward declaration of the type before the definition)
PR c++/44641 * gcc/cp/pt.c (instantiate_class_template): Propagate the template's location to its instance. * gcc/testsuite/lib/scanasm.exp (dg-function-on-line): Test that a function is defined on the current line. * gcc/testsuite/g++.dg/debug/dwarf2/lineno-simple1.C: New. Line number sanity test. * gcc/testsuite/g++.dg/debug/dwarf2/pr44641.C: New. From-SVN: r162349
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r--gcc/testsuite/lib/scanasm.exp37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index abc01b7..aa8383d43 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -291,3 +291,40 @@ proc scan-assembler-dem-not { args } {
fail "$testcase scan-assembler-dem-not $pp_pattern"
}
}
+
+# Utility for testing that a function is defined on the current line.
+# Call pass if so, otherwise fail. Invoked directly; the file must
+# have been compiled with -g -dA.
+#
+# Argument 0 is the current line, passed implicitly by dejagnu
+# Argument 1 is the function to check
+# Argument 2 handles expected failures and the like
+# Argument 3 is "." to match the current line, or an integer to match
+# an explicit line.
+proc dg-function-on-line { args } {
+ # Upvar from dg-final:
+ upvar dg-final-code final-code
+
+ set line [lindex $args 0]
+ set symbol [lindex $args 1]
+ set failures [lindex $args 2]
+
+ if { [llength $args] >= 4 } {
+ switch [lindex $args 3] {
+ "." { }
+ "default" { set line [lindex $args 3] }
+ }
+ }
+
+ set pattern [format {%s:[^\t]*(\t.file[^\t]*)?\t# \S*:%d\n} \
+ $symbol $line]
+
+ # The lack of spaces around $pattern is important, since they'd
+ # become part of the regex scan-assembler tries to match.
+ set cmd "scan-assembler {$pattern}"
+ if { [llength $args] >= 3 } {
+ set cmd "$cmd {$failures}"
+ }
+
+ append final-code "$cmd\n"
+}