Skip to content
Snippets Groups Projects
  1. Dec 04, 2012
  2. Oct 03, 2011
  3. Sep 22, 2011
  4. Jul 07, 2011
    • Argyrios Kyrtzidis's avatar
      Make the Preprocessor more memory efficient and improve macro instantiation diagnostics. · b73377ee
      Argyrios Kyrtzidis authored
      When a macro instantiation occurs, reserve a SLocEntry chunk with length the
      full length of the macro definition source. Set the spelling location of this chunk
      to point to the start of the macro definition and any tokens that are lexed directly
      from the macro definition will get a location from this chunk with the appropriate offset.
      
      For any tokens that come from argument expansion, '##' paste operator, etc. have their
      instantiation location point at the appropriate place in the instantiated macro definition
      (the argument identifier and the '##' token respectively).
      This improves macro instantiation diagnostics:
      
      Before:
      
      t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
      int y = M(/);
              ^~~~
      t.c:5:11: note: instantiated from:
      int y = M(/);
                ^
      
      After:
      
      t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
      int y = M(/);
              ^~~~
      t.c:3:20: note: instantiated from:
      \#define M(op) (foo op 3);
                      ~~~ ^  ~
      t.c:5:11: note: instantiated from:
      int y = M(/);
                ^
      
      The memory savings for a candidate boost library that abuses the preprocessor are:
      
      - 32% less SLocEntries (37M -> 25M)
      - 30% reduction in PCH file size (900M -> 635M)
      - 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M)
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134587 91177308-0d34-0410-b5e6-96231b3b80d8
      b73377ee
  5. Dec 28, 2009
  6. Dec 15, 2009
  7. Dec 14, 2009
  8. Sep 09, 2009
  9. Mar 16, 2008
  10. Mar 09, 2008
Loading