summaryrefslogtreecommitdiffstats
path: root/lib/Lex/PTHLexer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Lex] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko2017-12-061-34/+55
| | | | | | minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319986 91177308-0d34-0410-b5e6-96231b3b80d8
* Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)Mehdi Amini2016-10-111-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283856 91177308-0d34-0410-b5e6-96231b3b80d8
* Store FileEntry::Filename as a StringRef instead of raw pointer (NFC)Mehdi Amini2016-10-101-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283815 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove excessive padding from PTHStatData (NFC)Mehdi Amini2016-08-241-2/+2
| | | | | | | | | | | | | This diff reorders the fields and removes excessive padding. This fixes the following warning: PTHLexer.cpp:629:7: warning: Excessive padding in 'class (anonymous namespace)::PTHStatData' (14 padding bytes, where 6 is optimal). Optimal fields order: Size, ModTime, UniqueID, HasData, IsDirectory, consider reordering the fields or adding explicit padding members. Patch by: Alexander Shaposhnikov <shal1t712@gmail.com> Differential Revision: https://reviews.llvm.org/D23826 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279607 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Header cleanupMehdi Amini2016-07-181-1/+0
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275882 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+2
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250827 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-2/+1
| | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250822 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240353 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240270 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace a few std::string& with StringRef. NFC.Rafael Espindola2015-06-011-2/+1
| | | | | | Patch by Косов Евгений! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238774 91177308-0d34-0410-b5e6-96231b3b80d8
* unique_ptrify PTHManager's PerIDCache using the newly added llvm::FreeDeleterDavid Blaikie2014-08-291-14/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216786 91177308-0d34-0410-b5e6-96231b3b80d8
* unique_ptrify some parameters to PTHManager::PTHManagerDavid Blaikie2014-08-291-35/+29
| | | | | | | | | A couple of these arguments were passed by void* as a rather extreme example of pimpling. Adjusting this to a more classic form of the idiom (involving forward declarations) makes this more legible and allows explicit passing of ownership via std::unique_ptr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216785 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the call to llvm::sys::fs::UniqueID to match the definition: ↵Sylvestre Ledru2014-08-181-1/+1
| | | | | | | | | | | UniqueID(uint64_t Device, uint64_t File) Fixes CID 1095247 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215896 91177308-0d34-0410-b5e6-96231b3b80d8
* unique_ptr-ify FileSystemStatCache::setNextStatCacheDavid Blaikie2014-08-111-2/+2
| | | | | | | | | | 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) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215388 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve memory ownership of vfs::Files in the FileSystemStatCache by using ↵David Blaikie2014-07-081-3/+2
| | | | | | | | | std::unique_ptr Spotted after a memory leak (due to the complexities of manual memory management) was fixed in 212466. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212541 91177308-0d34-0410-b5e6-96231b3b80d8
* PTH: use a variable instead of a macroAlp Toker2014-07-071-8/+10
| | | | | | Cleanup only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212457 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm api change.Rafael Espindola2014-07-061-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212408 91177308-0d34-0410-b5e6-96231b3b80d8
* Include system_error directly.Rafael Espindola2014-06-121-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210802 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. Lex edition.Craig Topper2014-05-171-18/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209083 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach users of OnDiskHashTable to define hash_value and offset typesJustin Bogner2014-04-181-8/+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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206640 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove OnDiskHashTable.h, since it's been moved to llvmJustin Bogner2014-04-181-5/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206637 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner2014-03-281-29/+57
| | | | | | | | | | | | | Committed this by accident before it was done last time. Original message: Rather than rolling our own functions to read little endian data from a buffer, we can use the support in llvm's Endian.h. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205062 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner2014-03-281-0/+1
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205061 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner2014-03-281-57/+29
| | | | | | This reverts commit r205045. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205048 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner2014-03-281-1/+0
| | | | | | This reverts commit r205044. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205047 91177308-0d34-0410-b5e6-96231b3b80d8
* OnDiskHashTable: Use Endian.h to read little endian ostreamsJustin Bogner2014-03-281-29/+57
| | | | | | | | | Rather than rolling our own functions to read little endian data from a buffer, we can use the support in llvm's Endian.h. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205045 91177308-0d34-0410-b5e6-96231b3b80d8
* OnDiskHashTable: Use EndianStream.h to write little endian ostreamsJustin Bogner2014-03-281-0/+1
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205044 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-111-1/+1
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203547 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace OwningPtr include with <memory>.Ahmed Charles2014-03-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203389 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-4/+4
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203279 91177308-0d34-0410-b5e6-96231b3b80d8
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-3/+3
| | | | | | This is a precursor to moving to std::unique_ptr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203275 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply fixed "Honour 'use-external-names' in FileManager"Ben Langmuir2014-02-281-0/+1
| | | | | | | | | | | | | | | | Was r202442 There were two issues with the original patch that have now been fixed. 1. We were memset'ing over a FileEntry in a test case. After adding a std::string to FileEntry, this still happened to not break for me. 2. I didn't pass the FileManager into the new compiler instance in compileModule. This was hidden in some cases by the fact I didn't clear the module cache in the test. Also, I changed the copy constructor for FileEntry, which was memcpy'ing in a (now) unsafe way. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202539 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Honour 'use-external-names' in FileManager"Ben Langmuir2014-02-271-1/+0
| | | | | | Revert r202442, which broke the buildbots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202443 91177308-0d34-0410-b5e6-96231b3b80d8
* Honour 'use-external-names' in FileManagerBen Langmuir2014-02-271-0/+1
| | | | | | | | Pass through the externally-visible names that we got from the VFS down to FileManager, and test that this is the name showing up in __FILE__, diagnostics, and debug information. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202442 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201818 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201755 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201618 91177308-0d34-0410-b5e6-96231b3b80d8
* Enforce safe usage of DiagnosticsEngine::getCustomDiagID()Alp Toker2014-01-261-1/+1
| | | | | | | | | | | | | | | | Replace the last incorrect uses and templatize the function to require a compile-time constant string preventing further misuse. The diagnostic formatter expects well-formed input and has undefined behaviour with arbitrary input or crafted user strings in source files. Accepting user input would also have caused unbounded generation of new diagnostic IDs which can be problematic in long-running sessions or language bindings. This completes the work to fix several incorrect callers that passed user input or raw messages to the diagnostics engine where a constant format string was expected. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200132 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Preprocessor::Lex non-recursive.Eli Friedman2013-09-191-17/+8
| | | | | | | | | | | | | | | Before this patch, Lex() would recurse whenever the current lexer changed (e.g. upon entry into a macro). This patch turns the recursion into a loop: the various lex routines now don't return a token when the current lexer changes, and at the top level Preprocessor::Lex() now loops until it finds a token. Normally, the recursion wouldn't end up being very deep, but the recursion depth can explode in edge cases like a bunch of consecutive macros which expand to nothing (like in the testcase test/Preprocessor/macro_expand_empty.c in this patch). <rdar://problem/14569770> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190980 91177308-0d34-0410-b5e6-96231b3b80d8
* Use llvm::sys::fs::UniqueID for windows and unix.Rafael Espindola2013-08-011-28/+36
| | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187619 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove duplicate includes.Roman Divacky2012-12-211-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170903 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169831 91177308-0d34-0410-b5e6-96231b3b80d8
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-4/+4
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix dead store found by static analyzer.Ted Kremenek2012-09-161-5/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163994 91177308-0d34-0410-b5e6-96231b3b80d8
* Dont cast away const needlessly. Found by gcc48 -Wcast-qual.Roman Divacky2012-09-061-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163325 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch PTH format from a 7 byte magic number to an 8 byte one, to avoidRichard Smith2012-08-171-3/+3
| | | | | | | misaligned reads throughout the file. Bump PTH format version to 10. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162076 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149798 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-3/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify the last character check.David Blaikie2011-09-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140287 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.Argyrios Kyrtzidis2011-09-191-2/+2
| | | | | | It already works (and is useful with) macro locs as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140057 91177308-0d34-0410-b5e6-96231b3b80d8