aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
AgeCommit message (Collapse)AuthorFilesLines
2018-05-09Remove \brief commands from doxygen comments.Adrian Prantl1-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
2018-04-30PR37189 Fix incorrect end source location and spelling for a split '>>' token.Richard Smith1-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
2018-04-06Fix typos in clangAlexander Kornienko1-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
2018-02-26Fix for LLVM r326109David Zarzycki1-2/+4
llvm-svn: 326110
2018-02-09[NFC] Extract method to SourceManager for traversing the macro "stack"George Karpenkov1-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
2017-12-20Remove llvm::MemoryBuffer const_castsPavel Labath1-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
2017-11-03[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko1-25/+30
other minor fixes (NFC). llvm-svn: 317381
2017-09-09Fix ownership of the MemoryBuffer in a FrontendInputFile.Richard Smith1-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
2017-06-29Factor out a functionality from isBeforeInTranslationUnitGabor Horvath1-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
2017-06-26Remove some redundant setup when preprocessing .pcm files.Richard Smith1-9/+0
Both of these steps are immediately overwritten by the FrontendAction setup. llvm-svn: 306325
2017-06-05Fix memory leak exposed by r304726.Richard Smith1-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
2017-06-05Rather than rejecting attempts to run preprocessor-only actions on AST files,Richard Smith1-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
2017-05-22Give files from #line the characteristics of the current fileReid Kleckner1-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
2017-04-06[Basic] getColumnNumber returns location of CR+LF on WindowsChih-Hung Hsieh1-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
2016-10-18Drop a redundant ".get()" call (NFC)Vedant Kumar1-1/+1
Pointed out by Malcolm Parsons. llvm-svn: 284510
2016-10-18[Basic] unique_ptr-ify SourceManager::MacroArgsCacheMap (NFC)Vedant Kumar1-9/+6
Differential Revision: https://reviews.llvm.org/D25711 llvm-svn: 284442
2016-10-01Use StringRef for MemoryBuffer identifier API (NFC)Mehdi Amini1-12/+12
llvm-svn: 283043
2016-07-18[NFC] Header cleanupMehdi Amini1-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
2016-04-28One more fix for use of invalid PresumedLocs missed by r267914.Richard Smith1-2/+3
llvm-svn: 267926
2016-04-28Fix use of uninitialized value exposed by r267802. Accessors of an invalidRichard Smith1-3/+5
PresumedLoc should not be called. llvm-svn: 267914
2016-02-18Remove use of builtin comma operator.Richard Trieu1-4/+8
Cleanup for upcoming Clang warning -Wcomma. No functionality change intended. llvm-svn: 261271
2016-01-28Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline.Yury Gribov1-0/+8
Differential Revision: http://reviews.llvm.org/D15804 llvm-svn: 259031
2016-01-28Small refactor in isBeforeInTranslationUnit.Yury Gribov1-6/+6
Differential Revision: http://reviews.llvm.org/D15804 llvm-svn: 259030
2015-12-01[analyzer] Fix IssueHash generation.Gabor Horvath1-1/+1
Differential Revision: http://reviews.llvm.org/D14919 Original patch by: Gyorgy Orban! llvm-svn: 254394
2015-11-26[modules] Refactor handling of -fmodules-embed-*. Track this properly ratherRichard Smith1-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
2015-11-24[modules] Add -cc1 flag -fmodules-embed-all-files.Richard Smith1-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
2015-11-12[Basic] Fix DRY violation, just call getLineTable() (NFC)Vedant Kumar1-8/+3
llvm-svn: 252828
2015-10-20Roll-back r250822.Angel Garcia Gomez1-1/+1
Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
2015-10-20Apply modernize-use-default to clang.Angel Garcia Gomez1-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
2015-10-03Replace double negation of !FileID.isInvalid() with FileID.isValid().Yaron Keren1-3/+3
+couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228. llvm-svn: 249235
2015-09-24Improve the printing of ranges when macros are involved.Richard Trieu1-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
2015-08-14[modules] Add an experimental -cc1 feature to embed the contents of an inputRichard Smith1-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
2015-08-13Add SourceManager::dump() to dump the current set of SLocEntries.Richard Smith1-0/+57
llvm-svn: 244852
2015-08-12[modules] If loading a .pcm file would cause us to run out of source ↵Richard Smith1-1/+3
locations, attempt to fail more gracefully. (No test; this requires >= 4GB of preprocessed input...) llvm-svn: 244822
2015-04-06Prefer uninitialized memory for scratch space.Benjamin Kramer1-2/+2
No functional change intended. llvm-svn: 234184
2015-03-16Global inline assembler blocks are merged before parsing, so no specificJoerg Sonnenberger1-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
2014-11-19Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie1-11/+5
llvm-svn: 222306
2014-10-26Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer1-10/+11
This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
2014-08-30Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper1-1/+1
const from some other StringRefs since its implicitly const already. llvm-svn: 216825
2014-08-29unique_ptrify SourceManager::createFileIDDavid Blaikie1-3/+3
llvm-svn: 216715
2014-08-27Update for LLVM api change.Rafael Espindola1-4/+4
llvm-svn: 216585
2014-08-26Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola1-3/+3
llvm-svn: 216476
2014-08-18Use std::unique_ptr to simplify this code a bit.Rafael Espindola1-11/+7
llvm-svn: 215926
2014-07-07Remove unused sys/stat.h includesAlp Toker1-1/+0
The facility was abstracted to LLVM in r187364. llvm-svn: 212441
2014-06-27Remove 'const' from MemoryBuffers used through the SourceManagerDavid Blaikie1-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
2014-05-08[C++11] Use 'nullptr'.Craig Topper1-17/+18
llvm-svn: 208280
2014-04-15[Allocator] Make the ContentCache object actually carry the 8-byteChandler Carruth1-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
2014-03-06Remove dead code I introduced 6 years, 4 months ago in r43518.Ted Kremenek1-25/+0
Found by -Wunreachable-code. llvm-svn: 203167
2014-03-02[C++11] Replace llvm::tie with std::tie.Benjamin Kramer1-2/+2
llvm-svn: 202639
2014-02-19Use llvm::DeleteContainerSeconds when possibleReid Kleckner1-4/+1
llvm-svn: 201739