summaryrefslogtreecommitdiffstats
path: root/lib/Lex/ScratchBuffer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* [Lex] Use WritableMemoryBuffer in ScratchBuffer.cppPavel Labath2018-01-111-4/+4
| | | | | | | | This avoids the need to const_cast the buffer contents to write to it. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322268 91177308-0d34-0410-b5e6-96231b3b80d8
* PR33902: Invalidate line number cache when adding more text to existing buffer.Richard Smith2017-07-301-0/+8
| | | | | | | | | This led to crashes as the line number cache would report a bogus line number for a line of code, and we'd try to find a nonexistent column within the line when printing diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309503 91177308-0d34-0410-b5e6-96231b3b80d8
* MSan told me that we actually dump the entire scratch buffer into PCH files, ↵Benjamin Kramer2015-04-061-3/+4
| | | | | | | | | | | initialize it. Writing 4k of zeros is preferrable to 4k of random memory. Document that. While there remove the initialization of the first byte of the buffer and start at index zero. It was writing a literal '0' instead of a null byte at the beginning anyways, which didn't matter since we never read it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234202 91177308-0d34-0410-b5e6-96231b3b80d8
* Prefer uninitialized memory for scratch space.Benjamin Kramer2015-04-061-1/+1
| | | | | | No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234184 91177308-0d34-0410-b5e6-96231b3b80d8
* unique_ptrify SourceManager::createFileIDDavid Blaikie2014-08-291-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216715 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for LLVM api change.Rafael Espindola2014-08-271-4/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216585 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. Lex edition.Craig Topper2014-05-171-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209083 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename SourceManager::createFileIDForMemBuffer()Alp Toker2014-05-161-1/+1
| | | | | | | | It makes more sense to just overload createFileID(). Gardening only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209002 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.Argyrios Kyrtzidis2011-09-191-1/+1
| | | | | | 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
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-5/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
* add \n characters to the scratch buffer *before* returned tokens. Chris Lattner2009-03-081-3/+7
| | | | | | | | | This prevents caret diagnostics from the scratch buffer from including other tokens in the scratch buffer that occurred beforei them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66375 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify some logic by making ScratchBuffer handle the application of trailingChris Lattner2009-03-081-5/+11
| | | | | | | | \0's to created tokens instead of making all clients do it. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66373 91177308-0d34-0410-b5e6-96231b3b80d8
* This change refactors some of the low-level lexer interfaces a bit.Chris Lattner2009-01-261-11/+5
| | | | | | | | | | | | | | | Token now has a class of kinds for "literals", which include numeric constants, strings, etc. These tokens can optionally have a pointer to the start of the token in the lexer buffer. This makes it faster to get spelling and do other gymnastics, because we don't have to go through source locations. This change is performance neutral, but will make other changes more feasible down the road. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63028 91177308-0d34-0410-b5e6-96231b3b80d8
* Check in the long promised SourceLocation rewrite. This lays theChris Lattner2009-01-261-1/+1
| | | | | | | | | | | | ground work for implementing #line, and fixes the "out of macro ID's" problem. There is nothing particularly tricky about the code, other than the very performance sensitive SourceManager::getFileID() method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62978 91177308-0d34-0410-b5e6-96231b3b80d8
* Make some enums in SourceLocation private, remove a useless assertion from ↵Chris Lattner2009-01-191-3/+0
| | | | | | ScratchBuffer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62492 91177308-0d34-0410-b5e6-96231b3b80d8
* this massive patch introduces a simple new abstraction: it makesChris Lattner2009-01-171-3/+3
| | | | | | | | | | | | | | | | | "FileID" a concept that is now enforced by the compiler's type checker instead of yet-another-random-unsigned floating around. This is an important distinction from the "FileID" currently tracked by SourceLocation. *That* FileID may refer to the start of a file or to a chunk within it. The new FileID *only* refers to the file (and its #include stack and eventually #line data), it cannot refer to a chunk. FileID is a completely opaque datatype to all clients, only SourceManager is allowed to poke and prod it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+72
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8