Go to file
Tom Tromey 46427374e1 Linemap infrastructure for virtual locations
This is the first instalment of a set which goal is to track locations
of tokens across macro expansions.  Tom Tromey did the original work
and attached the patch to PR preprocessor/7263.  This opus is a
derivative of that original work.

This patch modifies the linemap module of libcpp to add virtual
locations support.

A virtual location is a mapped location that can resolve to several
different physical locations.  It can always resolve to the spelling
location of a token.  For tokens resulting from macro expansion it can
resolve to:
  - either the location of the expansion point of the macro.
  - or the location of the token in the definition of the
  macro
  - or, if the token is an argument of a function-like macro,
  the location of the use of the matching macro parameter in
  the definition of the macro

The patch creates a new type of line map called a macro map.  For every
single macro expansion, there is a macro map that generates a virtual
location for every single resulting token of the expansion.

The good old type of line map we all know is now called an ordinary
map.  That one still encodes spelling locations as it has always had.

As a result linemap_lookup as been extended to return a macro map when
given a virtual location resulting from a macro expansion.  The layout
of structs line_map has changed to support this new type of map.  So
did the layout of struct line_maps.  Accessor macros have been
introduced to avoid messing with the implementation details of these
datastructures directly.  This helped already as we have been testing
different ways of arranging these datastructure.  Having to constantly
adjust client code that is too tied with the internals of line_map and
line_maps would have been even more painful.

Of course, many new public functions have been added to the linemap
module to handle the resolution of virtual locations.

This patch introduces the infrastructure but no part of the compiler
uses virtual locations yet.

However the client code of the linemap data structures has been
adjusted as per the changes.  E.g, it's not anymore reliable for a
client code to manipulate struct line_map directly if it just wants to
deal with spelling locations, because struct line_map can now
represent a macro map as well.  In that case, it's better to use the
convenient API to resolve the initial (possibly virtual) location to a
spelling location (or to an ordinary map) and use that.

This is the reason why the patch adjusts the Java, Ada and Fortran
front ends.

Also, note that virtual locations are not supposed to be ordered for
relations '<' and '>' anymore.  To test if a virtual location appears
"before" another one, one has to use a new operator exposed by the
line map interface.  The patch updates the only spot (in the
diagnostics module) I have found that was making the assumption that
locations were ordered for these relations.  This is the only change
that introduces a use of the new line map API in this patch, so I am
adding a regression test for it only.

From-SVN: r180081
2011-10-17 11:58:56 +02:00
INSTALL
boehm-gc configure.ac (THREADS): Remove posix95. 2011-08-08 15:39:35 +00:00
config Centralize PICFLAG configuration 2011-08-22 16:54:02 +00:00
contrib testsuite-management: New. 2011-09-13 16:24:47 -04:00
fixincludes 2011-09-26 Tristan Gingold <gingold@adacore.com> 2011-09-26 12:12:51 +00:00
gcc Linemap infrastructure for virtual locations 2011-10-17 11:58:56 +02:00
gnattools Makefile.in (LOOSE_WARN): Delete. 2011-10-12 22:41:57 +00:00
include timeval-utils.h: New file. 2011-09-28 19:09:50 +00:00
intl Fix unportable shell quoting. 2010-09-27 20:19:41 +00:00
libada Makefile.in (LOOSE_WARN): Delete. 2011-10-12 22:41:57 +00:00
libcpp Linemap infrastructure for virtual locations 2011-10-17 11:58:56 +02:00
libdecnumber remove useless if-before-free tests 2011-04-20 18:19:03 +00:00
libffi re PR libffi/49594 (bootstrap failure in libffi:darwin_closure for powerpc-darwin8) 2011-09-04 19:19:39 +00:00
libgcc * generic-morestack-thread.c: #include <errno.h>. 2011-10-07 22:52:28 +00:00
libgfortran re PR fortran/49479 (reshape / optionals / zero sized arrays) 2011-09-10 14:06:57 +00:00
libgo mksysinfo: #include <ttold.h> on Irix. 2011-09-28 13:14:11 +00:00
libgomp posix95: Remove empty directory. 2011-10-10 19:27:31 +00:00
libiberty re PR c++/48665 (type of const member function) 2011-10-10 20:34:20 +00:00
libjava The commands of the $(TOOLS_ZIP) rule include copying of two subtrees from the source tree (asm/ and classes/). 2011-09-29 11:37:47 +00:00
libmudflap re PR middle-end/43513 (The stack pointer is adjusted twice) 2011-07-31 10:02:12 +00:00
libobjc In libobjc/: 2011-10-09 Nicola Pero <nicola.pero@meta-innovation.com> 2011-10-09 10:29:50 +00:00
libquadmath Makefile.am (FLAGS_TO_PASS): Define. 2011-09-21 15:36:03 +01:00
libssp re PR bootstrap/48135 (build fails on Solaris2.8 due to Glob.pm not found within /usr/perl5) 2011-03-21 12:24:17 +00:00
libstdc++-v3 41975.cc: New. 2011-10-14 11:25:27 +00:00
lto-plugin re PR lto/47247 (Linker plugin specification makes it difficult to handle COMDATs) 2011-10-02 10:41:24 +00:00
maintainer-scripts update_version_svn (IGNORE_BRANCHES): Add gcc-4_3-branch. 2011-06-27 11:05:50 +00:00
zlib Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 11:45:53 +00:00
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception. 2009-04-09 17:00:19 +02:00
COPYING3
COPYING3.LIB
ChangeLog * MAINTAINERS (sparc port): Remove myself. 2011-09-21 08:13:33 +02:00
ChangeLog.tree-ssa
MAINTAINERS * MAINTAINERS (sparc port): Remove myself. 2011-09-21 08:13:33 +02:00
Makefile.def Makefile.def (language=c++): Add check-c++0x and check-target-libmudflap-c++. 2011-07-16 23:34:13 -04:00
Makefile.in Makefile.tpl (POSTSTAGE1_CONFIGURE_FLAGS): Add libsupc++ to link directories. 2011-07-20 12:08:11 -04:00
Makefile.tpl Makefile.tpl (POSTSTAGE1_CONFIGURE_FLAGS): Add libsupc++ to link directories. 2011-07-20 12:08:11 -04:00
README README: Refer to the various COPYING* files instead of just COPYING. 2009-10-10 20:59:49 +00:00
compile Update automake-provided files in the toplevel. 2009-08-22 11:47:16 +00:00
config-ml.in MAINTAINERS (crx port, [...]): Remove. 2011-03-22 19:58:18 +00:00
config.guess oops - omitted from previous delta. 2011-06-06 10:34:35 +00:00
config.rpath Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 11:45:53 +00:00
config.sub Sync from upstream: 2011-06-06 10:33:11 +00:00
configure configure.ac (tic6x-*-*): Remove gdb from noconfigdirs. 2011-08-14 12:25:15 +00:00
configure.ac configure.ac (tic6x-*-*): Remove gdb from noconfigdirs. 2011-08-14 12:25:15 +00:00
depcomp Update automake-provided files in the toplevel. 2009-08-22 11:47:16 +00:00
install-sh Update automake-provided files in the toplevel. 2009-08-22 11:47:16 +00:00
libtool-ldflags
libtool.m4 Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 11:45:53 +00:00
ltgcc.m4
ltmain.sh backport: ltmain.sh (relink): Use absolute path when hardcoding with -L. 2011-01-13 18:51:10 +00:00
ltoptions.m4 Sync from git Libtool and regenerate. 2009-12-05 17:18:53 +00:00
ltsugar.m4
ltversion.m4 Sync from git Libtool and regenerate. 2009-12-05 17:18:53 +00:00
lt~obsolete.m4 Sync from git Libtool and regenerate. 2009-12-05 17:18:53 +00:00
missing Update automake-provided files in the toplevel. 2009-08-22 11:47:16 +00:00
mkdep
mkinstalldirs Update automake-provided files in the toplevel. 2009-08-22 11:47:16 +00:00
move-if-change Import move-if-change script from gnulib. 2011-02-12 15:48:30 +00:00
symlink-tree
ylwrap Update automake-provided files in the toplevel. 2009-08-22 11:47:16 +00:00

README

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.