aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/SourceLocation.cpp
AgeCommit message (Collapse)Author
2012-12-12PR14581: Make SourceLocation::printToString work, or it will always return ↵Benjamin Kramer
an empty string. No test case, this is debugging code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169980 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-09Add a SourceLocation::printToString() that returns in a std::string what dump()Argyrios Kyrtzidis
writes to stderr; for debugging purposes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167629 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-26Move FullSourceLoc::dump into the .cpp file, the used attribute made us emit ↵Benjamin Kramer
this into every TU that includes SourceLocation.h. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151493 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26Clean up as many of the comments in Basic I can find to talk in terms ofChandler Carruth
'expansion' rather than 'instantiation' for macro source locations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136058 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25Rename getInstantiationLineNumber to getExpansionLineNumber in bothChandler Carruth
SourceManager and FullSourceLoc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25Rename getInstantiationColumnNumber to getExpansionColumnNumber in bothChandler Carruth
SourceManager and FullSourceLoc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135965 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135914 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner
LLVM.h imports them into the clang namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15Fix diagnostic pragmas.Argyrios Kyrtzidis
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-12Make sure to always check the result ofDouglas Gregor
SourceManager::getPresumedLoc(), so that we don't try to make use of an invalid presumed location. Doing so can cause crashes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118885 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16Update get*LineNumber() and get*ColumnNumber() functions to pass theDouglas Gregor
Invalid bit through; there are no safety-critical callers of these functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98674 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16Audit all callers of SourceManager::getCharacterData(); update some ofDouglas Gregor
them to recover more gracefully on failure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98672 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16Audit all getBuffer() callers (for both the FullSourceLoc andDouglas Gregor
SourceManager versions), updating those callers that need to recover gracefully from failure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98665 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16Switch another function to StringRef instead of char pointer pairs.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98631 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09Remove tabs, and whitespace cleanups.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22Remove the serialization code that predates precompiledDouglas Gregor
headers. Future approaches to (de-)serializing ASTs will be based on the PCH infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10Remove some now-unneeded calls to llvm::errs().flush().Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10Add FullSourceLoc::getDecomposedLoc.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66522 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05Include information about compound statements when crashing in sema or theChris Lattner
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66108 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02improve compatibility with GCC 4.4, patch by Michel Salim (PR3697)Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04lower the interface to getLineNumber like we did forChris Lattner
getColumnNumber. This fixes a FIXME in SourceManager::getPresumedLoc because we now just decompose the sloc once. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63701 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04make SM::getColumnNumber take a predecomposed FileID/offset, whichChris Lattner
makes it clear to clients that they have to pick an instantiation or spelling location before calling it and allows optimization based on that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63698 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28Add method FullSourceLoc::getBufferData().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63229 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27Introduce a new PresumedLoc class to represent the concept of a locationChris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19Rename SourceManager::getCanonicalFileID -> getFileID. There isChris Lattner
no longer such thing as a non-canonical FileID. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62499 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19remove the SourceManager:: and FullSourceLoc::getFileEntryForLoc methods.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62496 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19some minor cleanups to SourceManager, and eliminate the Chris Lattner
SourceManager::getBuffer(SourceLocation) method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62494 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17Rename SourceLocation::getFileID to getChunkID, because it returnsChris Lattner
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62427 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17this massive patch introduces a simple new abstraction: it makesChris Lattner
"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
2009-01-16Make FullSourceLoc derive from SourceLocation instead of Chris Lattner
containing one. Containment is generally better than derivation, but in this case FullSourceLoc really 'isa' SourceLocation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16elimiante FullSourceLoc::getCanonicalFileIDChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62374 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16remove FullSourceLoc::isFileIDChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62371 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16more SourceLocation lexicon change: instead of referring to theChris Lattner
"logical" location, refer to the "instantiation" location. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16Change some terminology in SourceLocation: instead of referring to Chris Lattner
the "physical" location of tokens, refer to the "spelling" location. This is more concrete and useful, tokens aren't really physical objects! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29Make some methods const, add some helpers to FullSourceLoc,Chris Lattner
and add a dump method to FullSourceLoc! Patch by Nico Weber! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10* Remove isInSystemHeader() from DiagClient, move it to SourceManagerNico Weber
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54620 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14Added "getCanonicalID()", "isFromSameFile", and "isFromMainFile" to compareTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03Added "getLogicalLineNumber" and "getLogicalColumnNumber" to FullSourceLoc.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-15Make a major restructuring of the clang tree: introduce a top-levelChris Lattner
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