Skip to content
  1. Jan 16, 2009
  2. Jan 15, 2009
    • Ted Kremenek's avatar
      IdentifierInfo: · a705b04d
      Ted Kremenek authored
      - IdentifierInfo can now (optionally) have its string data not be
        co-located with itself.  This is for use with PTH.  This aspect is a
        little gross, as getName() and getLength() now make assumptions
        about a possible alternate representation of IdentifierInfo.
        Perhaps we should make IdentifierInfo have virtual methods?
      
      IdentifierTable:
      - Added class "IdentifierInfoLookup" that can be used by
        IdentifierTable to perform "string -> IdentifierInfo" lookups using
        an auxilliary data structure.  This is used by PTH.
      - Perform tests show that IdentifierTable::get() does not slow down
        because of the extra check for the IdentiferInfoLookup object (the
        regular StringMap lookup does enough work to mitigate the impact of
        an extra null pointer check).
      - The upshot is that now that some IdentifierInfo objects might be
        owned by the IdentiferInfoLookup object.  This should be reviewed.
      
      PTH:
      - Modified PTHManager::GetIdentifierInfo to *not* insert entries in
        IdentifierTable's string map, and instead create IdentifierInfo
        objects on the fly when mapping from persistent IDs to
        IdentifierInfos.  This saves a ton of work with string copies,
        hashing, and StringMap lookup and resizing.  This change was
        motivated because when processing source files in the PTH cache we
        don't need to do any string -> IdentifierInfo lookups.
      - PTHManager now subclasses IdentifierInfoLookup, allowing clients of
        IdentifierTable to transparently use IdentifierInfo objects managed
        by the PTH file.  PTHManager resolves "string -> IdentifierInfo"
        queries by doing a binary search over a sorted table of identifier
        strings in the PTH file (the exact algorithm we use can be changed
        as needed).
      
      These changes lead to the following performance changes when using PTH on Cocoa.h:
      - fsyntax-only: 10% performance improvement
      - Eonly: 30% performance improvement
      
      llvm-svn: 62273
      a705b04d
  3. Jan 12, 2009
  4. Jan 06, 2009
    • Ted Kremenek's avatar
      SourceManager: Implement "lazy" creation of MemBuffers for source files. · 763ea559
      Ted Kremenek authored
      - Big Idea:
         Source files are now mmaped when ContentCache::getBuffer() is first called.
         While this doesn't change the functionality when lexing regular source files,
         it can result in source files not being paged in when using PTH.
      
      - Performance change:
        - No observable difference (-fsyntax-only/-Eonly) on Cocoa.h when doing
          regular source lexing.
        - No observable time difference (-fsyntax-only/-Eonly) on Cocoa.h when using
          PTH. We do observe, however, a reduction of 279K in memory mapped source
          code (3% reduction). The majority of pages from Cocoa.h (and friends) are
          still being pulled in, however, because any literal will cause
          Preprocessor::getSpelling() to be called (causing the source for the file to
          get pulled in). The next possible optimization is to cache literal strings
          in the PTH file to avoid the need for the original header sources entirely.
      
      - Right now there is a preprocessor directive to toggle between "lazy" and
        "eager" creation of MemBuffers. This is not permanent, and is there in the
        short term to just test additional optimizations.
      
      llvm-svn: 61827
      763ea559
    • Ted Kremenek's avatar
      Misc changes to SourceManager::ContentCache: · 12c2af44
      Ted Kremenek authored
      - 'Buffer' is now private and must be accessed via 'getBuffer()'.
         This paves the way for lazily mapping in source files on demand.
      - Added 'getSize()' (which gets the size of the content without
         necessarily accessing the MemBuffer) and 'getSizeBytesMapped()'.
      - Modifed SourceManager to use these new methods.  This reduces the
        number of places that actually access the MemBuffer object for a file
        to those that actually look at the character data.
      
      These changes result in no performance change for -fsyntax-only on Cocoa.h.
      
      llvm-svn: 61782
      12c2af44
  5. Dec 05, 2008
  6. Dec 04, 2008
  7. Nov 27, 2008
  8. Nov 24, 2008
    • Chris Lattner's avatar
      Rename Selector::getName() to Selector::getAsString(), and add · e4b95698
      Chris Lattner authored
      a new NamedDecl::getAsString() method.
      
      Change uses of Selector::getName() to just pass in a Selector 
      where possible (e.g. to diagnostics) instead of going through
      an std::string.
      
      This also adds new formatters for objcinstance and objcclass
      as described in the dox.
      
      llvm-svn: 59933
      e4b95698
  9. Nov 23, 2008
  10. Nov 22, 2008
  11. Nov 21, 2008
    • Chris Lattner's avatar
      Add the concept of "modifiers" to the clang diagnostic format · 2b78690a
      Chris Lattner authored
      strings.  This allows us to have considerable flexibility in how
      these things are displayed and provides extra information that
      allows us to merge away diagnostics that are very similar.
      
      Diagnostic modifiers are a string of characters with the regex
      [-a-z]+ that occur between the % and digit.  They may 
      optionally have an argument that can parameterize them.
      
      For now, I've added two example modifiers.  One is a very useful
      tool that allows you to factor commonality across diagnostics
      that need single words or phrases combined.  Basically you can
      use %select{a|b|c}4 with with an integer argument that selects
      either a/b/c based on an integer value in the range [0..3).
      
      The second modifier is also an integer modifier, aimed to help
      English diagnostics handle plurality.  "%s3" prints to 's' if 
      integer argument #3 is not 1, otherwise it prints to nothing.
      I'm fully aware that 's' is an English concept and doesn't
      apply to all situations (mouse vs mice).  However, this is very
      useful and we can add other crazy modifiers once we add support
      for polish! ;-)
      
      I converted a couple C++ diagnostics over to use this as an
      example, I'd appreciate it if others could merge the other
      likely candiates.  If you have other modifiers that you want,
      lets talk on cfe-dev.
      
      llvm-svn: 59803
      2b78690a
  12. Nov 19, 2008
  13. Nov 18, 2008
    • Douglas Gregor's avatar
      Extend DeclarationName to support C++ overloaded operators, e.g., · 163c5850
      Douglas Gregor authored
      operator+, directly, using the same mechanism as all other special
      names.
      
      Removed the "special" identifiers for the overloaded operators from
      the identifier table and IdentifierInfo data structure. IdentifierInfo
      is back to representing only real identifiers.
      
      Added a new Action, ActOnOperatorFunctionIdExpr, that builds an
      expression from an parsed operator-function-id (e.g., "operator
      +"). ActOnIdentifierExpr used to do this job, but
      operator-function-ids are no longer represented by IdentifierInfo's.
      
      Extended Declarator to store overloaded operator names. 
      Sema::GetNameForDeclarator now knows how to turn the operator
      name into a DeclarationName for the overloaded operator. 
      
      Except for (perhaps) consolidating the functionality of
      ActOnIdentifier, ActOnOperatorFunctionIdExpr, and
      ActOnConversionFunctionExpr into a common routine that builds an
      appropriate DeclRefExpr by looking up a DeclarationName, all of the
      work on normalizing declaration names should be complete with this
      commit.
      
      llvm-svn: 59526
      163c5850
    • Chris Lattner's avatar
      This reworks some of the Diagnostic interfaces a bit to change how diagnostics · 8488c829
      Chris Lattner authored
      are formed.  In particular, a diagnostic with all its strings and ranges is now
      packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a 
      ton of random stuff.  This has the benefit of simplifying the interface, making
      it more extensible, and allowing us to do more checking for things like access
      past the end of the various arrays passed in.
      
      In addition to introducing DiagnosticInfo, this also substantially changes how 
      Diagnostic::Report works.  Instead of being passed in all of the info required
      to issue a diagnostic, Report now takes only the required info (a location and 
      ID) and returns a fresh DiagnosticInfo *by value*.  The caller is then free to
      stuff strings and ranges into the DiagnosticInfo with the << operator.  When
      the dtor runs on the DiagnosticInfo object (which should happen at the end of
      the statement), the diagnostic is actually emitted with all of the accumulated
      information.  This is a somewhat tricky dance, but it means that the 
      accumulated DiagnosticInfo is allowed to keep pointers to other expression 
      temporaries without those pointers getting invalidated.
      
      This is just the minimal change to get this stuff working, but this will allow
      us to eliminate the zillions of variant "Diag" methods scattered throughout
      (e.g.) sema.  For example, instead of calling:
      
        Diag(BuiltinLoc, diag::err_overload_no_match, typeNames,
             SourceRange(BuiltinLoc, RParenLoc));
      
      We will soon be able to just do:
      
        Diag(BuiltinLoc, diag::err_overload_no_match)
            << typeNames << SourceRange(BuiltinLoc, RParenLoc));
      
      This scales better to support arbitrary types being passed in (not just 
      strings) in a type-safe way.  Go operator overloading?!
      
      llvm-svn: 59502
      8488c829
    • Chris Lattner's avatar
      SourceManager::getLineNumber is logically const except for caching. · 746d474b
      Chris Lattner authored
      Use mutable to make it so.
      
      llvm-svn: 59498
      746d474b
    • Chris Lattner's avatar
      Change the diagnostics interface to take an array of pointers to · 16ba9139
      Chris Lattner authored
      strings instead of array of strings.  This reduces string copying
      in some not-very-important cases, but paves the way for future 
      improvements.
      
      llvm-svn: 59494
      16ba9139
  14. Nov 17, 2008
  15. Nov 16, 2008
  16. Nov 14, 2008
    • Douglas Gregor's avatar
      Add a new expression node, CXXOperatorCallExpr, which expresses a · 993603d8
      Douglas Gregor authored
      function call created in response to the use of operator syntax that
      resolves to an overloaded operator in C++, e.g., "str1 +
      str2" that resolves to std::operator+(str1, str2)". We now build a
      CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But
      only for binary operators, where we actually implement overloading)
      
      I decided *not* to refactor the current CallExpr to make it abstract
      (with FunctionCallExpr and CXXOperatorCallExpr as derived
      classes). Doing so would allow us to make CXXOperatorCallExpr a little
      bit smaller, at the cost of making the argument and callee accessors
      virtual. We won't know if this is going to be a win until we can parse
      lots of C++ code to determine how much memory we'll save by making
      this change vs. the performance penalty due to the extra virtual
      calls.
      
      llvm-svn: 59306
      993603d8
  17. Nov 13, 2008
    • Douglas Gregor's avatar
      Don't build identifiers for C++ constructors, destructors, or · b6acda0f
      Douglas Gregor authored
      conversion functions. Instead, we just use a placeholder identifier
      for these (e.g., "<constructor>") and override NamedDecl::getName() to
      provide a human-readable name.
      
      This is one potential solution to the problem; another solution would
      be to replace the use of IdentifierInfo* in NamedDecl with a different
      class that deals with identifiers better. I'm also prototyping that to
      see how it compares, but this commit is better than what we had
      previously.
      
      llvm-svn: 59193
      b6acda0f
  18. Nov 10, 2008
  19. Nov 06, 2008
  20. Nov 02, 2008
    • Eli Friedman's avatar
      More fallout from r58501: primary fix is some more corrections to make · d50881c6
      Eli Friedman authored
      the types for size_t and ptrdiff_t more accurate.  I think all of these
      are correct, but please compare the defines for __PTRDIFF_TYPE__ and 
      __SIZE_TYPE__ to gcc to double-check; this particularly applies to 
      those on BSD variants, since I'm not sure what they do here; I assume 
      here that they're the same as on Linux.
      
      Fixes wchar_t to be "int", not "unsigned int" (which I think is 
      correct on everything but Windows).
      
      Fixes ptrdiff_t to be "int" rather than "short" on PIC16; "short" is an 
      somewhat strange choice because it normally gets promoted, and it's not 
      consistent with the choice for size_t.
      
      llvm-svn: 58556
      d50881c6
  21. Oct 31, 2008
  22. Oct 27, 2008
  23. Oct 26, 2008
  24. Oct 17, 2008
Loading