summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CacheTokens.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Support: Simplify endian stream interface. NFCI.Peter Collingbourne2018-05-181-12/+11
| | | | | | | | | | | | Provide some free functions to reduce verbosity of endian-writing a single value, and replace the endianness template parameter with a field. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47032 llvm-svn: 332757
* Re-land: "[Support] Replace HashString with djbHash."Jonas Devlieghere2018-02-261-3/+3
| | | | | | | | | | | | | | | | | | | | | This patch removes the HashString function from StringExtraces and replaces its uses with calls to djbHash from DJB.h. This change is *almost* NFC. While the algorithm is identical, the djbHash implementation in StringExtras used 0 as its default seed while the implementation in DJB uses 5381. The latter has been shown to result in less collisions and improved avalanching and is used by the DWARF accelerator tables. Because some test were implicitly relying on the hash order, I've reverted to using zero as a seed for the following two files: lld/include/lld/Core/SymbolTable.h llvm/lib/Support/StringMap.cpp Differential revision: https://reviews.llvm.org/D43615 llvm-svn: 326091
* Revert "[Support] Replace HashString with djbHash."Jonas Devlieghere2018-02-261-3/+3
| | | | | | | | | | | | | It looks like some of our tests depend on the ordering of hashed values. I'm reverting my changes while I try to reproduce and fix this locally. Failing builds: lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/18388 lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/6743 lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/15607 llvm-svn: 326082
* [Support] Replace HashString with djbHash.Jonas Devlieghere2018-02-261-3/+3
| | | | | | | | | | | | | | | This removes the HashString function from StringExtraces and replaces its uses with calls to djbHash from DJB.h This is *almost* NFC. While the algorithm is identical, the djbHash implementation in StringExtras used 0 as its seed while the implementation in DJB uses 5381. The latter has been shown to result in less collisions and improved avalanching. https://reviews.llvm.org/D43615 (cherry picked from commit 77f7f965bc9499a9ae768a296ca5a1f7347d1d2c) llvm-svn: 326081
* Clean up use of C allocation functionsSerge Pavlov2018-02-211-1/+2
| | | | | | | | | | | | | | | | If the value returned by `malloc`, `calloc` or `realloc` is not checked for null pointer, this change replaces them for `safe_malloc`, `safe_calloc` or `safe_realloc`, which are defined in the namespace `llvm`. These function report fatal error on out of memory. In the plain C files, assertion statements are added to ensure that memory is successfully allocated. The aim of this change is to get better diagnostics of OOM on Windows. Differential Revision: https://reviews.llvm.org/D43017 llvm-svn: 325661
* Fix the build with MSVC 2013 after r283856Reid Kleckner2016-10-111-4/+8
| | | | llvm-svn: 283906
* Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)Mehdi Amini2016-10-111-6/+9
| | | | llvm-svn: 283856
* Remove excessive padding from PTHWriterAlexander Shaposhnikov2016-09-131-3/+3
| | | | | | | | | | | The class PTHWriter is in lib/Frontend/CacheTokens.cpp inside the anonymous namespace. This diff changes the order of fields an removes excessive padding. Test plan: make -j8 check-clang Differential revision: https://reviews.llvm.org/D23902 llvm-svn: 281385
* [NFC] Header cleanupMehdi Amini2016-07-181-2/+1
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* Reduce the number of implicit StringRef->std::string conversions by ↵Benjamin Kramer2016-02-131-2/+2
| | | | | | | | threading StringRef through more APIs. No functionality change intended. llvm-svn: 260815
* [PTH] Fix data length used for stat cache entriesReid Kleckner2015-11-021-1/+1
| | | | | | | | | | | | | | This came up in a boost build, which apparently uses PTH. This was broken in r187619 when we migrated it to uses llvm::fs instead of raw stat calls. Constructing a test case with a hash table collision in-tree is tough. Instead, I have a pending change to OnDiskChainedHashTable that asserts that the reported length of the data agrees with the data actually written. All of the existing in-tree tests find the bug with this assert. llvm-svn: 251828
* Sink some PTHManager includes out of Preprocessor.hReid Kleckner2015-11-021-0/+1
| | | | | | | This reduces the number of .cpp files needed to be rebuilt after touching OnDiskHashTable from 120 to 21 for me. llvm-svn: 251810
* Roll-back r250822.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* Use raw_pwrite_stream in clang.Rafael Espindola2015-04-141-10/+19
| | | | | | This is a small improvement to -emit-pth and allows llvm to start requiring it. llvm-svn: 234897
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie2014-11-191-5/+5
| | | | llvm-svn: 222306
* unique_ptr-ify FileSystemStatCache::setNextStatCacheDavid Blaikie2014-08-111-2/+4
| | | | | | | | | | And in the process, discover that FileManager::removeStatCache had a double-delete when removing an element from the middle of the list (at the beginning or the end of the list, there was no problem) and add a unit test to exercise the code path (which successfully crashed when run (with modifications to match the old API) without this patch applied) llvm-svn: 215388
* Improve memory ownership of vfs::Files in the FileSystemStatCache by using ↵David Blaikie2014-07-081-1/+2
| | | | | | | | | std::unique_ptr Spotted after a memory leak (due to the complexities of manual memory management) was fixed in 212466. llvm-svn: 212541
* [C++11] Use 'nullptr'. Frontend edition.Craig Topper2014-05-221-3/+3
| | | | llvm-svn: 209389
* Teach users of OnDiskHashTable to define hash_value and offset typesJustin Bogner2014-04-181-2/+8
| | | | | | | | This paves the way to making OnDiskHashTable work with hashes that are not 32 bits wide and to making OnDiskHashTable work very large hash tables. The LLVM change to use these types is upcoming. llvm-svn: 206640
* Remove OnDiskHashTable.h, since it's been moved to llvmJustin Bogner2014-04-181-6/+10
| | | | llvm-svn: 206637
* Reapply "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner2014-03-281-20/+39
| | | | | | | | | | | | | Committed this by accident before it was done last time. Original message: Rather than rolling our own functions to write little endian data to an ostream, we can use the support in llvm's EndianStream.h. No functional change. llvm-svn: 205061
* Revert "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner2014-03-281-39/+20
| | | | | | This reverts commit r205044. llvm-svn: 205047
* OnDiskHashTable: Use EndianStream.h to write little endian ostreamsJustin Bogner2014-03-281-20/+39
| | | | | | | | | Rather than rolling our own functions to write little endian data to an ostream, we can use the support in llvm's EndianStream.h. No functional change. llvm-svn: 205044
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-131-1/+1
| | | | | | class. llvm-svn: 203758
* Recommit virtual file systemBen Langmuir2014-02-201-2/+2
| | | | | | | | | | | Previously reverted in r201755 due to causing an assertion failure. I've removed the offending assertion, and taught the CompilerInstance to create a default virtual file system inside createFileManager. In the future, we should be able to reach into the CompilerInvocation to customize this behaviour without breaking clients that don't care. llvm-svn: 201818
* Reverting the virtual file system implementation, because it triggers an ↵Juergen Ributzka2014-02-201-2/+2
| | | | | | | | | | assertion in our internal build bots. This reverts commits 201618, 201635, 201636, 201639, 201685, 201691, and 201696. llvm-svn: 201755
* Initial implementation of virtual file systemBen Langmuir2014-02-191-2/+2
| | | | | | | | | | | | This adds the minimum virtual file system support to start migrating FileManager onto the VFS. Originally discussed here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035188.html Differential Revision: http://llvm-reviews.chandlerc.com/D2745 llvm-svn: 201618
* Use llvm::sys::fs::UniqueID for windows and unix.Rafael Espindola2013-08-011-23/+22
| | | | | | | | | | | | | | | | | | | This unifies the unix and windows versions of FileManager::UniqueDirContainer and FileManager::UniqueFileContainer by using UniqueID. We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we want to be able to construct fake ones, and file_status has different members on unix and windows. What the patch does is: * Record only the information that clang is actually using. * Use llvm::sys::fs::status instead of stat and fstat. * Use llvm::sys::fs::UniqueID * Delete the old windows versions of UniqueDirContainer and UniqueFileContainer since the "unix" one now works on windows too. llvm-svn: 187619
* Extend stat query APIs to explicitly specify if the query is forArgyrios Kyrtzidis2012-12-111-2/+2
| | | | | | | | | | a file or directory, allowing just a stat call if a file descriptor is not needed. Doing just 'stat' is faster than 'open/fstat/close'. This has the effect of cutting down system time for validating the input files of a PCH. llvm-svn: 169831
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Switch PTH format from a 7 byte magic number to an 8 byte one, to avoidRichard Smith2012-08-171-1/+1
| | | | | | misaligned reads throughout the file. Bump PTH format version to 10. llvm-svn: 162076
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-1/+1
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-10/+10
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Make more use of llvm::StringRef in various APIs. In particular, don'tJay Foad2011-06-211-4/+3
| | | | | | use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
* Currently we can only remap a file by creating a MemoryBuffer and replacing ↵Argyrios Kyrtzidis2011-03-051-1/+1
| | | | | | | | | the file contents with it. Allow remapping a file by specifying another filename whose contents should be loaded if the original file gets loaded. This allows to override files without having to create & load buffers in advance. llvm-svn: 127052
* Rename tok::eom to tok::eod.Peter Collingbourne2011-02-281-2/+2
| | | | | | | | The previous name was inaccurate as this token in fact appears at the end of every preprocessing directive, not just macro definitions. No functionality change, except for a diagnostic tweak. llvm-svn: 126631
* Introduced raw_identifier token kind.Abramo Bagnara2010-12-221-4/+4
| | | | llvm-svn: 122394
* Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.Michael J. Spencer2010-12-211-2/+3
| | | | llvm-svn: 122340
* Replace all uses of PathV1::isAbsolute with PathV2::is_{absolute,relative}.Michael J. Spencer2010-12-171-3/+2
| | | | llvm-svn: 122087
* Merge System into Support.Michael J. Spencer2010-11-291-1/+1
| | | | llvm-svn: 120297
* change the 'is directory' indicator to be a null-or-notChris Lattner2010-11-231-2/+3
| | | | | | | | | pointer that is passed down through the APIs, and make FileSystemStatCache::get be the one that filters out directory lookups that hit files. This also paves the way to have stat queries be able to return opened files. llvm-svn: 120060
* simplify the cache miss handling code, eliminating CacheMissing.Chris Lattner2010-11-231-8/+3
| | | | llvm-svn: 120038
* rework the stat cache, pulling it out of FileManager.h intoChris Lattner2010-11-231-13/+19
| | | | | | | its own header and giving it some more structure. No functionality change. llvm-svn: 120030
* zap dead code.Chris Lattner2010-09-041-2/+0
| | | | llvm-svn: 113074
* PTH generation: Don't save the leading '#' token in a null directive. This ↵Ted Kremenek2010-07-271-4/+9
| | | | | | unbreaks using PTH with Boost (<rdar://problem/8227989>). llvm-svn: 109484
* push some source location information down through the compiler,Chris Lattner2010-04-201-3/+2
| | | | | | | | into ContentCache::getBuffer. This allows it to produce diagnostics on the broken #include line instead of without a location. llvm-svn: 101939
* Make some typedefs privateKovarththanan Rajaratnam2010-03-181-2/+3
| | | | llvm-svn: 98817
OpenPOWER on IntegriCloud