summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing spaceFangrui Song2018-07-301-32/+32
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* Add SourceManagerForFile helper which sets up SourceManager and dependencies ↵Eric Liu2018-05-091-0/+26
| | | | | | | | | | | | | | | | for a single file with code snippet Summary: This can be used to create a virtual environment (incl. VFS, source manager) for code snippets. Reviewers: sammccall, klimek Reviewed By: sammccall Subscribers: klimek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D46176 llvm-svn: 331923
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-17/+17
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* PR37189 Fix incorrect end source location and spelling for a split '>>' token.Richard Smith2018-04-301-13/+26
| | | | | | | | | | | | | | | | | | When a '>>' token is split into two '>' tokens (in C++11 onwards), or (as an extension) when we do the same for other tokens starting with a '>', we can't just use a location pointing to the first '>' as the location of the split token, because that would result in our miscomputing the length and spelling for the token. As a consequence, for example, a refactoring replacing 'A<X>' with something else would sometimes replace one character too many, and similarly diagnostics highlighting a template-id source range would highlight one character too many. Fix this by creating an expansion range covering the first character of the '>>' token, whose spelling is '>'. For this to work, we generalize the expansion range of a macro FileID to be either a token range (the common case) or a character range (used in this new case). llvm-svn: 331155
* Fix typos in clangAlexander Kornienko2018-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
* Fix for LLVM r326109David Zarzycki2018-02-261-2/+4
| | | | llvm-svn: 326110
* [NFC] Extract method to SourceManager for traversing the macro "stack"George Karpenkov2018-02-091-0/+6
| | | | | | | | | | | | The code for going up the macro arg expansion is duplicated in many places (and we need it for the analyzer as well, so I did not want to duplicate it two more times). This patch is an NFC, so the semantics should remain the same. Differential Revision: https://reviews.llvm.org/D42458 llvm-svn: 324780
* Remove llvm::MemoryBuffer const_castsPavel Labath2017-12-201-3/+4
| | | | | | | | | | | | | | | Summary: llvm has grown a WritableMemoryBuffer class, which is convertible (inherits from) a MemoryBuffer. We can use it to avoid conts_casting the buffer contents when we want to write to it. Reviewers: dblaikie, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41387 llvm-svn: 321167
* [Basic] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2017-11-031-25/+30
| | | | | | other minor fixes (NFC). llvm-svn: 317381
* Fix ownership of the MemoryBuffer in a FrontendInputFile.Richard Smith2017-09-091-5/+6
| | | | | | | | This fixes a possible crash on certain kinds of corrupted AST file, but checking in an AST file corrupted in just the right way will be a maintenance nightmare because the format changes frequently. llvm-svn: 312851
* Factor out a functionality from isBeforeInTranslationUnitGabor Horvath2017-06-291-37/+48
| | | | | | | | | | The first user of this API will be the cross translation unit functionality of the Static Analyzer which will be committed in a follow-up patch. Differential Revision: https://reviews.llvm.org/D34506 llvm-svn: 306648
* Remove some redundant setup when preprocessing .pcm files.Richard Smith2017-06-261-9/+0
| | | | | | Both of these steps are immediately overwritten by the FrontendAction setup. llvm-svn: 306325
* Fix memory leak exposed by r304726.Richard Smith2017-06-051-5/+7
| | | | | | | | When giving a ContentCache a null buffer, ignore the DoNotFree flag rather than inheriting it onto whatever buffer we end up using for the file. Also ensure that the main buffer is properly destroyed. llvm-svn: 304740
* Rather than rejecting attempts to run preprocessor-only actions on AST files,Richard Smith2017-06-051-0/+35
| | | | | | | | | | replay the steps taken to create the AST file with the preprocessor-only action installed to produce preprocessed output. This can be used to produce the preprocessed text for an existing .pch or .pcm file. llvm-svn: 304726
* Give files from #line the characteristics of the current fileReid Kleckner2017-05-221-77/+16
| | | | | | | | | | This allows #line directives to appear in system headers that have code that clang would normally warn on. This is compatible with GCC, which is easy to test by running `gcc -E`. Fixes PR30752 llvm-svn: 303582
* [Basic] getColumnNumber returns location of CR+LF on WindowsChih-Hung Hsieh2017-04-061-2/+11
| | | | | | | | | | | | When fixing a Clang-Tidy bug in D31406, reuse of FileID enabled the missing highlightRange function. Assertion in highlightRange failed because the end-of-range column number was 2 + the last column of a line on Windows. This fix is required to enable D31406. Differential Revision: https://reviews.llvm.org/D31713 llvm-svn: 299681
* Drop a redundant ".get()" call (NFC)Vedant Kumar2016-10-181-1/+1
| | | | | | Pointed out by Malcolm Parsons. llvm-svn: 284510
* [Basic] unique_ptr-ify SourceManager::MacroArgsCacheMap (NFC)Vedant Kumar2016-10-181-9/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D25711 llvm-svn: 284442
* Use StringRef for MemoryBuffer identifier API (NFC)Mehdi Amini2016-10-011-12/+12
| | | | llvm-svn: 283043
* [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 llvm-svn: 275882
* One more fix for use of invalid PresumedLocs missed by r267914.Richard Smith2016-04-281-2/+3
| | | | llvm-svn: 267926
* Fix use of uninitialized value exposed by r267802. Accessors of an invalidRichard Smith2016-04-281-3/+5
| | | | | | PresumedLoc should not be called. llvm-svn: 267914
* Remove use of builtin comma operator.Richard Trieu2016-02-181-4/+8
| | | | | | Cleanup for upcoming Clang warning -Wcomma. No functionality change intended. llvm-svn: 261271
* Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline.Yury Gribov2016-01-281-0/+8
| | | | | | Differential Revision: http://reviews.llvm.org/D15804 llvm-svn: 259031
* Small refactor in isBeforeInTranslationUnit.Yury Gribov2016-01-281-6/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D15804 llvm-svn: 259030
* [analyzer] Fix IssueHash generation.Gabor Horvath2015-12-011-1/+1
| | | | | | | | Differential Revision: http://reviews.llvm.org/D14919 Original patch by: Gyorgy Orban! llvm-svn: 254394
* [modules] Refactor handling of -fmodules-embed-*. Track this properly ratherRichard Smith2015-11-261-5/+3
| | | | | | | than reusing the "overridden buffer" mechanism. This will allow us to make embedded files and overridden files behave differently in future. llvm-svn: 254121
* [modules] Add -cc1 flag -fmodules-embed-all-files.Richard Smith2015-11-241-1/+2
| | | | | | | | | | | | | | This flag causes all files that were read by the compilation to be embedded into a produced module file. This is useful for distributed build systems that use an include scanning system to determine which files are "needed" by a compilation, and only provide those files to remote compilation workers. Since using a module can require any file that is part of that module (or anything it transitively includes), files that are not found by an include scanner can be required in a regular build using explicit modules. With this flag, only files that are actually referenced by transitively-#included files are required to be present on the build machine. llvm-svn: 253950
* [Basic] Fix DRY violation, just call getLineTable() (NFC)Vedant Kumar2015-11-121-8/+3
| | | | llvm-svn: 252828
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | 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-1/+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 llvm-svn: 250822
* Replace double negation of !FileID.isInvalid() with FileID.isValid().Yaron Keren2015-10-031-3/+3
| | | | | | +couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228. llvm-svn: 249235
* Improve the printing of ranges when macros are involved.Richard Trieu2015-09-241-2/+7
| | | | | | | | | | | | Trace the ranges through the macro backtrace better. This allows better range highlighting through all levels of the macro bracktrace. Also some improvements to backtrace printer for omitting different backtraces. Patch by Zhengkai Wu. Differential Revision: http://reviews.llvm.org/D12379 llvm-svn: 248454
* [modules] Add an experimental -cc1 feature to embed the contents of an inputRichard Smith2015-08-141-0/+7
| | | | | | | | | | | file in the .pcm files. This allows a smaller set of files to be sent to a remote build worker when building with explicit modules (for instance, module map files need not be sent along with the corresponding precompiled modules). This doesn't actually make the embedded files visible to header search, so it's not useful as a packaging format for public header files. llvm-svn: 245028
* Add SourceManager::dump() to dump the current set of SLocEntries.Richard Smith2015-08-131-0/+57
| | | | llvm-svn: 244852
* [modules] If loading a .pcm file would cause us to run out of source ↵Richard Smith2015-08-121-1/+3
| | | | | | locations, attempt to fail more gracefully. (No test; this requires >= 4GB of preprocessed input...) llvm-svn: 244822
* Prefer uninitialized memory for scratch space.Benjamin Kramer2015-04-061-2/+2
| | | | | | No functional change intended. llvm-svn: 234184
* Global inline assembler blocks are merged before parsing, so no specificJoerg Sonnenberger2015-03-161-14/+25
| | | | | | | | | | | | | location data is available. If pragma handling wants to look up the position, it finds the LLVM buffer and wants to compare it with the special built-in buffer, failing badly. Extend to the special handling of the built-in buffer to also check for the inline asm buffer. Expect only a single asm buffer. Sort it between the built-in buffers and the normal file buffers. Fixes the assert part of PR 22576. llvm-svn: 232389
* Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie2014-11-191-11/+5
| | | | llvm-svn: 222306
* Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer2014-10-261-10/+11
| | | | | | | This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-1/+1
| | | | | | const from some other StringRefs since its implicitly const already. llvm-svn: 216825
* unique_ptrify SourceManager::createFileIDDavid Blaikie2014-08-291-3/+3
| | | | llvm-svn: 216715
* Update for LLVM api change.Rafael Espindola2014-08-271-4/+4
| | | | llvm-svn: 216585
* Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola2014-08-261-3/+3
| | | | llvm-svn: 216476
* Use std::unique_ptr to simplify this code a bit.Rafael Espindola2014-08-181-11/+7
| | | | llvm-svn: 215926
* Remove unused sys/stat.h includesAlp Toker2014-07-071-1/+0
| | | | | | The facility was abstracted to LLVM in r187364. llvm-svn: 212441
* Remove 'const' from MemoryBuffers used through the SourceManagerDavid Blaikie2014-06-271-26/+21
| | | | | | | | | | | | | | This removes a const_cast added in r211884 that occurred due to an inconsistency in how MemoryBuffers are handled between some parts of clang and LLVM. MemoryBuffers are immutable and the general convention in the LLVM project is to omit const from immutable types as it's simply redundant/verbose (see llvm::Type, for example). While this change doesn't remove "const" from /every/ MemoryBuffer, it at least makes this chain of ownership/usage consistent. llvm-svn: 211915
* [C++11] Use 'nullptr'.Craig Topper2014-05-081-17/+18
| | | | llvm-svn: 208280
* [Allocator] Make the ContentCache object actually carry the 8-byteChandler Carruth2014-04-151-12/+4
| | | | | | | | | alignment constraint rather than using the allocator function's over alignment "feature". This was the only use of the "feature" which I plan to remove next. =] Attaching the alignment to the type seems cleaner and more principled anyways. llvm-svn: 206324
* Remove dead code I introduced 6 years, 4 months ago in r43518.Ted Kremenek2014-03-061-25/+0
| | | | | | Found by -Wunreachable-code. llvm-svn: 203167
OpenPOWER on IntegriCloud