summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [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
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-2/+2
| | | | llvm-svn: 202639
* Use llvm::DeleteContainerSeconds when possibleReid Kleckner2014-02-191-4/+1
| | | | llvm-svn: 201739
* Fix a typo: "SLocEnty" should read "SLocEntry".James Dennett2013-11-241-1/+1
| | | | llvm-svn: 195563
* Adding an assert to help catch possible buffer underruns.Aaron Ballman2013-11-181-0/+4
| | | | llvm-svn: 195024
* SourceManager: Open code isInMainFile.Benjamin Kramer2013-09-271-0/+30
| | | | | | | | | - We really shouldn't compute line numbers for every file that is asked if it's the main file, it destroys the lazy computation. - Invalid locations are no longer accounted to the main file, no other functionality change. llvm-svn: 191535
* Simplified SourceManager::translateLineCol a bit.Alexander Kornienko2013-07-291-6/+3
| | | | | | | | | | | | Reviewers: rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1183 llvm-svn: 187386
* Update for llvm api change.Rafael Espindola2013-07-291-5/+8
| | | | llvm-svn: 187379
* Convert a use of status with llvm::sys::fs::getUniqueID.Rafael Espindola2013-07-291-17/+16
| | | | llvm-svn: 187367
* Thread the 'Invalid' out parameter through SourceManager::getSLocEntry() and ↵Argyrios Kyrtzidis2013-06-071-1/+4
| | | | | | | | callees of SourceManager::getSLocEntryByID(). Also add an 'Invalid' check in SourceManager::computeMacroArgsCache(). llvm-svn: 183538
* Make isBeforeInTranslationUnit consistent in the face of failures to get a ↵Argyrios Kyrtzidis2013-05-251-1/+1
| | | | | | valid FileID (V2). llvm-svn: 182698
* Make isBeforeInTranslationUnit consistent in the face of failures to get a ↵Argyrios Kyrtzidis2013-05-241-1/+4
| | | | | | | | valid FileID. Suggested by Jordan. llvm-svn: 182695
* Add some safety checks in a couple of SourceManager functions.Argyrios Kyrtzidis2013-05-241-5/+14
| | | | | | This is to address crash in rdar://13932308 llvm-svn: 182681
* Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.Michael J. Spencer2013-05-241-1/+1
| | | | llvm-svn: 182675
* [Lexer] Improve Lexer::getSourceText() when the given range deals with ↵Argyrios Kyrtzidis2013-05-161-0/+108
| | | | | | | | function macro arguments. This is a modified version of a patch by Manuel Klimek. llvm-svn: 182055
* Introduce SourceManager::getDecomposedIncludedLoc, that returns the ↵Argyrios Kyrtzidis2013-04-131-11/+30
| | | | | | | | | "included/expanded in" decomposed location of the given FileID. The main benefit is to speed-up SourceManager::isBeforeInTranslationUnit which is common to query the included/expanded location of the same FileID multiple times. llvm-svn: 179435
OpenPOWER on IntegriCloud