History log of /llvm-project/clang/lib/Basic/SourceManager.cpp (Results 251 – 275 of 397)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# c7ca5218 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com>

Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.

llvm-svn: 135962


# c84d769c 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com>

getInstantiationLocSlowCase -> getExpansionLocSlowCase

llvm-svn: 135961


# ca757587 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com>

Rename SourceManager::getImmediateInstantiationRange to
getImmediateExpansionRange.

llvm-svn: 135960


# 6d28d7f2 25-Jul-2011 Chandler Carruth <chandlerc@gmail.com>

Rename SourceManager::getInstantiationRange to getExpansionRange.

llvm-svn: 135915


# 0e62c1cc 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.

llvm-svn: 135852


# 925296b4 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-alloc

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.

llvm-svn: 135484

show more ...


# 402bb388 07-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 mac

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.

llvm-svn: 134660

show more ...


# 61c58f7f 07-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com>

Move SourceManager::isAt[Start/End]OfMacroInstantiation functions to the Lexer, since they depend on it now.

llvm-svn: 134644


# 41fb2d95 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 definit

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)

llvm-svn: 134587

show more ...


# c8f7e213 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 offs

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.

llvm-svn: 134586

show more ...


# 2cc62093 07-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com>

For -print-stats, add the number of bytes that SLocEntryTable consumes.

llvm-svn: 134585


# 37d30835 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.

llvm-svn: 134496


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

llvm-svn: 133800


# 9a6b0987 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().

llvm-svn: 133515


# 814b2a6d 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.

llvm-svn: 132247


# f15eac11 17-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com>

Do some safety checks.

llvm-svn: 131491


# 8d587900 28-Apr-2011 Ted Kremenek <kremenek@apple.com>

Enhance clang_getCXTUResourceUsage() to report how much memory is used by SourceManager's memory buffers.

llvm-svn: 130433


# 49f754f4 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 (mor

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

llvm-svn: 129839

show more ...


# 57540c5b 15-Apr-2011 Chris Lattner <sabre@nondot.org>

fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559


# 7f36a79e 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!

llvm-svn: 129174


Revision tags: llvmorg-2.9.0, llvmorg-2.9.0-rc3, llvmorg-2.9.0-rc2
# 97d3a38c 08-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

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.

llvm-svn: 127289

show more ...


Revision tags: llvmorg-2.9.0-rc1
# 11e6f0a6 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 ori

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.

llvm-svn: 127052

show more ...


# 1aef0c56 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.

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.

llvm-svn: 126281

show more ...


# d766be68 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

llvm-svn: 125679


# 6a5be93b 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.

llvm-svn: 125378


1...<<111213141516