History log of /external/clang/lib/Basic/SourceManager.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
/external/clang/lib/Basic/SourceManager.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/Basic/SourceManager.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Basic/SourceManager.cpp
fb21ecfa483bc679d06e8a21d154684bd5183637 18-Nov-2013 Aaron Ballman <aaron@aaronballman.com> Adding an assert to help catch possible buffer underruns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
1b9c5374a3cd33b0e281f494f0e322aef035abca 27-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> SourceManager: Open code isInMainFile.

- 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
c8051e6d276b916f4a4244ad353c5a9c1d2c58e4 30-Jul-2013 Alexander Kornienko <alexfh@google.com> Simplified SourceManager::translateLineCol a bit.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1183

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187386 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
4488835d1c78221553909447cf87d7e4ff7f99fb 29-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Update for llvm api change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3dadc85330d8f548b49f97d7e2fa62c73f7463dd 29-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Convert a use of status with llvm::sys::fs::getUniqueID.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
4ff3225c1f343c3e0d461a0e387c7c6012cff5ba 07-Jun-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Thread the 'Invalid' out parameter through SourceManager::getSLocEntry() and callees of SourceManager::getSLocEntryByID().

Also add an 'Invalid' check in SourceManager::computeMacroArgsCache().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
45e1f0e3e7a2030e2e95863cf2bcceb7eb2476ff 25-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID (V2).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ecdbbfa1cd26c0b0f322366973c7dae51c1e83df 25-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make isBeforeInTranslationUnit consistent in the face of failures to get a valid FileID.

Suggested by Jordan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5b8e132a9ab2232fae55ee481bf4901b0a7005da 25-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add some safety checks in a couple of SourceManager functions.

This is to address crash in rdar://13932308

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182681 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
9779fdd271bb6a938bdee93f901e4ef7b1a88610 24-May-2013 Michael J. Spencer <bigcheesegs@gmail.com> Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
c50c6ff49aa3648ae031349de6f09439f52425f0 16-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Lexer] Improve Lexer::getSourceText() when the given range deals with function macro arguments.

This is a modified version of a patch by Manuel Klimek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ecc65238c98ba21d08763da7b7972d617677e908 13-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce SourceManager::getDecomposedIncludedLoc, that returns the "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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179435 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
838a920fda4408d1b12faca704da2b848a6efcc1 01-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add one more sanity check in SourceManager::getFileIDLoaded().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176333 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
7db4bb9226f303392934c91869afdeb4d153ca95 01-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> In SourceManager::getFileIDLoaded(), add some sanity checks to make sure we don't enter an infinite loop.

rdar://13120919

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
2564f811ba107cb314a594d730aa3357b6181b62 27-Feb-2013 Ted Kremenek <kremenek@apple.com> Refine SourceManager's isBeforeInTranslationUnit() cache to have more entries.

isBeforeInTranslationUnit() uses a cache to reduce the expensive work
to compute a common ancestor for two FileIDs. This work is very
expensive, so even caching the latest used FileIDs was a big win.
A closer analysis of the cache before, however, shows that the cache
access pattern would oscillate between a working set of FileIDs, and
thus caching more pairs would be profitable.

This patch adds a side table for extending caching. This side table
is bounded in size (experimentally determined in this case from
a simple Objective-C project), and when the table gets too large
we fall back to the single entry caching before as before.

On Sketch (a small example Objective-C project), this optimization
reduces -fsyntax-only time on SKTGraphicView.m by 5%. This is
for a project that is already using PCH.

Fixes <rdar://problem/13299847>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176142 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
f512acee01617c9da8079ed88ded3bb9f2418349 22-Feb-2013 Benjamin Kramer <benny.kra@googlemail.com> Replace some typically large vectors with SmallVector.

This may seem counter-intuitive but the POD-like optimization helps when the
vectors grow into multimegabyte buffers. SmallVector calls realloc which knows
how to twiddle virtual memory bits and avoids large copies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175906 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
66874fb18afbffb8b2ca05576851a64534be3352 21-Feb-2013 David Blaikie <dblaikie@gmail.com> Use None rather than Optional<T>() where possible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
dc84cd5efdd3430efb22546b4ac656aa0540b210 20-Feb-2013 David Blaikie <dblaikie@gmail.com> Include llvm::Optional in clang/Basic/LLVM.h

Post-commit CR feedback from Jordan Rose regarding r175594.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
c3cd6f7a5d33ad44f6c9cf4faa7046c77baa128e 12-Jan-2013 Matt Beaumont-Gay <matthewbg@google.com> Fix -Wunused-comparison for comparisons in arguments to function-like macros.

Previously, -Wunused-comparison ignored comparisons in both macro bodies and
macro arguments, but we would still emit a -Wunused-value warning for either.
Now we correctly emit -Wunused-comparison for expressions in macro arguments.

Also, add isMacroBodyExpansion to SourceManager, to go along with
isMacroArgExpansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d53c2d30cf89eca5c165d682f6cc1261f54674fd 16-Dec-2012 Craig Topper <craig.topper@gmail.com> Don't use SourceLineCache in getColumnNumber if LastLineNoResult is past the end of the cache. Fixes PR14570.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
55fc873017f10f6f566b182b70f6fc22aefa3464 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
62221b17c90457df9ca0ff20bb54d634e8951def 15-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add -cc1 option -fno-diagnostics-use-presumed-location, a handy mode for
working with preprocessed testcases. This causes source locations in
diagnostics to point at the spelling location instead of the presumed location,
while still keeping the semantic effects of the line directives (entering and
leaving system-header mode, primarily).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
0872a06d1ee1a3b62ef833f955051418d18006a1 20-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> When associating file ranges of macro arguments with their
macro expansion ranges, make sure to check all the FileID
entries that are contained in the spelling range of the
expansion for the macro argument.

Fixes rdar://12537982

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d9cad403c0f76cbbcc53efbfeee3d59f9f0b6e09 19-Oct-2012 Craig Topper <craig.topper@gmail.com> Teach getColumnNumber to use the line cache to get the start of the line if its on the same line as the last call to getLineNumber. Prevents needing to scan backwards for the new line. Fixes PR14106.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
186ec9c2e6db6fd5827f2078d2a6b82085be54d3 13-Oct-2012 Ted Kremenek <kremenek@apple.com> Silence dead store warning. It is conceptually possible we will
add more code that references SourceFile, so removing the dead store
doesn't seem appropriate for the long term.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165837 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
31ba6135375433b617a8587ea6cc836a014ebd86 06-Sep-2012 Roman Divacky <rdivacky@freebsd.org> Dont cast away const needlessly. Found by gcc48 -Wcast-qual.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ff398965a5abfaf5bc47bc022876f56a28e5b9a7 11-Jul-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce a flag in SourceManager to treat non-system source files
as "volatile", meaning there's a high enough chance that they may
change while we are trying to use them.

This flag is only enabled by libclang.
Currently "volatile" source files will be stat'ed immediately
before opening them, because the file size stat info
may not be accurate since when we got it (e.g. from the PCH).
This avoids crashes when trying to reference mmap'ed memory
from a file whose size is not what we expect.

Note that there's still a window for a racing issue to occur
but the window for it should be way smaller than before.
We can consider later on to avoid mmap completely on such files.

rdar://11612916

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ec221bc2a5736458bc2281fd1e3b8cdcd3735193 03-Jul-2012 James Dennett <jdennett@google.com> Documentation cleanup: Delete a duplicated/malformed doc comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
9416d42468eacaae0ea85ab8ed134f5df1a1d142 19-Jun-2012 Meador Inge <meadori@codesourcery.com> Revert predefined decl tracking.

r158085 added some logic to track predefined declarations. The main reason we
had predefined declarations in the input was because the __builtin_va_list
declarations were injected into the preprocessor input. As of r158592 we
explicitly build the __builtin_va_list declarations. Therefore the predefined
decl tracking is no longer needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
2e413f977d13d83b5baf7b5e4e93fe7c390959ca 19-Jun-2012 Jordan Rose <jordan_rose@apple.com> Fix the location of the fixit for -Wnewline-eof.

It turns out SourceManager treating the "one-past-the-end" location as invalid,
but then failing to set the invalid flag properly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158699 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b8950b8e11272a3b9776568ea423bff016bc996d 17-Jun-2012 James Dennett <jdennett@google.com> Documentation cleanup: escaped # characters in Doxygen comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
7285a06a0655ed93e313305182f67edb73890247 15-Jun-2012 James Dennett <jdennett@google.com> Documentation cleanup: escape # in a Doxygen comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
47d9de678162202786aa5f8aa153a7c58a4cebd4 08-Jun-2012 Douglas Gregor <dgregor@apple.com> Switch LineTableInfo to use FileID instead of int for file references,
from Tom Honermann!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158211 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d73ef135ba029db59c0b5649e6117845d9e39600 06-Jun-2012 Jordan Rose <jordan_rose@apple.com> Add pedantic warning -Wempty-translation-unit (C11 6.9p1).

In standard C since C89, a 'translation-unit' is syntactically defined to have
at least one "external-declaration", which is either a decl or a function
definition. In Clang the latter gives us a declaration as well.

The tricky bit about this warning is that our predefines can contain external
declarations (__builtin_va_list and the 128-bit integer types). Therefore our
AST parser now makes sure we have at least one declaration that doesn't come
from the predefines buffer.

Also, remove bogus warning about empty source files. This doesn't catch source
files that only contain comments, and never fired anyway because of our
predefines.

PR12665 and <rdar://problem/9165548>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d54dff026b02303a35147224de72bb44cbb53c79 03-May-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] When validating that the files coming from PCH did not change, also
validate that we didn't override the contents of any of such files.

If this is detected, emit a diagnostic error and recover gracefully
by using the contents of the original file that the PCH was built from.

Part of rdar://11305263

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156107 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d2953ce57a4f1b0a6884b3d6b35266ab4f79fa7f 06-Apr-2012 Benjamin Kramer <benny.kra@googlemail.com> SourceManager: Vectorize ComputeLineNumbers for SSE2.

This method is very hot, it is called when emitting diagnostics, in -E mode
and for many #pragma handlers. It scans through the whole source file to
count newlines, records and caches them in a vector.

The speedup from vectorization isn't very large, as we fall back to bytewise
scanning when we hit a newline. There might be a way to avoid leaving the sse
loop but everything I tried didn't work out because a call to push_back
clobbers xmm registers.

About 2% speedup on average on "clang -E > /dev/null" of all .cpp files in
clang's lib/Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
a4c29b6e55c9d4ef44a51c45c6785e8b4fe9deed 21-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Recover gracefully if the ASTReader detects that a file is different
from the one stored in the PCH/AST, while trying to load a SLocEntry.

We verify that all files of the PCH did not change before loading it but this is not enough because:

- The AST may have been 1) kept around, 2) to do queries on it.
- We may have 1) verified the PCH and 2) started parsing.

Between 1) and 2) files may change and we are going to have crashes because the rest of clang
cannot deal with the ASTReader failing to read a SLocEntry.

Handle this by recovering gracefully in such a case, by initializing the SLocEntry
with the info from the PCH/AST as well as reporting failure by the ASTReader.

rdar://10888929

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
cee5ec9df479994e4ba27fb65b7ded5bb5a980eb 21-Dec-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix bugs in SourceManager::computeMacroArgsCache() and add a unit test for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d7711ec430fde5706f85ba6c4b85283a8e743ff7 21-Dec-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> For SourceManager::isBeforeInTranslationUnit(), have it consider macro arg expanded
token locations as coming before the closing ')' of a function macro expansion.

Include a unit test for SourceManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
098eaffc0c1784567ddccfe6f976ced6e904552e 19-Dec-2011 Dylan Noblesmith <nobled@dreamwidth.org> SourceManager: use getBufferSize()

Forming an out of bounds pointer to check if it's out
of bounds was undefined behavior.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
99ee0851015f0d334fa319c4ab9e14869520ebe5 16-Dec-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> In SourceManager::~SourceManager do a sanity check to make sure we
don't try to destruct a null ContentCache.

rdar://10567159

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146707 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
a4288c4aa05075cd45fd4de61d95ffe920fe6441 10-Dec-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> In ContentCache::replaceBuffer, add sanity check to make sure that we do not free a buffer
and then continue using it. rdar://10359140.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146308 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d575254dcd061ad9e6661598f4443d85a7bd1d8b 10-Dec-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add a sanity check in SourceManager::getColumnNumber, make sure
we don't try to access beyond the buffer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146305 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
a081da5e44600d02983d6562bed1b4fd61e410fd 16-Nov-2011 Douglas Gregor <dgregor@apple.com> Implement (de-)serialization of the buffer contents for an overridden
file in the source manager. This allows us to properly create and use
modules described by module map files without umbrella headers (or
with incompletely umbrella headers). More generally, we can actually
build a PCH file that makes use of file -> buffer remappings, which
could be useful in libclang in the future.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144830 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
82ccbe759b716f1747e03f54a4cd6eb164bb3427 25-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Use assert(0) instead of duplicating the check, suggestion by Anna.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
796dbfb6c43336f58c026137c438e53eadc381f7 12-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce SourceManager::getFileLoc which returns a file location
taking into account macro arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
c3b4575b77164fdf008cd4acc330884d56ca500f 04-Oct-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make sure SourceManager::getFileIDLoaded doesn't hang in release build because of invalid passed parameter.
rdar://10210140

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141048 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b201e16e0c331b0bdeae7b30f9f79aae32beb1b2 27-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Break SourceManager::translateFileLineCol into translateFile, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
fb3612ef197cb8532c05f33889ec1aed7c26e5cb 26-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Associate the macro arguments location map with a FileID instead
of a ContentCache, since multiple FileIDs can have the same ContentCache
but the expanded macro arguments locations will be different.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d6471f7c1921c7802804ce3ff6fe9768310f72b9 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename Diagnostic to DiagnosticsEngine as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5e5e95dec56d8f2392068c43c84eaaad674c2702 21-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> In SourceManager::translateLineCol, handle the case where we are pointing
directly at the end of the source file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140192 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
507097ec40105ed927cb5a744fad98f5875aacac 19-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> [libclang] When getting a source location from a file:line:col triplet
check whether the requested location points inside the precompiled preamble,
in which case the returned source location will be a "loaded" one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
efa2ff8603dae51f5f5ed7509a503f477498ad22 19-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Break SourceManager::translateFileLineCol into translateLineCol that returns the
source location of line:col of a specific FileID.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140059 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
a64ccefdf0ea4e03ec88805d71b0af74950c7472 19-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.

It already works (and is useful with) macro locs as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
50402470f07f720c509c8797f40a106a0d4af6a7 19-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> For SourceManager::isBeforeInTranslationUnit, a location pointing
inside a macro argument should be regarded as coming before
the location of the expanded tokens.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d7cb46c316808169679a8d72c69f02a1e55d78a8 23-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove one SourceManager::isInFileID overload and use isOffsetInFileID for the other.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138381 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b6c465e17ec37390667223a18a340e8652c212ff 23-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Amend r138129 (reduction of SLocEntries) which introduced performance regression due
to increased calls to SourceManager::getFileID. (rdar://9992664)

Use a slightly different approach that is more efficient both in terms of speed
(no extra getFileID calls) and in SLocEntries reduction.

Comparing pre-r138129 and this patch we get:

For compiling SemaExpr.cpp reduction of SLocEntries by 26%.
For the boost enum library:
-SLocEntries -34% (note that this was -5% for r138129)
-Memory consumption -50%
-PCH size -31%

Reduced SLocEntries also benefit the hot function SourceManager::getFileID,
evident by the reduced "FileID scans".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138380 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
984e42ca1ff7775ce39372c314f1cb7d6862c4c7 23-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move a couple of SourceManager functions out-of-line; no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d9d2b679d0728ea7f539f38aaea38e26b8b08043 22-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Boost the efficiency of SourceManager::getMacroArgExpandedLocation.

Currently getMacroArgExpandedLocation is very inefficient and for the case
of a location pointing at the main file it will end up checking almost all of
the SLocEntries. Make it faster:

-Use a map of macro argument chunks to their expanded source location. The map
is for a single source file, it's stored in the file's ContentCache and lazily
computed, like the source lines cache.
-In SLocEntry's FileInfo add an 'unsigned NumCreatedFIDs' field that keeps track
of the number of FileIDs (files and macros) that were created during preprocessing
of that particular file SLocEntry. This is useful when computing the macro argument
map in skipping included files while scanning for macro arg FileIDs that lexed from
a specific source file. Due to padding, the new field does not increase the size
of SLocEntry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
54232ade44d31e98ea83f43ca066128e315dcbda 20-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Refactor common functionality into SourceManager::getFileIDSize, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138127 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ac836e442cbd17f33533bd0b4879258945bc1723 17-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce SourceManager::getMacroArgExpandedLocation function.

If we pass it a source location that points inside a function macro argument,
the returned location will be the macro location in which the argument was expanded.
If a macro argument is used multiple times, the expanded location will
be at the first expansion of the argument.
e.g.
MY_MACRO(foo);
^
Passing a file location pointing at 'foo', will yield a macro location
where 'foo' was expanded into.

Make SourceManager::getLocation call getMacroArgExpandedLocation as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
37e59a10a7a537428e5997fd5896f5b89fd34e6b 17-Aug-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make SourceManager::isBeforeInTranslationUnit handle macro locations correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
6e36c12404269eb4909e85d3be69f78d36d1d297 27-Jul-2011 Ted Kremenek <kremenek@apple.com> Change SourceManager::getDataStructureSizes() to use llvm::capacity_in_bytes().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136236 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ca7dc2b755eb81ac95121ce1a1f1aa44a4a0fe12 27-Jul-2011 Ted Kremenek <kremenek@apple.com> clang_getCXTUResourceUsage: Report memory used by data structures in SourceManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3201f382956ed9beee9fb31229c2835c1208889c 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Clean up as many of the comments in Basic I can find to talk in terms of
'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
/external/clang/lib/Basic/SourceManager.cpp
1728762d5a8cfaf8d64385f47b311e84de1ae7a2 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Migrate 'Instantiation' data and API bits of SLocEntry to 'Expansion'
etc. With this I think essentially all of the SourceManager APIs are
converted. Comments and random other bits of cleanup should be all thats
left.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
78df836808aee22c3157e1bc23bc4ec569b80568 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Convert InstantiationInfo and much of the related code to ExpansionInfo
and various other 'expansion' based terms. I've tried to reformat where
appropriate and catch as many references in comments but I'm going to do
several more passes. Also I've tried to expand parameter names to be
more clear where appropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
bf340e452339e374ea6eef78c1f0a2abdd16c5a3 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename create(MacroArg)InstantiationLoc to create(MacroArg)ExpansionLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136054 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
96d3589e523a04f4ff2058a7919226ce60696ae8 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename SourceManager (and InstantiationInfo) isMacroArgInstantiation API
to isMacroArgExpansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
642116259e8df6286063a17361c20e95b5017a0a 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename getInstantiationLineNumber to getExpansionLineNumber in both
SourceManager and FullSourceLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
a77c031cb66f75d22672070052cc6e0205289ff8 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename getInstantiationColumnNumber to getExpansionColumnNumber in both
SourceManager and FullSourceLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
e7b2b6e87dbe5b1207f77b6ff9c210a02f95bb39 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
f84ef95ecec34f27fd05eb4e0392ca6bd3bd0be0 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> getInstantiationLocSlowCase -> getExpansionLocSlowCase

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
999f739404edf2078cf9f9c28b4dc45c19765842 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename SourceManager::getImmediateInstantiationRange to
getImmediateExpansionRange.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135960 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
edc3dccece244a584f8ebdb81da6c962c08e79be 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Rename SourceManager::getInstantiationRange to getExpansionRange.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135915 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that 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
/external/clang/lib/Basic/SourceManager.cpp
f62d43d2afe1960755a1b5813cae1e5983bcac1b 19-Jul-2011 Douglas Gregor <dgregor@apple.com> Revamp the SourceManager to separate the representation of parsed
source locations from source locations loaded from an AST/PCH file.

Previously, loading an AST/PCH file involved carefully pre-allocating
space at the beginning of the source manager for the source locations
and FileIDs that correspond to the prefix, and then appending the
source locations/FileIDs used for parsing the remaining translation
unit. This design forced us into loading PCH files early, as a prefix,
whic has become a rather significant limitation.

This patch splits the SourceManager space into two parts: for source
location "addresses", the lower values (growing upward) are used to
describe parsed code, while upper values (growing downward) are used
for source locations loaded from AST/PCH files. Similarly, positive
FileIDs are used to describe parsed code while negative FileIDs are
used to file/macro locations loaded from AST/PCH files. As a result,
we can load PCH/AST files even during parsing, making various
improvemnts in the future possible, e.g., teaching #include <foo.h> to
look for and load <foo.h.gch> if it happens to be already available.

This patch was originally written by Sebastian Redl, then brought
forward to the modern age by Jonathan Turner, and finally
polished/finished by me to be committed.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135484 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
c8d1ecca1cd3fadbd331d15c420755aa6184554b 08-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Keep track of which source locations are part of a macro argument
instantiation and improve diagnostics which are stem from macro
arguments to trace the argument itself back through the layers of macro
expansion.

This requires some tricky handling of the source locations, as the
argument appears to be expanded in the opposite direction from the
surrounding macro. This patch provides helper routines that encapsulate
the logic and explain the reasoning behind how we step through macros
during diagnostic printing.

This fixes the rest of the test cases originially in PR9279, and later
split out into PR10214 and PR10215.

There is still some more work we can do here to improve the macro
backtrace, but those will follow as separate patches.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
7a759606d93975866051f67104ae58446e55f404 07-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move SourceManager::isAt[Start/End]OfMacroInstantiation functions to the Lexer, since they depend on it now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134644 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b73377eeb3eff76be134203aebb6068244b177f3 07-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make the Preprocessor more memory efficient and improve macro instantiation diagnostics.

When a macro instantiation occurs, reserve a SLocEntry chunk with length the
full length of the macro definition source. Set the spelling location of this chunk
to point to the start of the macro definition and any tokens that are lexed directly
from the macro definition will get a location from this chunk with the appropriate offset.

For any tokens that come from argument expansion, '##' paste operator, etc. have their
instantiation location point at the appropriate place in the instantiated macro definition
(the argument identifier and the '##' token respectively).
This improves macro instantiation diagnostics:

Before:

t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
int y = M(/);
^~~~
t.c:5:11: note: instantiated from:
int y = M(/);
^

After:

t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
int y = M(/);
^~~~
t.c:3:20: note: instantiated from:
\#define M(op) (foo op 3);
~~~ ^ ~
t.c:5:11: note: instantiated from:
int y = M(/);
^

The memory savings for a candidate boost library that abuses the preprocessor are:

- 32% less SLocEntries (37M -> 25M)
- 30% reduction in PCH file size (900M -> 635M)
- 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134587 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
8b86ef0b71900c64c0c2cfca54cac08a203a16a4 07-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix bug in SourceManager::getDecomposedInstantiationLocSlowCase.

It would add up relative (decomposed) offsets like in getDecomposedSpellingLocSlowCase, but while
it makes sense to preserve the offset among lexed spelling locations, it doesn't make
sense to add anything to the offset of the instantiation location. The instantiation
location will be the same regardless of the relative offset in the tokens that were
instantiated.

This bug didn't actually affect anything because, currently, in practice we never create macro
locations with relative offset greater than 0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134586 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d410e741e8085e109c1dc5886c0acea88a4ca0f4 07-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> For -print-stats, add the number of bytes that SLocEntryTable consumes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
e855448bc8dddac24a72ba8dc7e936d31e896fe4 06-Jul-2011 Benjamin Kramer <benny.kra@googlemail.com> SmallVectorize a critical vector.

The small number of elements was determined by taking the median
file length in clang+llvm and /usr/include on OS X with xcode installed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ed37ab82c7790569bcd39f4ba421b17433ef530a 24-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> SourceManager::isAtStartOfMacroInstantiation should check not only if the location
is at the first token but that the location's offset is not inside the token as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
65aa6885818d4b4eea2e5a9d12085b2398148662 21-Jun-2011 Jay Foad <jay.foad@gmail.com> Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133515 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
469244a322dd5d35cee1d02d70a2edbc12ac5ce7 28-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add a couple of helper methods in the SourceManager API, isAtStartOfMacroInstantiation/isAtEndOfMacroInstantiation
useful only for source locations that point at a macro token.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5adc0515aaacb6c4d4f0c9626d86c1e5c177467c 18-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Do some safety checks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
f61b831d7f6a15676b07647f507de80324cb7056 28-Apr-2011 Ted Kremenek <kremenek@apple.com> Enhance clang_getCXTUResourceUsage() to report how much memory is used by SourceManager's memory buffers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
e23ac65af568ffe611b0990818ac3a57c856a4d8 20-Apr-2011 Douglas Gregor <dgregor@apple.com> Teach SourceManager::getSLocEntry() that it can fail due to problems
during deserialization from a precompiled header, and update all of
its callers to note when this problem occurs and recover (more)
gracefully. Fixes <rdar://problem/9119249>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129839 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
fc8f0e14ad142ed811e90fbd9a30e419e301c717 15-Apr-2011 Chris Lattner <sabre@nondot.org> fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
156119df1d076b63609618976281961283f871db 09-Apr-2011 Eric Christopher <echristo@apple.com> Eat the UTF-8 BOM at the beginning of a file since it's ignored anyhow.

Nom Nom Nom.

Patch by Anton Korobeynikov!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
299a4a967b02c9f0d0d94ad8560e3ced893f9116 09-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true the SourceManager
should report the original file name for contents of files that were overriden by other files,
otherwise it should report the name of the new file. Default is true.

Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b1c86492f9a9bef01a4567408c22f961bbd604fe 05-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Currently we can only remap a file by creating a MemoryBuffer and replacing the file contents with it.
Allow remapping a file by specifying another filename whose contents should be loaded if the original
file gets loaded. This allows to override files without having to create & load buffers in advance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127052 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5ef04ee40c3332d31b6d1439f50d0ddb45812929 23-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Switch the VerifyDiagnosticsClient to use PresumedLocs now that they
exist. Cheat and do this by adding some wrappers around the PresumedLoc
machinery that directly return the line and column number.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
37c02bf479c86c31ad2af75adbe1ead2b928ca93 16-Feb-2011 Douglas Gregor <dgregor@apple.com> Fix a thinko with llvm::Optional, which is clearly the most dangerous class template in the universe

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b7a1841244418b658bcf64573ff0c00867fb9c5d 11-Feb-2011 Douglas Gregor <dgregor@apple.com> Don't compare llvm::Optional<> objects directly; compare their
contents when it's safe. I just *love* C++ some days.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
86a4d0dd6a630639aab7715323ed068940e650af 03-Feb-2011 Douglas Gregor <dgregor@apple.com> Teach SourceManager::getLocation() how to cope with a source file
whose inode has changed since the file was first created and that is
being seen through a different path name (e.g., due to symlinks or
relative path elements), such that its FileEntry pointer doesn't match
a known FileEntry pointer. Since this requires a system call (to
stat()), we only perform this deeper checking if we can't find the
file by comparing FileEntry pointers.

Also, add a micro-optimization where we don't bother to compute line
numbers when given the location (1, 1). This improves the
efficiency of clang_getLocationForOffset().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3de84241d90f3dd280126fdf2c4651667151c967 31-Jan-2011 Douglas Gregor <dgregor@apple.com> Harden Lexer::GetBeginningOfToken() against bogus source locations and
the disappearance/alteration of files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124616 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ee933e1cc2718bd829c4649d060fc9f686005990 24-Dec-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Handle locations coming from macro instantiations properly in SourceManager::isBeforeInTranslationUnit().
Fixes rdar://8790245 and http://llvm.org/PR8821.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
03013fa9a0bf1ef4b907f5fec006c8f4000fdd21 29-Nov-2010 Michael J. Spencer <bigcheesegs@gmail.com> Merge System into Support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b088cd3138b1fdb286c51e982ddda1e8af9d7e86 23-Nov-2010 Chris Lattner <sabre@nondot.org> reduce indentation and use early outs, to make it easier to read
this code. no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
39b49bcaaddb1049234fca9500c0ac02c088e23d 23-Nov-2010 Chris Lattner <sabre@nondot.org> now the FileManager has a FileSystemOpts ivar, stop threading
FileSystemOpts through a ton of apis, simplifying a lot of code.
This also fixes a latent bug in ASTUnit where it would invoke
methods on FileManager without creating one in some code paths
in cindextext.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
151466a18671df9cfd9abd59ba53df35b1d687da 23-Nov-2010 Chris Lattner <sabre@nondot.org> Partially revert Doug's PCH validation patch (r98585).

This patch completely defeated the "passing in a prestat'd size
to MemoryBuffer" optimization, leading to an extra fstat call for
every buffer opened, in order to find out if the datestamp and size
of the file on disk matches what is in the stat cache.

I fully admit that I don't completely understand what is going on here:
why punish code when a stat cache isn't in use? what is the point of a
stat cache if you have to turn around and stat stuff to validate it?

To resolve both these issues, just drop the modtime check and check the
file size, which is the important thing anyway. This should also resolve
PR6812, because presumably windows is stable when it comes to file sizes.
If the modtime is actually important, we should get it and keep it on the
first stat.

This eliminates 833 fstat syscalls when processing Cocoa.h, speeding up
system time on -Eonly Cocoa.h from 0.041 to 0.038s.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
33e4e70c8c0a17e0ccb7465d96556b077a68ecb1 18-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Refactoring of Diagnostic class.

-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119730 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5807d9cce3f0ab4366bed9470355433c7b562c8d 18-Nov-2010 Benjamin Kramer <benny.kra@googlemail.com> Fix a typo in the UTF-8 BOM (PR8645). Use a StringSwitch while at it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
389db16c63eec6ecfa9b235155252d8da766e94e 03-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement -working-directory.

When -working-directory is passed in command line, file paths are resolved relative to the specified directory.
This helps both when using libclang (where we can't require the user to actually change the working directory)
and to help reproduce test cases when the reproduction work comes along.

--FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains
the working directory value if set).
--FileSystemOptions are passed around to various interfaces that perform file operations.
--Opening & reading the content of files should be done only through FileManager. This is useful in general since
file operations will be abstracted in the future for the reproduction mechanism.

FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same
FileManager but with different FileSystemOptions.

Addresses rdar://8583824.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
c417fa024495c10a5e678ea36a5f8c715528bdd1 02-Nov-2010 Douglas Gregor <dgregor@apple.com> Teach SourceManager::getPresumedLoc() how to fail gracefully if getLineNumber/getColumnNumber fail

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117990 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
0d06e998910934e5ef070f53f4c272e7c6b846c6 26-Oct-2010 Dan Gohman <gohman@apple.com> getOrCreateContentCache never returns null, so overrideFileContents
doesn't need its return value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117393 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
14bd96571ef6f0e97dc79ec4d01b547d60e8fa68 23-Oct-2010 Chandler Carruth <chandlerc@gmail.com> Update remaining attribute macros to new style.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
1f24e11769016e84ebf86ac5d97d43a7ce5dd5c1 05-Oct-2010 Zhanyong Wan <wan@google.com> Fix handling of the 'Invalid' argument in SourceManager's methods (patch by Dean Sturtevant, reviewed by chandlerc and Sebastian Redl).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115638 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3f86b789f5b98731937f90b3941104a313766953 26-Aug-2010 Dan Gohman <gohman@apple.com> Fix a typo.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3c7f4134603d04b44f997b43c0a9def270f25386 19-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> More PCH -> AST renaming.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b86238d2f0a93ce91717906f9211927f48a7121a 28-Jul-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Add a test case for tentative definitions in chained PCH. Fix a bug that completely messed up source locations and thus caused a crash whenever a diagnostic was emitted in chained PCH files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
f4f6c9db68465b886ec2e596feaa6ecc782395a4 26-Jul-2010 Douglas Gregor <dgregor@apple.com> Introduce basic support for loading a precompiled preamble while
reparsing an ASTUnit. When saving a preamble, create a buffer larger
than the actual file we're working with but fill everything from the
end of the preamble to the end of the file with spaces (so the lexer
will quickly skip them). When we load the file, create a buffer of the
same size, filling it with the file and then spaces. Then, instruct
the lexer to start lexing after the preamble, therefore continuing the
parse from the spot where the preamble left off.

It's now possible to perform a simple preamble build + parse (+
reparse) with ASTUnit. However, one has to disable a bunch of checking
in the PCH reader to do so. That part isn't committed; it will likely
be handled with some other kind of flag (e.g., -fno-validate-pch).

As part of this, fix some issues with null termination of the memory
buffers created for the preamble; we were trying to explicitly
NULL-terminate them, even though they were also getting implicitly
NULL terminated, leading to excess warnings about NULL characters in
source files.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109445 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d3b8cc27920a0f4eb6e832e24a602475aa9f0ff0 07-May-2010 Chris Lattner <sabre@nondot.org> clean up isBeforeInTranslationUnit by factoring out some common
code into a MoveUpIncludeHierarchy helper, and use the helper to
fix a case involving macros which regressed from my recent patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103288 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
48296ba924cb95e0d898fa7a1da33f23be8c731c 07-May-2010 Chris Lattner <sabre@nondot.org> reimplement the guts of SourceManager::isBeforeInTranslationUnit
to be algorithmically faster and avoid an std::map. This routine
basically boils down to finding the nearest common ancestor in a
tree, and we (implicitly) have information about nesting depth,
use it!

This wraps up rdar://7948633 - SourceManager::isBeforeInTranslationUnit has poor performance


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
66a915fbd73a0e404ed28f58e4a3f1b8d0f8fb94 07-May-2010 Chris Lattner <sabre@nondot.org> start using the caching now that it appears to work!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103236 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
dcb1d68f6ffa183f3919aee6b554aec3793bf13e 07-May-2010 Chris Lattner <sabre@nondot.org> reimplement the caching in the SourceManager::isBeforeInTranslationUnit()
method to be correct. Right now it correctly computes the cache, then
goes ahead and computes the result the hard way, then asserts that they
match. Next I'll actually turn it on.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
672c003286c6493121ea1c9aca31f5504de737d2 06-May-2010 Ted Kremenek <kremenek@apple.com> Workaround a really serious caching bug in SourceManager::isBeforeInTranslationUnit() where the
method will sometimes return different results for the same input SourceLocations. I haven't
unraveled this method completely yet, so this truly is a workaround until a better fix comes
along.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103143 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5c5db4e94bd1243ba92563acba51ba66afa94917 20-Apr-2010 Chris Lattner <sabre@nondot.org> change FullSourceLoc to have a *const* SourceManager&, eliminating
a const_cast.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
e127a0d80155b45dafe77f2b4380e5fa111a3345 20-Apr-2010 Chris Lattner <sabre@nondot.org> push some source location information down through the compiler,
into ContentCache::getBuffer. This allows it to produce
diagnostics on the broken #include line instead of without a
location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
38caec48bc1c9816ca59b8d164a64447ee208c2e 20-Apr-2010 Chris Lattner <sabre@nondot.org> enhance sourcemgr to detect various UTF BOM's and emit a fatal error
about it instead of producing tons of garbage from the lexer.

It would be even better for sourcemgr to dynamically transcode (e.g.
from UTF16 -> UTF8).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
0b3c773bdc4f5d5f3aaf882b2f7a5f14df6041e0 10-Apr-2010 Daniel Dunbar <daniel@zuster.org> Disable diag::err_file_modified on Win32 completely, until someone cares to fix
it. PR6812.
- This is another attempt at silencing annoying buildbot failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
9f692a0308975cf24ef117c05e31284a1a944e86 09-Apr-2010 Douglas Gregor <dgregor@apple.com> On Windows, disable the modification-time check for files used in
precompiled headers and/or when reading the contents of the file into
memory. These checks seem to be causing spurious regression-test
failures on Windows.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
93ea5cb0edf8e509c5113e70cb05ee247c9bdf6b 22-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce the notion of a single "delayed" diagnostic into the
Diagnostic subsystem, which is used in the rare case where we find a
serious problem (i.e., an inconsistency in the file system) while
we're busy formatting another diagnostic. In this case, the delayed
diagnostic will be emitted after we're done with the other
diagnostic. This is only to be used for fatal conditions detected at
very inconvenient times, where we can neither stop the current
diagnostic in flight nor can we suppress the second error.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99175 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
2d52be56ff595341be3c6cec337af6763804ce66 21-Mar-2010 Douglas Gregor <dgregor@apple.com> Keep track of the size/modification time of each file source-location
entry in a precompiled header, so that we can detect modified files
even when we miss in the stat cache.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5de65721bd31e57f883634d9f10b1bff75c4ffc2 19-Mar-2010 Douglas Gregor <dgregor@apple.com> Fix a longstanding (but previously unknown) bug in the lazy
deserialization of precompiled headers, where the deserialization of
the source location entry for a buffer (e.g., macro instantiation
scratch space) would overwrite a one-element FileID cache in the
source manager. When tickled at the wrong time, we would return the
wrong decomposed source location and eventually cause c-index-test to
crash.

Found by dumb luck. It's amazing this hasn't shown up before.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
0419a2375f16821e40ea48e5437fefe6a803f26d 17-Mar-2010 Douglas Gregor <dgregor@apple.com> Check the inode in addition to size and modification time to determine
whether a file has changed since it was originally read.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98726 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
e39b600582f9183e3301c3e6cb48b76ac5087119 17-Mar-2010 Douglas Gregor <dgregor@apple.com> Use a simple diagnostic (file modified) when we detect that a file has
changed, rather than trying to point out how it changed. The "why"
doesn't matter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98725 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
c815108d08b0417c6f1104e7df70dc5278839406 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Teach SourceManager's content cache to keep track of whether its
buffer was invalid when it was created, and use that bit to always set
the "Invalid" flag according to whether the buffer is invalid. This
ensures that all accesses to an invalid buffer are marked invalid,
improving recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
aae58b0c3efb5fa9f97a3e4b1c1a2d31077efe5b 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Audit all getBuffer() callers (for both the FullSourceLoc and
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
/external/clang/lib/Basic/SourceManager.cpp
f6ac97b101c8840efa92bf29166077ce4049e293 16-Mar-2010 Benjamin Kramer <benny.kra@googlemail.com> Let SourceManager::getBufferData return StringRef instead of a pair of two const char*.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
50f6af7a6d6951a63f3da7d4c5a7d3965bf73b63 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce optional "Invalid" parameters to routines that invoke the
SourceManager's getBuffer() and, therefore, could fail, along with
Preprocessor::getSpelling(). Use the Invalid parameters in the literal
parsers (string, floating point, integral, character) to make them
robust against errors that stem from, e.g., PCH files that are not
consistent with the underlying file system.

I still need to audit every use caller to all of these routines, to
determine which ones need specific handling of error conditions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
36c35ba0aca641e60e5dbee8efbc620c08b9bd61 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Use SourceManager's Diagnostic object for all file-reading errors,
simplifying the SourceManager interfaces somewhat.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98598 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
f715ca12bfc9fddfde75f98a197424434428b821 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Give SourceManager a Diagnostic object with which to report errors,
and start simplifying the interfaces in SourceManager that can fail.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98594 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
f9b0a58a103784495309543dce4469e44861b4cc 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Add some <cstdio> includes to unbreak the buildbots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98591 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
aea67dbd653a2dd6dd5cc2159279e81e855b2482 15-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce a new BufferResult class to act as the return type of
SourceManager's getBuffer() (and similar) operations. This abstract
can be used to force callers to cope with errors in getBuffer(), such
as missing files and changed files. Fix a bunch of callers to use the
new interface.

Add some very basic checks for file consistency (file size,
modification time) into ContentCache::getBuffer(), although these
checks don't help much until we've updated the main callers (e.g.,
SourceManager::getSpelling()).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
8515fbf1a1b89e9750ebf3e2ee2c9440424befee 10-Mar-2010 Ted Kremenek <kremenek@apple.com> Fix -Wsign-compare warning reported by clang++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98170 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d1eabfb15c87837c57d1eb658d75a1f48d6fd5ed 27-Feb-2010 Douglas Gregor <dgregor@apple.com> Robustify SourceManager::getLocation(), so that it returns an
end-of-line source location when given a column number beyond the
length of the line, or an end-of-file source location when given a
line number beyond the length of the file. Previously, we would return
an invalid location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
a5c6c5814b4c9f562247d2182eb59ccad128dbde 12-Feb-2010 Chris Lattner <sabre@nondot.org> fix a bug in SourceManager::getInstantiationLocSlowCase, where
we'd add an offset from the spelling location space to the
instantiation location, which doesn't make sense and would
lead up to the text diagnostics crashing when presented with
non-sensical locations.

This fixes rdar://7597492, a crash on 255.vortex.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
21a8bed504a95df019771ab1a3dc9ecccfd9cfaa 06-Dec-2009 Daniel Dunbar <daniel@zuster.org> Add a pretty horrible hack to prevent clang from crashing with inconsistent PCH
files.
- The issue is that PCH uses a stat cache, which may reference files which have
been deleted or moved. In such cases ContentCache::getBuffer was returning 0
but most clients are incapable of dealing with this (i.e., they don't).

For the time being, resolve this issue by just making up some invalid file
contents and. Eventually we should detect that we are in an inconsistent
situation and error out with a nice message that the PCH is out of date.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90699 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
109ae73ec71a1d27358510ce049b59637b4a6b40 03-Dec-2009 Douglas Gregor <dgregor@apple.com> Minor cleanup to the code-completion-point logic suggested by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
2968442603b029949246467253eeac8139a5b6d8 02-Dec-2009 Douglas Gregor <dgregor@apple.com> Extend the source manager with the ability to override the contents of
files with the contents of an arbitrary memory buffer. Use this new
functionality to drastically clean up the way in which we handle file
truncation for code-completion: all of the truncation/completion logic
is now encapsulated in the preprocessor where it belongs
(<rdar://problem/7434737>).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90300 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
4a160e16eb97bee03e36962d11aedc6452710bc5 02-Dec-2009 Douglas Gregor <dgregor@apple.com> Eliminate the unnecessary FirstFID cache variable from the source manager's ContentCache

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
fbcc7bed1a0661ecc91b62e0696b8310887713f6 02-Dec-2009 Daniel Dunbar <daniel@zuster.org> In SourceManager::isBeforeInTranslationUnit, if we are trying to compare two source locations with no common ancestor in the include stack, determine order by assuming memory buffers preceed files, and then that FileIDs are created in order.

The later assumption is patently false, but this was already broken -- this situation is conceptually impossible, my feeling is we should fix SourceManager and friends to make it impossible in practice as well. However, we need to fix PR5662 and perhaps some other things involving memory buffers first. In the short term I'm pretty sure this is reliable.

Chris, Argiris, is this going to break anything that wasn't already broken?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90280 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
39d9841ed4c0568d4b44dfbc12ac04491f60a374 01-Dec-2009 Chris Lattner <sabre@nondot.org> pass the reason for failure up from MemoryBuffer and report it
in diagnostics when we fail to open a file. This allows us to
report things like:

$ clang test.c -I.
test.c:2:10: fatal error: error opening file './foo.h': Permission denied
#include "foo.h"
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90276 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
c997eb4ac1b332406b1f16d4eddce7988d68c56b 14-Nov-2009 Benjamin Kramer <benny.kra@googlemail.com> Move DISABLE_INLINE to the front of the decl so MSVC can parse it. Patch by Amine Khaldi!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88797 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
170b765785a00e8a66bf7f917dd5ec355d32d2d8 03-Nov-2009 Chris Lattner <sabre@nondot.org> pr5371 likely has nothing to do with this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3963e756e35d61e4a0c973f301a068c9bfd2f346 02-Nov-2009 Edward O'Callaghan <eocallaghan@auroraux.org> Add note to FIXME about PR5371.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85825 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b657f115c3b4e262e72906a28cbcf3eaccd9460c 22-Sep-2009 Douglas Gregor <dgregor@apple.com> Replace the -code-completion-dump option with

-code-completion-at=filename:line:column

which performs code completion at the specified location by truncating
the file at that position and enabling code completion. This approach
makes it possible to run multiple tests from a single test file, and
gives a more natural command-line interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82571 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d57a7ef9252964bc6c8471451d7bd395b0520cb8 24-Aug-2009 Chris Lattner <sabre@nondot.org> API changes to match llvm ToT.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
6cb7c1a43b0c8f739d1f54b7fdae5ede86033496 23-Aug-2009 Benjamin Kramer <benny.kra@googlemail.com> Replace cerr with errs().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79854 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
081445cb66b28a633f02b5fba06807ef79e29f67 25-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix column checking for SourceManager::getLocation().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74194 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5eee090e3880f3763a9a81a6780a84829f1c6bd0 24-Jun-2009 Daniel Dunbar <daniel@zuster.org> Fix warning when building w/o asserts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74020 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
2aa03d588bd2d3c73deb662880c2244bf2e384b9 24-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce SourceManager::ísBeforeInTranslationUnit() which can compare 2 source locations and determine which one comes before the other, relative to the translation unit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74014 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ea703f1218971511181765c37073c03e1437c5cc 23-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> In SourceManager::createFileID missed setting ContentCache's FirstFID in another place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
93edc3c874257077aac59db7f897cee984113db2 20-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Slight modification to column checking inside SourceManager::getLocation().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73826 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
10b46d2f0b976676d10681d73fe061b5ae409b36 20-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce SourceManager::getLocation() to get a source location out of a "file:line:column" triplet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73823 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
a106fea080c9a9fd50c9e5fc26b9752c43614639 07-Jun-2009 Zhongxing Xu <xuzhongxing@gmail.com> Remove dead code: 'NewEntry' is not used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
4106d696d7d0725fcd442fdda28a07049d47c573 18-May-2009 Daniel Dunbar <daniel@zuster.org> Avoid potential out-of-bounds access in SourceManager::getLineNumber.
- Chris, please see added FIXMEs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72019 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
2bf1eb09f06a9792fa94dff0703f2aa2c4bace2a 27-Apr-2009 Douglas Gregor <dgregor@apple.com> Be more careful in our teardown of the PCHReader after deciding to
ignore a PCH file.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70251 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
7f94b0b0c6791013d2f72ced9b4bedd3b23673a6 27-Apr-2009 Douglas Gregor <dgregor@apple.com> Load most of the source manager's information lazily from the PCH
file. In particular, only eagerly load source location entries for
files and for the predefines buffer. Other buffers and
macro-instantiation source location entries are loaded lazily.

With the Cocoa-prefixed "Hello, World", we only load 815/26555 source
location entities. This halves the amount of user time we spend in
this "Hello, World" program with -fsyntax-only (down to .007s).

This optimization is part 1 of 2 for the source manager. This
eliminates most of the user time in loading a PCH file. We still spend
too much time initialize File structures (especially in the calls to
stat), so we need to either make the loading of source location
entries for files lazy or import the stat cache from the PTH
implementation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
370187c8a3e96517c943329f2511737a04b85450 22-Apr-2009 Douglas Gregor <dgregor@apple.com> Remove the serialization code that predates precompiled
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
/external/clang/lib/Basic/SourceManager.cpp
bd94500d3aa60092fb0f1e90f53fb0d03fa502a8 13-Apr-2009 Douglas Gregor <dgregor@apple.com> Include the SourceManager's line table in the PCH file. We can now
properly cope with #line directives in PCH files.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
d4f77aa7c276be49aee5e59ef509cb91e26aa79f 13-Apr-2009 Douglas Gregor <dgregor@apple.com> Factor the internals of SourceManager (specially, LineTableInfo) into a separate Internals header. No functionality change

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68960 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3050ed44aea059f1bb48d05b6dd64478bd8ed0aa 03-Apr-2009 Douglas Gregor <dgregor@apple.com> Resynchronize Decl/VarDecl serialization code with the structures

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
1841aa19aa577437f3b0ff8ce1ff8deafa20d6c8 11-Mar-2009 Chris Lattner <sabre@nondot.org> Clear all the linetable state in clear(), fixing problems
with "clang t.i s.i" where the .i files contain line markers.
rdar://6667812


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
bff5c512af8ca7ac92e974e04c06ff4f820e4ee1 17-Feb-2009 Chris Lattner <sabre@nondot.org> add an accessor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
387616edf98739f4a0dd234c907e2b913e6a535d 17-Feb-2009 Chris Lattner <sabre@nondot.org> add an accessor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
6678133b8ce642f93e5141f056fa643112041ad0 15-Feb-2009 Chris Lattner <sabre@nondot.org> add a new SourceManager::getInstantiationRange helper method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
e7fb48466afcbf2c4ccdfa658824282fdc3c512c 15-Feb-2009 Chris Lattner <sabre@nondot.org> track "just a little more" location information for macro instantiations.
Now instead of just tracking the expansion history, also track the full
range of the macro that got replaced. For object-like macros, this doesn't
change anything. For _Pragma and function-like macros, this means we track
the locations of the ')'.

This is required for PR3579 because apparently GCC uses the line of the ')'
of a function-like macro as the location to expand __LINE__ to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64601 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ea684e699ea84e61711e279f5fa7a1b9f3d46bc2 14-Feb-2009 Cedric Venet <cedric.venet@laposte.net> Fix the build on win32.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64556 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
137b6a6149c53dbbcb8fba98e524d9ad0f3c8736 04-Feb-2009 Chris Lattner <sabre@nondot.org> Implement handling of file entry/exit notifications from GNU
line markers, including maintenance of the virtual include stack.

For something like this:

# 42 "bar.c" 1
# 142 "bar2.c" 1

#warning zappa
# 92 "bar.c" 2
#warning gonzo
# 102 "foo.c" 2
#warning bonkta


we now produce these three warnings:

#1:
In file included from foo.c:3:
In file included from bar.c:42:
bar2.c:143:2: warning: #warning zappa
#warning zappa
^

#2:
In file included from foo.c:3:
bar.c:92:2: warning: #warning gonzo
#warning gonzo
^

#3:
foo.c:102:2: warning: #warning bonkta
#warning bonkta
^




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
6b3066780bda02e3117d71a18ca2f430ed1454af 04-Feb-2009 Chris Lattner <sabre@nondot.org> make getFileCharacteristic linetable aware. line markers that
play around with the 'is system header' bit now function correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
9d79ebac47ffde6a1cb312f4c09b66b1b9a397fb 04-Feb-2009 Chris Lattner <sabre@nondot.org> propagate linemarker flags down into the the line table, currently
ignoring include stack push/pop info though.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63719 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
6c1fbe05efa93ebabae7150c915624efd8f3f715 04-Feb-2009 Chris Lattner <sabre@nondot.org> replace gimpy linear search with svelte binary search ;-)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
1c4a49813bcf9e24711e5963ea6b2c27e5113a6e 04-Feb-2009 Chris Lattner <sabre@nondot.org> make my atrocious linear search at least search in the order that is
more likely to hit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63714 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
0e0e5da00e92a9ee97b2469009355926ee8d94bf 04-Feb-2009 Chris Lattner <sabre@nondot.org> add comment



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63712 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
fc391330724ad2d3f0f486dc7a0ce96e9e73c33b 04-Feb-2009 Chris Lattner <sabre@nondot.org> add the difference in the line marker phys line number and the
query point to the returned presumed location. We now produce:

foo.h:92:2: warning: #warning blarg!
#warning blarg!
^
foo.h:93:2: warning: #warning blarg!
#warning blarg!
^
foo.h:94:2: warning: #warning blarg!
#warning blarg!
^

for:

#line 92 "foo.h"
#warning blarg!
#warning blarg!
#warning blarg!

blarg indeed!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63710 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3cd949c27c63f544a081b9a750740064ddef181b 04-Feb-2009 Chris Lattner <sabre@nondot.org> add really really trivial #line support, where #line now makes every
location below it report as coming from the #line location. For example,
with:

#line 92 "foo.h"
#warning blarg!
#warning blarg!

we now emit:

foo.h:92:2: warning: #warning blarg!
#warning blarg!
^
foo.h:92:2: warning: #warning blarg!
#warning blarg!
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63709 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
30fc933e5fbbb5f0ea60c47976d435254e378536 04-Feb-2009 Chris Lattner <sabre@nondot.org> lower the interface to getLineNumber like we did for
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
/external/clang/lib/Basic/SourceManager.cpp
7da5aea7669e6db3e593162b8a123aef06a04d07 04-Feb-2009 Chris Lattner <sabre@nondot.org> make SM::getColumnNumber take a predecomposed FileID/offset, which
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
/external/clang/lib/Basic/SourceManager.cpp
23b5dc65451b1f91c0ecf337216c8ff473308cc2 04-Feb-2009 Chris Lattner <sabre@nondot.org> build per-fid linetable entries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ac50e3427cb9eb3dc9f13f29a78f00ef3122433d 03-Feb-2009 Chris Lattner <sabre@nondot.org> more plumbing for #line propagation. Use happy bit #3
out of FileInfo :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
4c4ea17d7f991516c37a871dfa4bbe5723fa85f0 03-Feb-2009 Chris Lattner <sabre@nondot.org> stub out basic #line handling calls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
00282d6e1194655a2e89f940bd6fa8484b52e666 03-Feb-2009 Chris Lattner <sabre@nondot.org> reclaim my precious bit in FileInfo by ensuring that ContentCache objects
are 8-byte aligned.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
0d0bf8cf58b35302312cc155287fde3e81eb25a7 03-Feb-2009 Chris Lattner <sabre@nondot.org> switch SourceManager from using an std::map and std::list of
ContentCache objects to using a densemap and list, and allocating
the ContentCache objects from a bump pointer. This does not speed
up or slow down things substantially, but gives us control over
their alignment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
b9c3f966b103f7cfe8e5e60007c4c8b38f7298eb 27-Jan-2009 Chris Lattner <sabre@nondot.org> Introduce a new PresumedLoc class to represent the concept of a location
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
/external/clang/lib/Basic/SourceManager.cpp
08c375cd52b8f6b6a6915a2007205bc8179f41e9 27-Jan-2009 Chris Lattner <sabre@nondot.org> make -print-stats print stats about the amount of the SLoc
address space we used up. Some interesting data:

For c99-intconst-1.c:
6912762 SLocEntry's allocated, 25592386B of Sloc address space used.

For cocoa.h:
26469 SLocEntry's allocated, 10278752B of Sloc address space used.

For carbon.h:
27364 SLocEntry's allocated, 12398141B of Sloc address space used.

Clearly 2G of sloc address space should be enough for anyone?!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3c125576d971dfd4d81be93813a8896f302d992b 26-Jan-2009 Chris Lattner <sabre@nondot.org> now that everything properly handles multiply instantiated
source locations, allow creation of them. We can now say that
a token was instantiated here, then here, then here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63034 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
addb797ca2b5afc1a1e82fd8d5d6eb2a592e75a9 26-Jan-2009 Chris Lattner <sabre@nondot.org> make getInstantiationLoc and getSpellingLoc handle multiply instantiated
locations, and move the slow case out of line. No perf change on cocoa.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63033 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
bcd1a1b5af0b2d57b20fc393a8c3b0badc58c450 26-Jan-2009 Chris Lattner <sabre@nondot.org> fix a negated conditional in getDecomposedInstantiationLocSlowCase,
which I think is rdar://6527005, and make getDecomposedSpellingLocSlowCase
handle nested spelling locations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63030 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
5b9a504720fb52594ca3686e10eb6c0cfa2e7d62 26-Jan-2009 Chris Lattner <sabre@nondot.org> start plumbing together the line table information. So far we just
unique the Filenames in #line directives, assigning them UIDs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
987cd3da36e90aa21a9e290f5b383cf010762b83 26-Jan-2009 Chris Lattner <sabre@nondot.org> Lazily paging in file contents is a big win for PTH, strip out the old
testing code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
de7aeefc5573d669ed476d7bda7a8940d3bcadb7 26-Jan-2009 Chris Lattner <sabre@nondot.org> Check in the long promised SourceLocation rewrite. This lays the
ground work for implementing #line, and fixes the "out of macro ID's"
problem.

There is nothing particularly tricky about the code, other than the
very performance sensitive SourceManager::getFileID() method.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
2fa3ec888a980bf09e3d68435e227d3c4280bf70 19-Jan-2009 Chris Lattner <sabre@nondot.org> remove the public SourceManager::getContentCacheForLoc method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
31530bae788dea5c79e72a1f99a56c3f5c6aa36f 19-Jan-2009 Chris Lattner <sabre@nondot.org> SourceManager::getBufferData(SourceLocation) is dead, delete it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62495 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
a90a4d4a0a365f991b92e925436ec63ef4969839 19-Jan-2009 Chris Lattner <sabre@nondot.org> some minor cleanups to SourceManager, and eliminate the
SourceManager::getBuffer(SourceLocation) method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3b4d5e955e819dd3a4bed37ea2e47d6e4cb05274 17-Jan-2009 Chris Lattner <sabre@nondot.org> Rename SourceLocation::getFileID to getChunkID, because it returns
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
/external/clang/lib/Basic/SourceManager.cpp
2b2453a7d8fe732561795431f39ceb2b2a832d84 17-Jan-2009 Chris Lattner <sabre@nondot.org> this massive patch introduces a simple new abstraction: it makes
"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
/external/clang/lib/Basic/SourceManager.cpp
05816591ec488a933dfecc9ff9f3cbf3c32767c2 17-Jan-2009 Chris Lattner <sabre@nondot.org> make "ContentCache::Buffer" mutable to avoid a const_cast.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
f7cf85b330bedd2877e1371fb0a83e99751ae162 16-Jan-2009 Chris Lattner <sabre@nondot.org> more SourceLocation lexicon change: instead of referring to the
"logical" location, refer to the "instantiation" location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
88054dee0402e4d3c1f64e6b697acc47195c0d72 16-Jan-2009 Chris Lattner <sabre@nondot.org> rename "virtual location" of a macro to "instantiation location".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62315 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
df7c17a8d02fe09a3466786bae3e40fc3252687a 16-Jan-2009 Chris Lattner <sabre@nondot.org> Change some terminology in SourceLocation: instead of referring to
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
/external/clang/lib/Basic/SourceManager.cpp
5b034ad3ec0aa1ad6bcb3624390f030038670705 06-Jan-2009 Ted Kremenek <kremenek@apple.com> SourceManager: Implement "lazy" creation of MemBuffers for source files.

- Big Idea:
Source files are now mmaped when ContentCache::getBuffer() is first called.
While this doesn't change the functionality when lexing regular source files,
it can result in source files not being paged in when using PTH.

- Performance change:
- No observable difference (-fsyntax-only/-Eonly) on Cocoa.h when doing
regular source lexing.
- No observable time difference (-fsyntax-only/-Eonly) on Cocoa.h when using
PTH. We do observe, however, a reduction of 279K in memory mapped source
code (3% reduction). The majority of pages from Cocoa.h (and friends) are
still being pulled in, however, because any literal will cause
Preprocessor::getSpelling() to be called (causing the source for the file to
get pulled in). The next possible optimization is to cache literal strings
in the PTH file to avoid the need for the original header sources entirely.

- Right now there is a preprocessor directive to toggle between "lazy" and
"eager" creation of MemBuffers. This is not permanent, and is there in the
short term to just test additional optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61827 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
c16c208e8519476d838ad11fffc8e0ecea50550d 06-Jan-2009 Ted Kremenek <kremenek@apple.com> Misc changes to SourceManager::ContentCache:
- 'Buffer' is now private and must be accessed via 'getBuffer()'.
This paves the way for lazily mapping in source files on demand.
- Added 'getSize()' (which gets the size of the content without
necessarily accessing the MemBuffer) and 'getSizeBytesMapped()'.
- Modifed SourceManager to use these new methods. This reduces the
number of places that actually access the MemBuffer object for a file
to those that actually look at the character data.

These changes result in no performance change for -fsyntax-only on Cocoa.h.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
f812a45dd93634c9300ed5533bd26b56374714a1 18-Nov-2008 Chris Lattner <sabre@nondot.org> SourceManager::getLineNumber is logically const except for caching.
Use mutable to make it so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59498 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
9d72851fec9e9c62570a027d42701562bbf29751 27-Oct-2008 Chris Lattner <sabre@nondot.org> Rename Characteristic_t to CharacteristicKind



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
48002c89578eaeb008a0bb5a10d8216e61906459 29-Sep-2008 Nico Weber <nicolasweber@gmx.de> whitespace and comment changes, to fix grammar and 80 col violations

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
0b9e736308af5397f558ffc8e780c438c2fdb563 26-Sep-2008 Chris Lattner <sabre@nondot.org> clean up a bunch of fixme's I added, by moving
DirectoryLookup::DirType into SourceManager.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
721818304ac462d8c6ce05eecd02884033db78f1 26-Sep-2008 Chris Lattner <sabre@nondot.org> Fix the rest of rdar://6243860 hopefully. This requires changing FileIDInfo
to whether the fileid is a 'extern c system header' in addition to whether it
is a system header, most of this is spreading plumbing around. Once we have that,
PPLexerChange bases its "file enter/exit" notifications to PPCallbacks to
base the system header state on FileIDInfo instead of HeaderSearch. Finally,
in Preprocessor::HandleIncludeDirective, mirror logic in GCC: the system headerness
of a file being entered can be set due to the #includer or the #includee.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56688 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
7bfaaaecb3113f955db31e8d8a51acffd1bc0c27 10-Aug-2008 Nico Weber <nicolasweber@gmx.de> * Remove isInSystemHeader() from DiagClient, move it to SourceManager
* 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
/external/clang/lib/Basic/SourceManager.cpp
35de512b9cb22a234a771b417507f71a2bbb5a94 01-Apr-2008 Chris Lattner <sabre@nondot.org> Update to match simplified llvm MemoryBuffer interfaces for files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
be2ab45def5c856c32cb15a2a67254e15b40b0bb 01-Apr-2008 Chris Lattner <sabre@nondot.org> prune dead #includes


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49033 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
3c1f7b615c03e55f8aaee14a5793c917c050b373 01-Apr-2008 Chris Lattner <sabre@nondot.org> MemoryBuffer::getFile got smarter, obviating the need for readfilefast.
The new MemoryBuffer doesn't "leak" file descriptors and handles the
small file case efficiently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
ff721524ec582abe6667add99c360e5ec247c736 31-Mar-2008 Steve Naroff <snaroff@apple.com> Hack ReadFileFast() to raise the threshold of memory mapped files (from 4->12 pages).

This is a temporary solution to avoid running out of file descriptors (which defaults to 256).

Need to benchmark to understand the speed benefit. If the benefit is small, the simple solution is to avoid memory mapping files. If the benefit is significant, more thought is necessary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Basic/SourceManager.cpp
bda0b626e74513950405c27525af87e214e605e2 16-Mar-2008 Chris Lattner <sabre@nondot.org> Make a major restructuring of the clang tree: introduce a top-level
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
/external/clang/lib/Basic/SourceManager.cpp