summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceLocation.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. llvm-svn: 351636
* Add dump() method for SourceRangeStephen Kelly2018-08-301-0/+54
| | | | | | | | Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50662 llvm-svn: 341140
* Add a newline to SourceLocation dump outputStephen Kelly2018-08-151-0/+1
| | | | | | | | | | | | | | Summary: Migrate callers to print(). dump() should be useful to downstreams and third parties as a debugging aid. Everyone trips up on this and creates confusing output. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50661 llvm-svn: 339810
* Remove trailing spaceFangrui Song2018-07-301-1/+1
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* PR37189 Fix incorrect end source location and spelling for a split '>>' token.Richard Smith2018-04-301-18/+0
| | | | | | | | | | | | | | | | | | 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
* [Basic] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2018-02-161-3/+9
| | | | | | other minor fixes (NFC). llvm-svn: 325412
* Revert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""Christof Douma2017-06-271-0/+70
| | | | | | | | | | | | | | | | | | | | | | This reverts commit r305688 meaning it reintroduces r305684. To repeat: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. This breaks clang-tidy and clng-query which will be fixed in a commit soon after. Patch by Sanne Wouda Differential Revision: https://reviews.llvm.org/D31709 llvm-svn: 306384
* Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"Christof Douma2017-06-191-70/+0
| | | | | | | This reverts commit 305684. This patch breaks extra/tools/clang-tidy llvm-svn: 305688
* [NFC] Refactor DiagnosticRenderer to use FullSourceLocChristof Douma2017-06-191-0/+70
| | | | | | | | | | | | | | | | Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. Patch by Sanne Wouda Review: https://reviews.llvm.org/D31709 Change-Id: If351a112cdf6718e2d3ef6721b8da9c6376b32dd llvm-svn: 305684
* [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
* Removing spurious semi colons; NFC.Aaron Ballman2015-06-091-1/+1
| | | | llvm-svn: 239400
* Inline function into only use.Rafael Espindola2014-08-181-6/+2
| | | | llvm-svn: 215925
* Only mark dump() function definitions 'used' in debug buildsAlp Toker2014-01-041-3/+4
| | | | | | | | | | | | | | | | This has the dual effect of (1) enabling more dead-stripping in release builds and (2) ensuring that debug helper functions aren't stripped away in debug builds, as they're intended to be called from the debugger. Note that the attribute is applied to definitions rather than declarations in headers going forward because it's now conditional on NDEBUG: /// \brief Mark debug helper function definitions like dump() that should not be /// stripped from debug builds. Requires corresponding macro added in LLVM r198456. llvm-svn: 198489
* PR14581: Make SourceLocation::printToString work, or it will always return ↵Benjamin Kramer2012-12-121-1/+1
| | | | | | | | an empty string. No test case, this is debugging code. llvm-svn: 169980
* Add a SourceLocation::printToString() that returns in a std::string what dump()Argyrios Kyrtzidis2012-11-091-0/+7
| | | | | | writes to stderr; for debugging purposes. llvm-svn: 167629
* Move FullSourceLoc::dump into the .cpp file, the used attribute made us emit ↵Benjamin Kramer2012-02-261-0/+4
| | | | | | this into every TU that includes SourceLocation.h. llvm-svn: 151493
* Clean up as many of the comments in Basic I can find to talk in terms ofChandler Carruth2011-07-261-1/+1
| | | | | | 'expansion' rather than 'instantiation' for macro source locations. llvm-svn: 136058
* Rename getInstantiationLineNumber to getExpansionLineNumber in bothChandler Carruth2011-07-251-2/+2
| | | | | | SourceManager and FullSourceLoc. llvm-svn: 135969
* Rename getInstantiationColumnNumber to getExpansionColumnNumber in bothChandler Carruth2011-07-251-2/+2
| | | | | | SourceManager and FullSourceLoc. llvm-svn: 135965
* Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth2011-07-251-3/+3
| | | | | | | | FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. llvm-svn: 135914
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-3/+3
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-0/+5
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Make sure to always check the result ofDouglas Gregor2010-11-121-0/+5
| | | | | | | SourceManager::getPresumedLoc(), so that we don't try to make use of an invalid presumed location. Doing so can cause crashes. llvm-svn: 118885
* Update get*LineNumber() and get*ColumnNumber() functions to pass theDouglas Gregor2010-03-161-8/+8
| | | | | | | Invalid bit through; there are no safety-critical callers of these functions. llvm-svn: 98674
* Audit all callers of SourceManager::getCharacterData(); update some ofDouglas Gregor2010-03-161-2/+2
| | | | | | them to recover more gracefully on failure. llvm-svn: 98672
* Audit all getBuffer() callers (for both the FullSourceLoc andDouglas Gregor2010-03-161-4/+4
| | | | | | | SourceManager versions), updating those callers that need to recover gracefully from failure. llvm-svn: 98665
* Switch another function to StringRef instead of char pointer pairs.Benjamin Kramer2010-03-161-3/+2
| | | | llvm-svn: 98631
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-2/+2
| | | | llvm-svn: 81346
* Remove the serialization code that predates precompiledDouglas Gregor2009-04-221-22/+0
| | | | | | | headers. Future approaches to (de-)serializing ASTs will be based on the PCH infrastructure. llvm-svn: 69828
* Remove some now-unneeded calls to llvm::errs().flush().Daniel Dunbar2009-03-101-1/+0
| | | | llvm-svn: 66555
* Add FullSourceLoc::getDecomposedLoc.Ted Kremenek2009-03-101-0/+4
| | | | llvm-svn: 66522
* Include information about compound statements when crashing in sema or theChris Lattner2009-03-051-11/+35
| | | | | | | | | | parser. For example, we now print out: 0. t.c:5:10: in compound statement {} 1. t.c:3:12: in compound statement {} 2. clang t.c -fsyntax-only llvm-svn: 66108
* improve compatibility with GCC 4.4, patch by Michel Salim (PR3697)Chris Lattner2009-03-021-0/+1
| | | | llvm-svn: 65884
* lower the interface to getLineNumber like we did forChris Lattner2009-02-041-5/+0
| | | | | | | | getColumnNumber. This fixes a FIXME in SourceManager::getPresumedLoc because we now just decompose the sloc once. llvm-svn: 63701
* make SM::getColumnNumber take a predecomposed FileID/offset, whichChris Lattner2009-02-041-6/+0
| | | | | | | | makes it clear to clients that they have to pick an instantiation or spelling location before calling it and allows optimization based on that. llvm-svn: 63698
* Add method FullSourceLoc::getBufferData().Ted Kremenek2009-01-281-0/+6
| | | | llvm-svn: 63229
* Introduce a new PresumedLoc class to represent the concept of a locationChris Lattner2009-01-271-29/+23
| | | | | | | | | | | | | | | | | | | as reported to the user and as manipulated by #line. This is what __FILE__, __INCLUDE_LEVEL__, diagnostics and other things should follow (but not dependency generation!). This patch also includes several cleanups along the way: - SourceLocation now has a dump method, and several other places that did similar things now use it. - I cleaned up some code in AnalysisConsumer, but it should probably be simplified further now that NamedDecl is better. - TextDiagnosticPrinter is now simplified and cleaned up a bit. This patch is a prerequisite for #line, but does not actually provide any #line functionality. llvm-svn: 63098
* Rename SourceManager::getCanonicalFileID -> getFileID. There isChris Lattner2009-01-191-2/+2
| | | | | | no longer such thing as a non-canonical FileID. llvm-svn: 62499
* remove the SourceManager:: and FullSourceLoc::getFileEntryForLoc methods.Chris Lattner2009-01-191-5/+0
| | | | llvm-svn: 62496
* some minor cleanups to SourceManager, and eliminate the Chris Lattner2009-01-191-1/+1
| | | | | | SourceManager::getBuffer(SourceLocation) method. llvm-svn: 62494
* Rename SourceLocation::getFileID to getChunkID, because it returnsChris Lattner2009-01-171-0/+6
| | | | | | | | the chunk ID not the file ID. This exposes problems in TextDiagnosticPrinter where it should have been using the canonical file ID but wasn't. Fix these along the way. llvm-svn: 62427
* this massive patch introduces a simple new abstraction: it makesChris Lattner2009-01-171-1/+1
| | | | | | | | | | | | | | | "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. llvm-svn: 62407
* Make FullSourceLoc derive from SourceLocation instead of Chris Lattner2009-01-161-27/+27
| | | | | | | containing one. Containment is generally better than derivation, but in this case FullSourceLoc really 'isa' SourceLocation. llvm-svn: 62375
* elimiante FullSourceLoc::getCanonicalFileIDChris Lattner2009-01-161-7/+2
| | | | llvm-svn: 62374
* remove FullSourceLoc::isFileIDChris Lattner2009-01-161-1/+1
| | | | llvm-svn: 62371
* more SourceLocation lexicon change: instead of referring to theChris Lattner2009-01-161-11/+11
| | | | | | "logical" location, refer to the "instantiation" location. llvm-svn: 62316
* Change some terminology in SourceLocation: instead of referring to Chris Lattner2009-01-161-10/+10
| | | | | | | the "physical" location of tokens, refer to the "spelling" location. This is more concrete and useful, tokens aren't really physical objects! llvm-svn: 62309
* Make some methods const, add some helpers to FullSourceLoc,Chris Lattner2008-09-291-5/+39
| | | | | | and add a dump method to FullSourceLoc! Patch by Nico Weber! llvm-svn: 56806
* * Remove isInSystemHeader() from DiagClient, move it to SourceManagerNico Weber2008-08-101-0/+6
| | | | | | | | | | | | | | | | * Move FormatError() from TextDiagnostic up to DiagClient, remove now empty class TextDiagnostic * Make DiagClient optional for Diagnostic This fixes the following problems: * -html-diags (and probably others) does now output the same set of warnings as console clang does * nothing crashes if one forgets to call setHeaderSearch() on TextDiagnostic * some code duplication is removed llvm-svn: 54620
* Added "getCanonicalID()", "isFromSameFile", and "isFromMainFile" to compareTed Kremenek2008-04-141-0/+4
| | | | | | | | the files of different SourceLocations. These methods correctly handle the case where a file may have multiple FileIDs due to it being large enough to be spread across several chunks. llvm-svn: 49682
OpenPOWER on IntegriCloud