History log of /external/lldb/source/Symbol/ClangASTImporter.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
52f792329be5db8e38961350589e97e8f2823acd 12-Jul-2013 Greg Clayton <gclayton@apple.com> Huge change to clean up types.

A long time ago we start with clang types that were created by the symbol files and there were many functions in lldb_private::ClangASTContext that helped. Later we create ClangASTType which contains a clang::ASTContext and an opauque QualType, but we didn't switch over to fully using it. There were a lot of places where we would pass around a raw clang_type_t and also pass along a clang::ASTContext separately. This left room for error.

This checkin change all type code over to use ClangASTType everywhere and I cleaned up the interfaces quite a bit. Any code that was in ClangASTContext that was type related, was moved over into ClangASTType. All code that used these types was switched over to use all of the new goodness.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@186130 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
d11d31283b6b7fda673940df752ba297c60790a8 30-Mar-2013 Sean Callanan <scallanan@apple.com> Fixed the way ClangASTImporter deports types from
ASTContexts that will not stay around. Before, we
did this in a very half-hearted way. Now we maintain
work queues of all Decls that need to be completed
before the source ASTContext can go away; we then
expunge their origins completely.

<rdar://problem/13511875>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
952e9dc874944fcdbbb224f3ec4fc2c859376f64 28-Mar-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13521159>

LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down.

All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
017c16aa483e6edabdbbee1bdcd1ce3f8e8a12d1 27-Mar-2013 Greg Clayton <gclayton@apple.com> Don't use a "uintptr_t" for the metadata key, use a "void *". This removes all of the casts that were being used and cleans the code up a bit. Also added the ability to dump the metadata.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
40960a7953ba723190de1be397ce9679df5b7a07 21-Mar-2013 Sean Callanan <scallanan@apple.com> Modified the way we report fields of records.
Clang requires them to have complete types, but
we were previously only completing them if they
were of tag or Objective-C object types.

I have implemented a method on the ASTImporter
whose job is to complete a type. It handles not
only the cases mentioned above, but also array
and atomic types.

<rdar://problem/13446777>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
e5bc8c178390c217a91509e9f1db48cabbd11e33 12-Mar-2013 Matt Kopec <Matt.Kopec@intel.com> Misc. clang build warning fixes.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176879 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
6741173bf58eaeab4964226ba5a42b2a9bbc21b1 08-Mar-2013 Sean Callanan <scallanan@apple.com> Added very lightweight, statically-allocated
counters for a variety of metrics associated
with expression parsing. This should give some
idea of how much work the expression parser is
doing on Clang's behalf, and help with hopefully
reducing that load over time.

<rdar://problem/13210748> Audit type search/import for expressions


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176714 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
3732a029be9ae6df657561c6106f86da1c6110a6 28-Feb-2013 Sean Callanan <scallanan@apple.com> Fixed some problems with type deportation:

- made sure we tell Clang not to try to
complete the type since it can't be
completed from its origin any more; and

- fixed a silly bug where we tried to
forget about the original decl's origins
rather than the deported decl's origin.

These produced some crashes in ptr_refs,
especially under libgmalloc.

<rdar://problem/13256150>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
803c3b042f19c9238825f4900a45676e1a2957f4 03-Dec-2012 Greg Clayton <gclayton@apple.com> Fix clang build issues.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169140 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
5f35a4be95aed0e5b2cb36f7d785bcbfc67284ae 29-Nov-2012 Daniel Malea <daniel.malea@intel.com> Resolve printf formatting warnings on Linux:
- use macros from inttypes.h for format strings instead of OS-specific types

Patch from Matt Kopec!



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
a32c5a5aa1fec0f9bc2a5b123f07ff6b8c979999 27-Oct-2012 Jim Ingham <jingham@apple.com> This is the first phase of supporting the DW_AT_object_pointer tag. I expanded the decl metadata
so it could hold this information, and then used it to look up unfound names in the object pointer
if it exists. This gets "frame var" to work for unqualified references to ivars captured in blocks.
But the expression parser is ignoring this information still.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
6f01c93497df194b6f2194630a81e87d806ce0e0 12-Oct-2012 Jim Ingham <jingham@apple.com> Bunch of cleanups for warnings found by the llvm static analyzer.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
06dc17f8eb821d7256fd42e56f85c2779a29f689 25-Sep-2012 Sean Callanan <scallanan@apple.com> Brought LLDB top-of-tree into sync with LLVM/Clang
top-of-tree. Removed all local patches and llvm.zip.

The intent is that fron now on top-of-tree will
always build against LLVM/Clang top-of-tree, and
that problems building will be resolved as they
occur. Stable release branches of LLDB can be
constructed as needed and linked to specific release
branches of LLVM/Clang.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
bf346eb7d6ed91a1696d5659dec1bf16302a89ce 21-Sep-2012 Sean Callanan <scallanan@apple.com> Fixed a problem where persistent variables did
not correctly store the contents of Objective-C
classes. This was due to a combination of
factors:

1) Types were only being completed if we were
looking inside them for specific ivars
(using FindExternalVisibleDeclsByName).
We now look the complete type up at every
FindExternalLexicalDecls.

2) Even if the types were completed properly,
ValueObjectConstResult overrode the type
of every ValueObject using the complete type
for its class from the debug information.
Superclasses of complete classes are not
guaranteed to be complete. Although "frame
variable" uses the debug information,
the expression parser does now piece together
complete types at every level (as described
in Bullet 1), so I provided a way for the
expression parser to prevent overriding.

3) Type sizes were being miscomputed by
ClangASTContext. It ignored the ISA pointer
and only counted fields. We now correctly
count the ISA in the size of an object.

<rdar://problem/12315386>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164333 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
4a379b1194f3e6b308cd6e80b45d6ca5dd0aafd7 17-Jul-2012 Greg Clayton <gclayton@apple.com> Ran the static analyzer on the codebase and found a few things.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
21049c4c19a74f38132285c1f91948d6f981c8cb 25-May-2012 Sean Callanan <scallanan@apple.com> Fixed a crash in logging when the name of an
entity imported by the ASTImporter had a NamedDecl
with a name that wasn't a plain string (e.g., a
selector).


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
1bfdb8db1e6e45b0ff8636b72f0cc4905324bcf3 18-Apr-2012 Sean Callanan <scallanan@apple.com> When an AST import fails, provide the metadata
for the original Decl, for debugging purposes.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154957 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
fafffe000eb4a3902ecefc82446d11e6838167c6 13-Apr-2012 Sean Callanan <scallanan@apple.com> Added a mechanism for keeping track of where in
the debug information individual Decls came from.

We've had a metadata infrastructure for a while,
which was intended to solve a problem we've since
dealt with in a different way. (It was meant to
keep track of which definition of an Objective-C
class was the "true" definition, but we now find
it by searching the symbols for the class symbol.)
The metadata is attached to the ExternalASTSource,
which means it has a one-to-one correspondence with
AST contexts.

I've repurposed the metadata infrastructure to
hold the object file and DIE offset for the DWARF
information corresponding to a Decl. There are
methods in ClangASTContext that get and set this
metadata, and the ClangASTImporter is capable of
tracking down the metadata for Decls that have been
copied out of the debug information into the
parser's AST context without using any additional
memory.

To see the metadata, you just have to enable the
expression log:
-
(lldb) log enable lldb expr
-
and watch the import messages. The high 32 bits
of the metadata indicate the index of the object
file in its containing DWARFDebugMap; I have also
added a log which you can use to track that mapping:
-
(lldb) log enable dwarf map
-

This adds 64 bits per Decl, which in my testing
hasn't turned out to be very much (debugging Clang
produces around 6500 Decls in my tests). To track
how much data is being consumed, I've also added a
global variable g_TotalSizeOfMetadata which tracks
the total number of Decls that have metadata in all
active AST contexts.

Right now this metadata is enormously useful for
tracking down bugs in the debug info parser. In the
future I also want to use this information to provide
more intelligent error messages instead of printing
empty source lines wherever Clang refers to the
location where something is defined.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
3356d4f89e85301e5ddec2301c75b0626d50703f 30-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11082392>

Fixed an issue that could cause circular type parsing that will assert and kill LLDB.

Prior to this fix the DWARF parser would always create class types and not start their definitions (for both C++ and ObjC classes) until we were asked to complete the class later. When we had cases like:

class A
{
class B
{
};
};

We would alway try to complete A before specifying "A" as the decl context for B. Turns out we can just start the definition and still not complete the class since we can check the TagDecl::isCompleteDefinition() function. This only works for C++ types. This means we will not be pulling in the full definition of parent classes all the time and should help with our memory consumption and also reduce the amount of debug info we have to parse.

I also reduced redundant code that was checking in a lldb::clang_type_t was a possible C++ dynamic type since it was still completing the type, just to see if it was dynamic. This was fixed in another function that was checking for a type being dynamic as an ObjC or a C++ type, but there was dedicated fucntion for C++ that we missed.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153713 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
3750e2a30aa30c4944e34c5d16c4025abb11fbea 09-Feb-2012 Sean Callanan <scallanan@apple.com> Removed another debug message. Sigh...


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150134 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
8f2e392e8937aaf66f91201dc5f4190d61902c67 04-Feb-2012 Sean Callanan <scallanan@apple.com> I have brought LLDB up-to-date with top of tree
LLVM/Clang. This brings in several fixes, including:

- Improvements in the Just-In-Time compiler's
allocation of memory: the JIT now allocates
memory in chunks of sections, improving its
ability to generate relocations. I have
revamped the RecordingMemoryManager to reflect
these changes, as well as to get the memory
allocation and data copying out fo the
ClangExpressionParser code. Jim Grosbach wrote
the updates to the JIT on the LLVM side.

- A new ExternalASTSource interface to allow LLDB to
report accurate structure layout information to
Clang. Previously we could only report the sizes
of fields, not their offsets. This meant that if
data structures included field alignment
directives, we could not communicate the necessary
alignment to Clang and accesses to the data would
fail. Now we can (and I have update the relevant
test case). Thanks to Doug Gregor for implementing
the Clang side of this fix.

- The way Objective-C interfaces are completed by
Clang has been made consistent with RecordDecls;
with help from Doug Gregor and Greg Clayton I have
ensured that this still works.

- I have eliminated all local LLVM and Clang patches,
committing the ones that are still relevant to LLVM
and Clang as needed.

I have tested the changes extensively locally, but
please let me know if they cause any trouble for you.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
39c42c55d250ce572fb60dc3d5ae219efc1ceac3 19-Jan-2012 Sean Callanan <scallanan@apple.com> Fixed a problem where Objective-C classes that were
originally imported from symbols for the expression
parser didn't get their superclasses set properly.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@148488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
e0028b827759c5ad2cbc45947371c362193a63bc 19-Jan-2012 Sean Callanan <scallanan@apple.com> Fixed a problem where maintaining the ObjCInterfaceMap
for each ObjCInterfaceDecl was imposing performance
penalties for Objective-C apps. Instead, we now use
the normal function query mechanisms, which use the
relevant accelerator tables.

This fix also includes some modifications to the
SymbolFile which allow us to find Objective-C methods
and report their Clang Decls correctly.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@148457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
a981a6439ccd6cb10adffa94bc0e6dc6061a5070 13-Jan-2012 Sean Callanan <scallanan@apple.com> I made two major improvements to the way the
master AST importer imports types.

- First, before importing the definition of a
Decl from its source, notify the underlying
importer of the source->destination mapping.
Especially for anonymous strucutres that are
otherwise hard to unique in the target AST
context, this hint is very helpful.

- When deporting a type or Decl from one
ASTContext to another (deporting occurs in
the case of moving result types from the
parser's AST context to the result AST
context), don't forget their origin if the
origin is the original debug information.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@148152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
a75feaf0b7c7f1b4339d4355a94e1088be00e6b0 21-Dec-2011 Sean Callanan <scallanan@apple.com> Fixed a bug in the ASTImporter that affects
types that have been imported multiple times.

The discussion below uses this diagram:

ASTContext A B C
Decl Da Db Dc
ASTImporter \-Iab-/\-Iac-/
\-----Iac----/

When a Decl D is imported from ASTContext A to
ASTContext B, the ASTImporter Iab records the
pair <Da, Db> in a DenseMap. That way, if Iab
ever encounters Da again (for example, as the
DeclContext for another Decl), it can use the
imported version. This is not an optimization,
it is critical: if I import the field "st_dev"
as part of importing "struct stat," the field
must have DeclContext equal to the parent
structure or we end up with multiple different
Decls containing different parts of "struct
stat." "struct stat" is imported once and
recorded in the DenseMap; then the ASTImporter
finds that same version when looking for the
DeclContext of "st_dev."

The bug arises when Db is imported into another
ASTContext C and ASTContext B goes away. This
often occurs when LLDB produces result variables
for expressions. Ibc is aware of the transport
of Db to Dc, but a brand new ASTImporter, Iac,
is responsible for completing Dc from its source
upon request. That ASTImporter has no mappings,
so it will produce a clone of Dc when attempting
to import its children. That means that type
completion operations on Dc will fail.

The solution is to create Iac as soon as Ibc
imports D from B to C, and inform Iac of the
mapping between Da and Dc. This allows type
completion to happen correctly.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147016 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
0539a80ae9cdb243d1db3cfd34b504b391658703 16-Dec-2011 Sean Callanan <scallanan@apple.com> Updated Clang to take an enhancement to the way
we handle Objective-C method calls. Currently,
LLDB treats the result of an Objective-C method
as unknown if the type information doesn't have
the method's signature. Now Clang can cast the
result to id if it isn't explicitly cast.

I also added a test case for this, as well as a
fix for a type import problem that this feature
exposed.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
b2027ec7cc8c15dfdc7c945dc6aed4b5d684321e 09-Dec-2011 Sean Callanan <scallanan@apple.com> If the expression parser is unable to complete a TagDecl
in the context in which it was originally found, the
expression parser now goes hunting for it in all modules
(in the appropriate namespace, if applicable). This means
that forward-declared types that exist in another shared
library will now be resolved correctly.

Added a test case to cover this. The test case also tests
"frame variable," which does not have this functionality
yet.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
e1301a62783cf0d5457350b90830917841cbf6fc 06-Dec-2011 Sean Callanan <scallanan@apple.com> As part of the work to make Objective-C type information
from symbols more accessible, I have added a second
map to the ClangASTImporter: the ObjCInterfaceMetaMap.
This map keeps track of all type definitions found for
a particular Objective-C interface, allowing the
ClangASTSource to refer to all possible sources when
looking for method definitions.

There is a bug in lookup that I still need to figure out,
but after that we should be able to report full method
information for Objective-C classes shown in symbols.

Also fixed some errors I ran into when enabling the maps
for the persistent type store. The persistent type store
previously did not use the ClangASTImporter to import
types, instead using ASTImporters that got allocated each
time a type needed copying. To support the requirements
of the persistent type store -- namely, that types must be
copied, completed, and then completely severed from their
origin in the parser's AST context (which will go away) --
I added a new function called DeportType which severs all
these connections.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
a3d044783843585481742aace4af7962c843ffe7 29-Nov-2011 Sean Callanan <scallanan@apple.com> Changed ClangASTImporter to allow finer-grained
management of what allocations remain after an
expression finishes executing. This saves around
2.5KiB per expression for simple expressions.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145342 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
5a55c7a90100e2ed832c35955645bf146e8a66b7 18-Nov-2011 Sean Callanan <scallanan@apple.com> This commit completes the rearchitecting of ClangASTSource
to allow variables in the persistent variable store to know
how to complete themselves from debug information. That
fixes a variety of bugs during dematerialization of
expression results and also makes persistent variable and
result variables ($foo, $4, ...) more useful.

I have also added logging improvements that make it much
easier to figure out how types are moving from place to
place, and made some checking a little more aggressive.

The commit includes patches to Clang which are currently being
integrated into Clang proper; once these fixes are in Clang
top-of-tree, these patches will be removed. The patches don't
fix API; rather, they fix some internal bugs in Clang's
ASTImporter that were exposed when LLDB was moving types from
place to place multiple times.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
595553a651fe59867e6d70113cbfff68d4427790 16-Nov-2011 Sean Callanan <scallanan@apple.com> Added support to the ASTImporter for passing
completion information between different AST
contexts. It works like this:

- If a Decl is imported from a context that
has completion metadata, then that Decl
is associated with the same completion
information (possibly none) as the Decl
it was imported from.

- If a Decl is imported from a context that
does not have completion metadata, then it
is marked as completable by consulting the
Decl and context it was imported from.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
d01bf8848e2407fca0621ede07a2b39be741e45f 16-Nov-2011 Sean Callanan <scallanan@apple.com> Changed the ClangASTImporter to store metadata
for each AST context it knows about in a single
object. This makes it faster to look up the
appropriate ASTImpoter for a given ASTContext
pair and also makes it much easier to delete all
metadata for a given AST context.

In the future, this fix will allow the
ClangASTImporter to propagate completion
information between the metadata for different
AST contexts as its minions move AST objects
around.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144835 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
cf3c7bd6eb28a5a14063689607473d9d8b794c05 16-Nov-2011 Sean Callanan <scallanan@apple.com> Added a CopyType method to the ASTImporter that
handles opaque QualTypes.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144813 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
4938bd6ebe7ce788c1fd74cf657a5e4c882d929a 16-Nov-2011 Sean Callanan <scallanan@apple.com> I made the ClangASTImporter owned by the target
rather than individually on behalf of each
ASTContext. This allows the ASTImporter to know
about all containers of types, which will let it
be smarter about forwarding information about
type origins. That means that the following
sequence of steps will be possible (after a few
more changes):

- Import a type from a Module's ASTContext into
an expression parser ASTContext, tracking its
origin information -- this works now.

- Because the result of the expression uses that
type, import it from the expression parser
ASTContext into the Target's scratch AST
context, forwarding the origin information --
this needs to be added.

- For a later expression that uses the result,
import the type from the Target's scratch AST
context, still forwarding origin information
-- this also needs to be added.

- Use the intact origin information to complete
the type as needed -- this works now if the
origin information is present.

To this end, I made the following changes:

- ASTImporter top-level copy functions now
require both a source and a destination AST
context parameter.

- The ASTImporter now knows how to purge
records related to an ASTContext that is
going away.

- The Target now owns and creates the ASTImporter
whenever the main executable changes or (in the
absence of a main executable) on demand.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
e6ea5fe8e76b028a0565bc01543bc15f8c120e8a 15-Nov-2011 Sean Callanan <scallanan@apple.com> Pulled in a new version of LLVM/Clang to solve a variety
of problems with Objective-C object completion. To go
along with the LLVM/Clang-side fixes, we have a variety
of Objective-C improvements.

Fixes include:

- It is now possible to run expressions when stopped in
an Objective-C class method and have "self" act just
like "self" would act in the class method itself (i.e.,
[self classMethod] works without casting the return
type if debug info is present). To accomplish this,
the expression masquerades as a class method added by
a category.

- Objective-C objects can now provide methods and
properties and methods to Clang on demand (i.e., the
ASTImporter sets hasExternalVisibleDecls on Objective-C
interface objects).

- Objective-C built-in types, which had long been a bone
of contention (should we be using "id"? "id*"?), are
now fetched correctly using accessor functions on
ClangASTContext. We inhibit searches for them in the
debug information.

There are also a variety of logging fixes, and I made two
changes to the test suite:

- Enabled a test case for Objective-C properties in the
current translation unit.

- Added a test case for calling Objective-C class methods
when stopped in a class method.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144607 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
9b7148450908952cdf93de06fa69220d9fb7fba6 09-Nov-2011 Sean Callanan <scallanan@apple.com> Added a function to ClangASTSource to service
lookups for Objective-C methods by selector.
Right now all it does is print log information.

Also improved the logging for imported TagDecls
to indicate whether or not the definition for
the imported TagDecl is complete.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
59efe90c97b857c8c571723315224a7833e64f13 05-Nov-2011 Sean Callanan <scallanan@apple.com> Wrapped some logging statements in conditionals, to prevent
crashes.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@143756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
7537dce6163b914357d14b8526e204e88345832f 04-Nov-2011 Sean Callanan <scallanan@apple.com> Updated LLVM/Clang to pick up a fix for imports of
C++ vtables, fixing a record layout problem in the
expression parser.

Also fixed various problems with the generation
and unpacking of llvm.zip given our new better
handling of multiple architectures in the LLVM
build.

(And added a log message that will hopefully catch
record layout problems in the future.)


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@143741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
3dd49fd9908b22464c38f3e6c9338f61cddcc1f7 28-Oct-2011 Sean Callanan <scallanan@apple.com> Added a bunch of logging to CompleteType for TagDecls
and ObjCInterfaceDecls.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@143181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
9b1c1780432e24785615a8066e021e1eb3ecf36d 22-Oct-2011 Greg Clayton <gclayton@apple.com> Fixed a missing quote.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
a7cb1fa9d7d9c71fc2a5d9946cbec8e928baa5b9 22-Oct-2011 Sean Callanan <scallanan@apple.com> Implemented an extension to the namespace map that
permits a namespace map to be created and populated
when the namespace is imported, not just when it is
requested via FindExternalVisibleDecls().


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@142690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
67bbb1103c5a49b7c994750e90ae7ed130daa3ae 14-Oct-2011 Sean Callanan <scallanan@apple.com> Improved expression logging. Now all calls to
FindExternalVisibleDecls and FindExternalLexicalDecls
are marked and given unique IDs, so that all logging
done as part of their execution can be traced back to
the proper call.

Also there was some logging that really wasn't helpful
in most cases so I disabled it unless verbose logging
(log enable -v lldb expr) is enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
16b53ab189392cb30056ce1bbc24202cb935bf15 12-Oct-2011 Sean Callanan <scallanan@apple.com> Implemented a namespace map that allows searching
of namespaces (only in the modules where they've
been found) for entities inside those namespaces.

For each NamespaceDecl that has been imported into
the parser, we maintain a map containing
[ModuleSP, ClangNamespaceDecl] pairs in the ASTImporter.
This map has one entry for each module in which the
namespace has been found. When we later scan for an
entity inside a namespace, we search only the modules
in which that namespace was found.

Also made a small whitespace fix in
ClangExpressionParser.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141748 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
47dc457387b690c5e4df1c0c7dd8c4337b92e630 15-Sep-2011 Sean Callanan <scallanan@apple.com> This patch modifies the expression parser to allow it
to execute expressions even in the absence of a process.
This allows expressions to run in situations where the
target cannot run -- e.g., to perform calculations based
on type information, or to inspect a binary's static
data.

This modification touches the following files:

lldb-private-enumerations.h
Introduce a new enum specifying the policy for
processing an expression. Some expressions should
always be JITted, for example if they are functions
that will be used over and over again. Some
expressions should always be interpreted, for
example if the target is unsafe to run. For most,
it is acceptable to JIT them, but interpretation
is preferable when possible.

Target.[h,cpp]
Have EvaluateExpression now accept the new enum.

ClangExpressionDeclMap.[cpp,h]
Add support for the IR interpreter and also make
the ClangExpressionDeclMap more robust in the
absence of a process.

ClangFunction.[cpp,h]
Add support for the new enum.

IRInterpreter.[cpp,h]
New implementation.

ClangUserExpression.[cpp,h]
Add support for the new enum, and for running
expressions in the absence of a process.

ClangExpression.h
Remove references to the old DWARF-based method
of evaluating expressions, because it has been
superseded for now.

ClangUtilityFunction.[cpp,h]
Add support for the new enum.

ClangExpressionParser.[cpp,h]
Add support for the new enum, remove references
to DWARF, and add support for checking whether
the expression could be evaluated statically.

IRForTarget.[h,cpp]
Add support for the new enum, and add utility
functions to support the interpreter.

IRToDWARF.cpp
Removed

CommandObjectExpression.cpp
Remove references to the obsolete -i option.

Process.cpp
Modify calls to ClangUserExpression::Evaluate
to pass the correct enum (for dlopen/dlclose)

SBValue.cpp
Add support for the new enum.

SBFrame.cpp
Add support for he new enum.

BreakpointOptions.cpp
Add support for the new enum.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
153ccd72f52a6cc3595d7614558e2954f67833eb 10-Aug-2011 Greg Clayton <gclayton@apple.com> While tracking down memory consumption issue a few things were needed: the
ability to dump more information about modules in "target modules list". We
can now dump the shared pointer reference count for modules, the pointer to
the module itself (in case performance tools can help track down who has
references to said pointer), and the modification time.

Added "target delete [target-idx ...]" to be able to delete targets when they
are no longer needed. This will help track down memory usage issues and help
to resolve when module ref counts keep getting incremented. If the command gets
no arguments, the currently selected target will be deleted. If any arguments
are given, they must all be valid target indexes (use the "target list"
command to get the current target indexes).

Took care of a bunch of "no newline at end of file" warnings.

TimeValue objects can now dump their time to a lldb_private::Stream object.

Modified the "target modules list --global" command to not error out if there
are no targets since it doesn't require a target.

Fixed an issue in the MacOSX DYLD dynamic loader plug-in where if a shared
library was updated on disk, we would keep using the older one, even if it was
updated.

Don't allow the ModuleList::GetSharedModule(...) to return an empty module.
Previously we could specify a valid path on disc to a module, and specify an
architecture that wasn't contained in that module and get a shared pointer to
a module that wouldn't be able to return an object file or a symbol file. We
now make sure an object file can be extracted prior to adding the shared pointer
to the module to get added to the shared list.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
9b6898f3ec1dedbe1dfc8bd7cd1d82a5b10e1bb0 30-Jul-2011 Sean Callanan <scallanan@apple.com> This change brings in the latest LLVM/Clang, and
completes the support in the LLDB expression parser
for incomplete types. Clang now imports types
lazily, and we complete those types as necessary.

Changes include:

- ClangASTSource now supports three APIs which it
passes to ClangExpressionDeclMap. CompleteType
completes a TagDecl or an ObjCInterfaceDecl when
needed; FindExternalVisibleDecls finds named
entities that are visible in the expression's
scope; and FindExternalLexicalDecls performs a
(potentially restricted) search for entities
inside a lexical scope like a namespace. These
changes mean that entities in namespaces should
work normally.

- The SymbolFileDWARF code for searching a context
for a specific name is now more general, and can
search arbitrary contexts.

- We are continuing to adapt our calls into LLVM
from interfaces that take start and end iterators
when accepting multiple items to interfaces that
use ArrayRef.

- I have cleaned up some code, especially our use
of namespaces.

This change is neutral for our testsuite and greatly
improves correctness for large programs (like Clang)
with complicated type systems. It should also lay
the groundwork for improving the expression parser's
performance as we are lazier and lazier about
providing type information.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@136555 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
75a40125586d483b2d7722f1b5475cb0f7ef9bf8 06-Jul-2011 Greg Clayton <gclayton@apple.com> Fixed an issue that was causing us to crash when evaluating expressions for
objective C or C++ methods when "self" or "this" were in scope, but had
invalid locations in a DWARF location list. The lack of a valid value caused
us to use an invalid type value and then we tried to import that invalid
value and we would crash.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134518 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp
e6d72ca9a6b22cd062136bbff039c3d8217f798a 25-Jun-2011 Greg Clayton <gclayton@apple.com> This commit adds broad architectural support for hierarchical
inspection of namespaces in the expression parser.

ClangExpressionDeclMap hitherto reported that namespaces had
been completely imported, even though the namespaces are
returned empty. To deal with this situation, ClangASTSource
was recently extended with an API to complete incomplete type
definitions, and, for greater efficiency, to complete these
definitions partially, returning only those objects that have
a given name.

This commit supports these APIs on LLDB's side, and uses it
to provide information on types resident in namespaces.
Namespaces are now imported as they were -- that is to say,
empty -- but with minimal import mode on. This means that
Clang will come back and request their contents by name as
needed. We now respond with information on the contained
types; this will be followed soon by information on functions
and variables.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Symbol/ClangASTImporter.cpp