Skip to content
  1. Feb 11, 2011
    • Zhanyong Wan's avatar
      Improves Clang's virtual file handling. · e1dd3e2c
      Zhanyong Wan authored
      This patch contains:
      
      - making some of the existing comments more accurate in the presence
      of virtual files/directories.
      
      - renaming some private data members of FileManager to match their roles better.
      
      - creating 'DirectorEntry's for the parent directories of virtual
      files, such that we can tell whether two virtual files are from the
      same directory.  This is useful for injecting virtual files whose
      directories don't exist in the real file system.
      
      - minor clean-ups and adding comments for class
      FileManager::UniqueDirContainer and FileManager::UniqueFileContainer.
      
      - adding statistics on virtual files to FileManager::PrintStats().
      
      - adding unit tests to verify the existing and new behavior of FileManager.
      
      llvm-svn: 125384
      e1dd3e2c
  2. Feb 10, 2011
    • Douglas Gregor's avatar
      Implement two related optimizations that make de-serialization of · 09b6989e
      Douglas Gregor authored
      AST/PCH files more lazy:
        - Don't preload all of the file source-location entries when reading
        the AST file. Instead, load them lazily, when needed.
        - Only look up header-search information (whether a header was already
        #import'd, how many times it's been included, etc.) when it's needed
        by the preprocessor, rather than pre-populating it.
      
      Previously, we would pre-load all of the file source-location entries,
      which also populated the header-search information structure. This was
      a relatively minor performance issue, since we would end up stat()'ing
      all of the headers stored within a AST/PCH file when the AST/PCH file
      was loaded. In the normal PCH use case, the stat()s were cached, so
      the cost--of preloading ~860 source-location entries in the Cocoa.h
      case---was relatively low.
      
      However, the recent optimization that replaced stat+open with
      open+fstat turned this into a major problem, since the preloading of
      source-location entries would now end up opening those files. Worse,
      those files wouldn't be closed until the file manager was destroyed,
      so just opening a Cocoa.h PCH file would hold on to ~860 file
      descriptors, and it was easy to blow through the process's limit on
      the number of open file descriptors.
      
      By eliminating the preloading of these files, we neither open nor stat
      the headers stored in the PCH/AST file until they're actually needed
      for something. Concretely, we went from
      
      *** HeaderSearch Stats:
      835 files tracked.
        364 #import/#pragma once files.
        823 included exactly once.
        6 max times a file is included.
        3 #include/#include_next/#import.
          0 #includes skipped due to the multi-include optimization.
      1 framework lookups.
      0 subframework lookups.
      
      *** Source Manager Stats:
      835 files mapped, 3 mem buffers mapped.
      37460 SLocEntry's allocated, 11215575B of Sloc address space used.
      62 bytes of files mapped, 0 files with line #'s computed.
      
      with a trivial program that uses a chained PCH including a Cocoa PCH
      to
      
      *** HeaderSearch Stats:
      4 files tracked.
        1 #import/#pragma once files.
        3 included exactly once.
        2 max times a file is included.
        3 #include/#include_next/#import.
          0 #includes skipped due to the multi-include optimization.
      1 framework lookups.
      0 subframework lookups.
      
      *** Source Manager Stats:
      3 files mapped, 3 mem buffers mapped.
      37460 SLocEntry's allocated, 11215575B of Sloc address space used.
      62 bytes of files mapped, 0 files with line #'s computed.
      
      for the same program.
      
      llvm-svn: 125286
      09b6989e
  3. Feb 08, 2011
  4. Feb 05, 2011
    • Douglas Gregor's avatar
      Improve our uniquing of file entries when files are re-saved or are · 606c4ac3
      Douglas Gregor authored
      overridden via remapping. Thus, when we create a "virtual" file in the
      file manager, we still stat() the real file that lives behind it so
      that we can provide proper uniquing based on inodes. This helps keep
      the file manager much more consistent.
      
      To take advantage of this when reparsing files in libclang, we disable
      the use of the stat() cache when reparsing or performing code
      completion, since the stat() cache is very likely to be out of date in
      this use case.
      
      llvm-svn: 124971
      606c4ac3
  5. Feb 03, 2011
  6. Feb 02, 2011
    • Douglas Gregor's avatar
      Canonicalize path names in the file manager before performing a lookup · 3c0d263a
      Douglas Gregor authored
      on that name. Canonicalization eliminates silliness such as "." and
      "foo/.." that breaks the uniquing of files in the presence of virtual
      files or files whose inode numbers have changed during
      parsing/re-parsing. c-index-test isn't able to create this crazy
      situation, so I've resorted to testing outside of the Clang
      tree. Fixes <rdar://problem/8928220>.
      
      Note that this hackery will go away once we have a real virtual file
      system on which we can layer FileManager; the virtual-files hack is
      showing cracks.
      
      llvm-svn: 124754
      3c0d263a
  7. Jan 27, 2011
    • Axel Naumann's avatar
      TextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with... · 63fbaeda
      Axel Naumann authored
      TextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with invalid PresomedLoc, instead of just silencing it.
      
      FileManager.cpp: Allow virtual files in nonexistent directories.
      FileManager.cpp: Close FileDescriptor for virtual files that correspond to actual files.
      FileManager.cpp: Enable virtual files to be created even for files that were flagged as NON_EXISTENT_FILE, e.g. by a prior (unsuccessful) addFile().
      
      ASTReader.cpp: Read a PCH even if the original source files cannot be found.
      
      Add a test for reading a PCH of a file that has been removed and diagnostics referencing that file.
      
      llvm-svn: 124374
      63fbaeda
  8. Dec 21, 2010
  9. Dec 17, 2010
  10. Dec 16, 2010
  11. Dec 09, 2010
  12. Dec 02, 2010
  13. Nov 29, 2010
  14. Nov 23, 2010
  15. Nov 21, 2010
  16. Nov 03, 2010
    • Argyrios Kyrtzidis's avatar
      Implement -working-directory. · 71731d6b
      Argyrios Kyrtzidis authored
      When -working-directory is passed in command line, file paths are resolved relative to the specified directory.
      This helps both when using libclang (where we can't require the user to actually change the working directory)
      and to help reproduce test cases when the reproduction work comes along.
      
      --FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains
       the working directory value if set).
      --FileSystemOptions are passed around to various interfaces that perform file operations.
      --Opening & reading the content of files should be done only through FileManager. This is useful in general since
       file operations will be abstracted in the future for the reproduction mechanism.
      
      FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same
      FileManager but with different FileSystemOptions.
      
      Addresses rdar://8583824.
      
      llvm-svn: 118203
      71731d6b
  17. Aug 24, 2010
    • Chris Lattner's avatar
      fix PR7953 - Windows filename are case insensitive: · 84602249
      Chris Lattner authored
      #pragma once wasn't working on win32 if the header file was included
      using a different case.
      I tracked down  the problem to the fact that clang::FileManager was
      caching files using case sensitive string (UniqueFiles) on Windows.
      
      I changed FileManager to cache filename in lower case only.
      Doesn't affect UNIX because UNIX uses Inode to uniquely identify files.
      
      unix doesn't use this codepath.
      
      Analysis and patch by Francois Pichet!
      
      llvm-svn: 111866
      84602249
  18. Jul 27, 2010
  19. Jul 15, 2010
  20. Dec 18, 2009
  21. Dec 11, 2009
    • Daniel Dunbar's avatar
      FileManager: Do not cache failed stats, it is easy to construct common · 2f1a6c11
      Daniel Dunbar authored
      inconsistent situations if we do, and they are not important for PCH performance
      (which currently only needs the stats to construct the initial FileManager
      entries).
       - No test case, sorry, the machinations are too involved.
      
      This occurs when, for example, the build makes a PCH file and has a header map
      or a -I for a directory that does not yet exist. It is possible we will cache
      the negative stat on that directory, and then in the build we will never find
      header files inside that dir.
      
      For PCH we don't need these stats anyway for performance, so this also makes PCH
      files smaller w/ no loss. I hope to eventually eliminate the stat cache
      entirely.
      
      llvm-svn: 91082
      2f1a6c11
  22. Dec 02, 2009
    • Douglas Gregor's avatar
      Extend -remap-file=from;to to permit mapping from a non-existent · 407e2124
      Douglas Gregor authored
      file. This is accomplished by introducing the notion of a "virtual"
      file into the file manager, which provides a FileEntry* for a named
      file whose size and modification time are known but which may not
      exist on disk.
      
      Added a cute little test that remaps both a .c file and a .h file it
      includes to alternative files.
      
      llvm-svn: 90329
      407e2124
  23. Oct 16, 2009
  24. Sep 18, 2009
  25. Sep 09, 2009
Loading