History log of /external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
f77aef8c7225d32e2625e981b144603e753fc640 29-Jun-2013 Jim Ingham <jingham@apple.com> Missed a place where we have to pass the source location twice to FunctionDecl::Create.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
2f3daef19e4653c075ffcf16a2eb2e64d0380001 28-Jun-2013 Greg Clayton <gclayton@apple.com> Default parameters are evil and should not be used. Case and point this checkin that fixes implicit conversions that were happening.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185217 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
794296a6f5fb971d9c262858e6e04df01c25600e 26-Jun-2013 Sean Callanan <scallanan@apple.com> Fixed a bug in ClangASTSource where we would return
the target of a typedef when asked for a typedef.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
3e11c7ec050648ba865f1d451f8cb46fd39072a8 19-Jun-2013 Andy Gibbs <andyg1001@hotmail.co.uk> Sort out a number of mismatched integer types in order to cut down the number of compiler warnings.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184333 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
56a41dee3d21c18e12bed8f7bbec4e2b7ea4ecde 09-May-2013 Sean Callanan <scallanan@apple.com> Add all Decls found through FindExternalLexicalDecls
to the DeclContext. This fulfils the contract that
we make with Clang by returning ELR_AlreadyLoaded.

This is a little aggressive in that it does not allow
the ASTImporter to import the child decls with any
lexical parent other than the Decl that reported them
as children.

<rdar://problem/13517713>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181498 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
f03676887c98a55327f8eb80e47ac6835cc114cc 25-Apr-2013 Sean Callanan <scallanan@apple.com> Fixed a crash in ClangASTSource when logging is
disabled.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
79e7ad84e2b31baf22e05ab24aaa11b5e0f566a5 24-Apr-2013 Sean Callanan <scallanan@apple.com> Fixed a problem where the expression parser would
not find multiple functions with the same name but
different types. Now we keep track of what types
we've already reported for a function and only elide
functions if we've already reported a conflicting
one.

Also added a test case.

<rdar://problem/11367837>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
edb83a59994efc8fe9f942f976dc355b74178f5a 03-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix build.
This should fix the build breakage caused by the api change in 178663.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178700 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
9fe380e54da81d04a7a246f853491846357ec401 25-Mar-2013 Sean Callanan <scallanan@apple.com> Fixed a potential crash if layout for a structure
went wrong and we tried to get layout information
that wasn't there.

<rdar://problem/13490170>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177880 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
ae31fae5a3b818aaf6639f8ddcd07bb2fbd7d0dd 14-Mar-2013 Sean Callanan <scallanan@apple.com> Fixed a problem where we didn't return TypedefNameDecls
when clang asked for them by name.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
38de544ec4e60b474b9c484516825d33194a5ad4 10-Mar-2013 Sylvestre Ledru <sylvestre@debian.org> Match the new declaration of clang::ASTContext::getFunctionType introduced in clang r176726. Fix the build of lldb

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176790 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
79e9f965938ec5766b9caedfa85262ecb603c453 12-Feb-2013 Sean Callanan <scallanan@apple.com> Made LLDB build with the latest Clang. This meant
changing the ClangASTSource to return a bool instead
of returning a list of results. Our testsuite mostly
works with this change, but some minor issues may
remain both on LLDB's side and on Clang's side.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@174949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
36da2aa6dc5ad9994b638ed09eb81c44cc05540b 25-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13069948>

Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary.

So I defined a new "lldb::offset_t" which should be used for all file offsets.

After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed.

Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
ca8fb173fa66d9c93e02c4abfd4627c143795653 21-Dec-2012 Sean Callanan <scallanan@apple.com> Made LLDB compile with LLVM top-of-tree again.
The results from Clang name lookups changed to
be ArrayRefs, so I had to change the way we
check for the presence of a result and the way
we iterate across results.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170927 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
282c22c6a6b6e54324b0d474b90d918bbfd3a10e 20-Dec-2012 Sean Callanan <scallanan@apple.com> This patch removes the SymbolFileSymtab support
for reporting class types from Objective-C runtime
class symbols. Instead, LLDB now queries the
Objective-C runtime for class types.

We have also added a (minimal) Objective-C runtime
type vendor for Objective-C runtime version 1, to
prevent regressions when calling class methods in
the V1 runtime.

Other components of this fix include:

- We search the Objective-C runtime in a few more
places.

- We enable enumeration of all members of
Objective-C classes, which Clang does in certain
circumstances.

- SBTarget::FindFirstType and SBTarget::FindTypes
now query the Objective-C runtime as needed.

- I fixed several test cases.

<rdar://problem/12885034>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170601 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
14571fcb14392ee632195fdb8d978a67f1a7b180 28-Nov-2012 Sean Callanan <scallanan@apple.com> If Clang is looking for an Objective-C method on
a type, and we find it in the origin for that
type, don't look anywhere else; just report it.

<rdar://problem/12675970>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@168766 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
146d9522c95c0c8c5409539813b55e08b99196ee 08-Nov-2012 Enrico Granata <egranata@apple.com> <rdar://problem/12586350>

This commit does three things:
(a) introduces a new notification model for adding/removing/changing modules to a ModuleList, and applies it to the Target's ModuleList, so that we make sure to always trigger the right set of actions
whenever modules come and go in a target. Certain spots in the code still need to "manually" notify the Target for several reasons, so this is a work in progress
(b) adds a new capability to the Platforms: locating a scripting resources associated to a module. A scripting resource is a Python file that can load commands, formatters, ... and any other action
of interest corresponding to the loading of a module. At the moment, this is only implemented on Mac OS X and only for files inside .dSYM bundles - the next step is going to be letting
the frameworks themselves hold their scripting resources. Implementors of platforms for other systems are free to implement "the right thing" for their own worlds
(c) hooking up items (a) and (b) so that targets auto-load the scripting resources as the corresponding modules get loaded in a target. This has a few caveats at the moment:
- the user needs to manually add the .py file to the dSYM (soon, it will also work in the framework itself)
- if two modules with the same name show up during the lifetime of an LLDB session, the second one won't be able to load its scripting resource, but will otherwise work just fine



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167569 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
4cbeeff4bde3e0704de961f04fab7c9acb5ffe9a 02-Nov-2012 Sean Callanan <scallanan@apple.com> Extra safeguards to ensure that we never query
the runtime if we have complete debug information
for a class.

Also made the Objective-C language runtime return
NULL when asked for the complete debug information
(i.e., information from DWARF, not information from
the runtime) if that information isn't present. It
used to return a non-authoritative version, which
made it hard for clients to determine whether
complete debug information was available.

<rdar://problem/12608895>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@167299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
c718b9652bb1a7aea5d133123fcc8bc87277002c 11-Sep-2012 Sean Callanan <scallanan@apple.com> This patch is part of ongoing work to extract type
information from the Objective-C runtime.

This patch takes the old AppleObjCSymbolVendor and
replaces it with an AppleObjCTypeVendor, which is
much more lightweight. Specifically, the SymbolVendor
needs to pretend that there is a backing symbol file
for the Types it vends, whereas a TypeVendor only
vends bare ClangASTTypes. These ClangASTTypes only
need to exist in an ASTContext.

The ClangASTSource now falls back to the runtime's
TypeVendor (if one exists) if the debug information
doesn't find a complete type for a particular
Objective-C interface. The runtime's TypeVendor
maintains an ASTContext full of types it knows about,
and re-uses the ISA-based type query information used
by the ValueObjects.

Currently, the runtime's TypeVendor doesn't provide
useful answers because we haven't yet implemented a
way to iterate across all ISAs contained in the target
process's runtime. That's the next step.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
49ce8969d3154e1560106cfe530444c09410f217 29-Aug-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11757916>

Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file".
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()

Cleaned up header includes a bit as well.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@162860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
9336790a758b8f8b87d95e6658bb8fdb34766c2f 30-May-2012 Jim Ingham <jingham@apple.com> We were accessing the ModuleList in the target without locking it for tasks like
setting breakpoints. That's dangerous, since while we are setting a breakpoint,
the target might hit the dyld load notification, and start removing modules from
the list. This change adds a GetMutex accessor to the ModuleList class, and
uses it whenever we are accessing the target's ModuleList (as returned by GetImages().)

<rdar://problem/11552372>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
0ffff1e2536f27bf74a2969e9e5bae4c739f1815 25-Apr-2012 Sean Callanan <scallanan@apple.com> Hardened LLDB against NULL identifiers being passed
into FindExternalVisibleDeclsByName.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
33bff9a5862eed4c50ab3ead7b63f36173e6823d 07-Apr-2012 Sean Callanan <scallanan@apple.com> Hardened the struct layout code to eliminate a
potential crash if the underlying type couldn't
be completed.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
9f95fb63a492b53206d578f46e73899d60d70321 06-Apr-2012 Greg Clayton <gclayton@apple.com> In a prior commit, I changed the parameters around on a ModuleList::FindTypes where the old parameters that existing clients were using would have been compatible, so I renamed ModuleList::FindTypes to ModuleList::FindTypes2. Then I made fixes and verified I updated and fixed all client code, but I forgot to rename the function back to ModuleList::FindTypes(). I am doing that now and also cleaning up the C++ dynamic type code a bit.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154182 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
8d6115615f55ae38ff141f0a6859d59750da8d02 05-Apr-2012 Sean Callanan <scallanan@apple.com> Fixed a problem where we did not read properties
correctly if the setter/getter were not present
in the debug information. The fixes are as follows:

- We not only look for the method by its full name,
but also look for automatically-generated methods
when searching for a selector in an Objective-C
interface. This is necessary to find accessors.

- Extract the getter and setter name from the
DW_TAG_APPLE_Property declaration in the DWARF
if they are present; generate them if not.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
dc0a38c5a727cae5362b218a3180d0f4265a619d 27-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/11113279>

Fixed type lookups to "do the right thing". Prior to this fix, looking up a type using "foo::bar" would result in a type list that contains all types that had "bar" as a basename unless the symbol file was able to match fully qualified names (which our DWARF parser does not).

This fix will allow type matches to be made based on the basename and then have the types that don't match filtered out. Types by name can be fully qualified, or partially qualified with the new "bool exact_match" parameter to the Module::FindTypes() method.

This fixes some issue that we discovered with dynamic type resolution as well as improves the overall type lookups in LLDB.




git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
30a5dd5ae4ec13f07c788a488f2999e70cb75451 21-Mar-2012 Sean Callanan <scallanan@apple.com> Added some hardening to make sure that we don't
use QualType contents unchecked.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153201 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
ddb59332eeda0a7a1fb153f46dc25a1dc9a6f4a0 20-Mar-2012 Sean Callanan <scallanan@apple.com> Fixed some potential null-pointer bugs in the
expression parser code.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
e94783960b4d80520b5ce5bb65f45828d84b1d79 15-Mar-2012 Sean Callanan <scallanan@apple.com> Strengthened LLDB's completion of object types.
Now when LLDB reports a variable, it has a
complete type. Similarly, when it reports
members of a struct, it completes their types.
Also, when it creates the result variable for
an expression, it ensures that variable's type
is complete.

This ensures compliance with Clang's
expectations, preventing potential crashes.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
aa11af8ddbcc9ca1b04ec183d5cda08f4f929831 27-Feb-2012 Sean Callanan <scallanan@apple.com> Harden the checks on the type returned from the
AST importer because we're seeing occasional
crashes.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
931acecd4e3af534028936431dc0f75a9fd6eb02 23-Feb-2012 Sean Callanan <scallanan@apple.com> Added support for looking up the complete type for
Objective-C classes. This allows LLDB to find
ivars declared in class extensions in modules other
than where the debugger is currently stopped (we
already supported this when the debugger was
stopped in the same module as the definition).

This involved the following main changes:

- The ObjCLanguageRuntime now knows how to hunt
for the authoritative version of an Objective-C
type. It looks for the symbol indicating a
definition, and then gets the type from the
module containing that symbol.

- ValueObjects now report their type with a
potential override, and the override is set if
the type of the ValueObject is an Objective-C
class or pointer type that is defined somewhere
other than the original reported type. This
means that "frame variable" will always use the
complete type if one is available.

- The ClangASTSource now looks for the complete
type when looking for ivars. This means that
"expr" will always use the complete type if one
is available.

- I added a testcase that verifies that both
"frame variable" and "expr" work.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151214 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
302d78c71902398ce1f422bd09216dd53a6abb88 10-Feb-2012 Sean Callanan <scallanan@apple.com> Extended function lookup to allow the user to
indicate whether inline functions are desired.
This allows the expression parser, for instance,
to filter out inlined functions when looking for
functions it can call.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
97b675ecde7a3b7ebb4161fbecb122fb22c2b6ea 06-Feb-2012 Sean Callanan <scallanan@apple.com> I left some stray debugging messages in the source
code. Removing these.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
13d24fb1817faa7ccc4cfd799113ba1a2b8968eb 29-Jan-2012 Greg Clayton <gclayton@apple.com> Switching back to using std::tr1::shared_ptr. We originally switched away
due to RTTI worries since llvm and clang don't use RTTI, but I was able to
switch back with no issues as far as I can tell. Once the RTTI issue wasn't
an issue, we were looking for a way to properly track weak pointers to objects
to solve some of the threading issues we have been running into which naturally
led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared
pointer from just a pointer, which is also easily solved using the
std::tr1::enable_shared_from_this class.

The main reason for this move back is so we can start properly having weak
references to objects. Currently a lldb_private::Thread class has a refrence
to its parent lldb_private::Process. This doesn't work well when we now hand
out a SBThread object that contains a shared pointer to a lldb_private::Thread
as this SBThread can be held onto by external clients and if they end up
using one of these objects we can easily crash.

So the next task is to start adopting std::tr1::weak_ptr where ever it makes
sense which we can do with lldb_private::Debugger, lldb_private::Target,
lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and
many more objects now that they are no longer using intrusive ref counted
pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive
pointers).



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@149207 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
6e22e8b1b2c30042124a5c08ead5ad07bbabdafe 13-Jan-2012 Sean Callanan <scallanan@apple.com> Fixed some logging in the AST source and added
more information.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@148144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
0f71d1902c501e2ccd67257e2288cad57d127882 19-Dec-2011 Sean Callanan <scallanan@apple.com> Added some strength to the checks that prevent
"id" from being found by the parser as an
externally-defined type. Before, "id" would
sometimes make it through if it was defined in
a namespace, but this sometimes caused
confusion, for example when it conflicted with
std::locale::id.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146891 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
21f2e192079b6aa9ddd2d25283e19abdb38eeeb5 14-Dec-2011 Sean Callanan <scallanan@apple.com> This commit is the result of a general audit of
the expression parser to locate instances where
dyn_cast<>() and isa<>() are used on types, and
replace them with getAs<>() as appropriate.

The difference is that dyn_cast<>() and isa<>()
are essentially LLVM/Clang's equivalent of RTTI
-- that is, they try to downcast the object and
return NULL if they cannot -- but getAs<>() can
traverse typedefs to perform a semantic cast.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
2e87f6aeb3acc87f35161f63be22175e6e53b968 08-Dec-2011 Greg Clayton <gclayton@apple.com> Don't crash due to not checking log shared pointer.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
3d8540ad71a01719417eb37a10e7453374716382 07-Dec-2011 Sean Callanan <scallanan@apple.com> Fixed a few details of method lookup in Objective-C
symbols. Now we find the correct method.

Unfortunately we don't get the superclass from the
runtime yet so the method doesn't import correctly
(and I added a check to make sure that doesn't hurt
us) but once we get that information right we will
report methods correctly to the parser as well.

Getting superclass information requires a common AST
context for all Objective-C runtime information,
meaning that the superclass and the subclass are in
the same AST context in all cases. That is the next
thing that needs to be done here.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
dc5fce1270790d57d7ed4a2354980fbc03fdfd5c 01-Dec-2011 Sean Callanan <scallanan@apple.com> Modified clients of ClangASTImporter to be more robust
in the face of failures to import types, since blithely
passing on NULL types can sometimes lead to trouble.

Also eliminated a use of getAs and replaced it with
dyn_cast, which is more robust.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
fa21ffd0c50efce27bfa084c6fb33dff255288b0 01-Dec-2011 Johnny Chen <johnny.chen@apple.com> rdar://problem/10501020

ClangASTSource::~ClangASTSource() was calling

ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext();

which had the side effect of deleting this very ClangASTSource instance. Not good.
Change it to

// We are in the process of destruction, don't create clang ast context on demand
// by passing false to Target::GetScratchClangASTContext(create_on_demand).
ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext(false);

The Target::GetScratchClangASTContext(bool create_on_demand=true) has a new signature.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
673f3dbea64b116166dfa668006cdc84224a27c0 30-Nov-2011 Sean Callanan <scallanan@apple.com> Added support to the Objective-C language runtime
to find Objective-C class types by looking in the
symbol tables for the individual object files.

I did this as follows:

- I added code to SymbolFileSymtab that vends
Clang types for symbols matching the pattern
"_OBJC_CLASS_$_NSMyClassName," making them
appear as Objective-C classes. This only occurs
in modules that do not have debug information,
since otherwise SymbolFileDWARF would be in
charge of looking up types.

- I made a new SymbolVendor subclass for the
Apple Objective-C runtime that is in charge of
making global lookups of Objective-C types. It
currently just sends out type lookup requests to
the appropriate SymbolFiles, but in the future we
will probably extend it to query the runtime more
completely.

I also modified a testcase whose behavior is changed
by the fact that we now actually return an Objective-C
type for __NSCFString.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.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/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
d3812fa3fd7225240dea9234a40ff8aa85d459cb 15-Nov-2011 Sean Callanan <scallanan@apple.com> Eliminated a compile warning by removing dyn_cast
where isa is good enough.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
1d9ffe282bce20e8ef8a355b4a33554dc305b852 14-Nov-2011 Sean Callanan <scallanan@apple.com> Fixed Objective-C method lookup for methods with
a single argument. We assumed that the : was
omitted from the selector name, but actually Clang
adds the : in the one-argument case.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144544 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
f2a0a5c6c0ccf8c75a3409024d088646ed211726 11-Nov-2011 Sean Callanan <scallanan@apple.com> Updated LLVM/Clang to pull in a fix for Objective-C
interfaces. This allows us to pull in Objective-C
method types on demand, which is also now implemented.

Also added a minor fix to prevent multiple-definition
errors for "Class" and "id".


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144405 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
9394b5aaa5aafcf95d21d27371fa0a6548790a57 29-Oct-2011 Sean Callanan <scallanan@apple.com> Cloned FindExternalVisibleDecls from
ClangExpressionDeclMap to ClangASTSource, and
moved all general type and namespace lookups
into ClangASTSource. Now ClangASTSource is ready
to complete types given nothing more than a target
and an AST context.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@143292 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
bb715f9c0a70d9e8763772d673ce0620cfbc2d34 29-Oct-2011 Sean Callanan <scallanan@apple.com> Moved FindExternalLexicalDecls and a few smaller
functions from ClangExpressionDeclMap to ClangASTSource.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@143276 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
73b520f4f60dca58e58e446c9504d45384ee677b 29-Oct-2011 Sean Callanan <scallanan@apple.com> I moved the responsibility for interacting with the
AST importer on completing namespace mappings from
ClangExpressionDeclMap to ClangASTSource.

ClangASTSource now contains a TargetSP which it
uses to lookup namespaces in all of a target's
modules. I will use the TargetSP in the future to
look up globals.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@143275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
f76afff22617c3f632af58ffebe1f037ba935717 29-Oct-2011 Sean Callanan <scallanan@apple.com> As part of a general refactoring of ClangASTSource to
allow it to complete types on behalf of any AST context
(including the "scratch" AST context associated with
the target), I scrapped its role as intermediary between
the Clang parser and ClangExpressionDeclMap, and instead
made ClangExpressionDeclMap inherit from ClangASTSource.

After this, I will migrate the functions that complete
types and perform namespace lookups from
ClangExpressionDeclMap to ClangASTSource. Ultimately
ClangExpressionDeclMap's only responsiblity will be to
look up variables and ensure that they are materialized
and dematerialized correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@143253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
c1535187de67e4ce48053a7677c76825adcdda44 08-Oct-2011 Sean Callanan <scallanan@apple.com> Updated LLVM/Clang to pull in the latest ARM disassembler.
This involved minor changes to the way we report Objective-C
methods, as well as cosmetic changes and added parameters
for a variety of Clang APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
6e0101c86555a06b3bd4cb6104b35abfae0b0057 17-Sep-2011 Greg Clayton <gclayton@apple.com> Convert lldb::ModuleSP to use an instrusive ref counted pointer.
We had some cases where getting the shared pointer for a module from
the global module list was causing a performance issue when debugging
with DWARF in .o files. Now that the module uses intrusive ref counts,
we can easily convert any pointer to a shared pointer.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139983 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.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/Expression/ClangASTSource.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/Expression/ClangASTSource.cpp
fb3058efeaacc2ced967e46842dfc4875b3daf14 13-May-2011 Sean Callanan <scallanan@apple.com> Introduced support for UnknownAnyTy, the Clang type
representing variables whose type must be inferred
from the way they are used. Functions without debug
information now return UnknownAnyTy and must be cast.

Variables with no debug information are not yet using
UnknownAnyTy; instead they are assumed to be void*.
Support for variables of unknown type is coming (and,
in fact, some relevant support functions are included
in this commit) but will take a bit of extra effort.

The testsuite has also been updated to reflect the new
requirement that the result of printf be cast, i.e.

expr (int) printf("Hello world!")


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@131263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
279584cdea3dfda933480ed0fe948df2697ab512 15-Mar-2011 Sean Callanan <scallanan@apple.com> Updated to LLVM/Clang revision 127600.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
d5b3c351ea23e8e36d47056e50b1df773ae9050a 27-Jan-2011 Sean Callanan <scallanan@apple.com> Updated Clang to a version that supports propagating
the "virtual" flag when importing a C++ function
declaration. Made changes to LLDB to support other
changes in Clang.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
a1aaaff189cb2db4a231ce0326ea779e6e702821 23-Jan-2011 Greg Clayton <gclayton@apple.com> Watch out for NULL types in NameSearchContext::AddTypeDecl or we crash.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
ad29309ac7a29db2cc363bd4ace20fbf862a42d3 19-Jan-2011 Sean Callanan <scallanan@apple.com> Updated to revision 123723 of LLVM, to bring in
support for minimal type import functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
b01000fd063629facd45044f137446fb748ee179 17-Jan-2011 Greg Clayton <gclayton@apple.com> A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.

A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:

class ExternalASTSource {
....

virtual void
CompleteType (clang::TagDecl *Tag);

virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};

This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.

This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).

We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
3aa7da5cb3327792415de44405e0896c6bdc305b 13-Dec-2010 Sean Callanan <scallanan@apple.com> Added support for generating expressions that have
access to the members of the Objective-C self object.

The approach we take is to generate the method as a
@category on top of the self object, and to pass the
"self" pointer to it. (_cmd is currently NULL.)

Most changes are in ClangExpressionDeclMap, but the
change that adds support to the ABIs to pass _cmd
touches a fair amount of code.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@121722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
aa301c49e8b31f01c551cffbaa74c8ba82851a79 03-Dec-2010 Sean Callanan <scallanan@apple.com> Fixed object lifetimes in ClangExpressionDeclMap
so that it is not referring to potentially stale
state during IR execution.

This was done by introducing modular state (like
ClangExpressionVariable) where groups of state
variables have well-defined lifetimes:

- m_parser_vars are specific to parsing, and only
exist between calls to WillParse() and DidParse().

- m_struct_vars survive for the entire execution
of the ClangExpressionDeclMap because they
provide the template for a materialized set of
expression variables.

- m_material_vars are specific to a single
instance of materialization, and only exist
between calls to Materialize() and
Dematerialize().

I also removed unnecessary references to long-
lived state that really didn't need to be referred
to at all, and also introduced several assert()s
that helped me diagnose a few bugs (fixed too).


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120778 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
1ddd9fe72bd9e22f40ad28f25b3a139a9326ae98 30-Nov-2010 Sean Callanan <scallanan@apple.com> Added a feature where registers can be referred to
using special $-variables from expressions.

(lldb) expr $rip

These variables are available for reading and
writing.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
8a3b0a85dd512824f528cfa55d93f530ebe38be8 18-Nov-2010 Sean Callanan <scallanan@apple.com> Updated to the LLVM/Clang of 2010-11-17 at 3:30pm.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
a8b278aeeace358bb9f3aaa40947a2c887604008 15-Nov-2010 Greg Clayton <gclayton@apple.com> Added recursive name lookup logging with depth which is commented out and is currently only enabled when we blow the stack.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119101 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
9ceed1e2b872d12a1c01ba148855db07b193649e 13-Nov-2010 Greg Clayton <gclayton@apple.com> Got namespace lookup working and was able to print a complex "this" as an
expression. This currently takes waaaayyyyy too much time to evaluate. We will
need to look at the expression parser and find ways to optimize the info we
provide and get this to evaluate quicker. I believe the performance issue is
currently related to us always providing a complete C++ class type when asked
about a C++ class which can cause a lot of information to be pulled since all
classes will be fully created (methods, base classes, members, all their
types). We will need to give the classes back the parser and mark them as
having external sources and get parser (Sema) to query us when it needs more
info. This should bring things up to an acceptable level.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118979 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
8950c9a1faa1eb762d92ccdc860dc2eaa88a6868 29-Oct-2010 Sean Callanan <scallanan@apple.com> Updated LLVM to latest version as of 10/28 at
7pm, and made minor integration fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
8de27c761a22187ef63fb60000894be163e7285f 16-Oct-2010 Greg Clayton <gclayton@apple.com> Made many ConstString functions inlined in the header file.

Changed all of our synthesized "___clang" functions, types and variables
that get used in expressions over to have a prefix of "$_lldb". Now when we
do name lookups we can easily switch off of the first '$' character to know
if we should look through only our internal (when first char is '$') stuff,
or when we should look through program variables, functions and types.

Converted all of the clang expression code over to using "const ConstString&"
values for names instead of "const char *" since there were many places that
were converting the "const char *" names into ConstString names and them
throwing them away. We now avoid making a lot of ConstString conversions and
benefit from the quick comparisons in a few extra spots.

Converted a lot of code from LLVM coding conventions into LLDB coding
conventions.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
f4c7ae03554645e37cc19b078fdda50f432a9cd5 15-Oct-2010 Greg Clayton <gclayton@apple.com> Skip checking for a bunch of built-ins when evaluating an expression.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116565 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
fb7c51c07c249bd611051c76e4ff491f1a17cf2d 13-Oct-2010 Greg Clayton <gclayton@apple.com> Fixed C++ class clang type creation and display by making sure we omit
artifical members (like the vtable pointer member that shows up in the DWARF).
We were adding this to each class which was making all member variables be off
by a pointer size.

Added a test case so we can track this with "test/forward".

Fixed the type name index in DWARF to include all the types after finding
some types were being omitted due to the DW_AT_specification having the
DW_AT_declaration attribute which was being read into the real type instances
when there were forward declarations in the DWARF, causing the type to be
omitted. We now check to make sure any DW_AT_declaration values are only
respected when parsing types if the attribute is from the current DIE.

After fixing the missing types, we ran into some issues with the expression
parser finding duplicate entries for __va_list_tag since they are built in
types and would result in a "duplicate __va_list_tag definition" error. We
are now just ignoring this name during lookup, but we will need to see if
we can get the name lookup function to not get called in these cases.

Fixed an issue that would cause an assertion where DW_TAG_subroutine_types
that had no children, would not properly make a clang function type of:
"void (*) (void)".



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116392 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
47a5c4c01066ece2d41cba56c3a065eeca12d47c 23-Sep-2010 Sean Callanan <scallanan@apple.com> Updated to latest LLVM. Major LLVM changes:

- Sema is now exported (and there was much rejoicing.)

- Storage classes are now centrally defined.

Also fixed some bugs that the new LLVM picked up.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114622 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
3c9c5eb466869ede185e879d14a47335fb43194d 21-Sep-2010 Sean Callanan <scallanan@apple.com> Removed the hacky "#define this ___clang_this" handler
for C++ classes. Replaced it with a less hacky approach:

- If an expression is defined in the context of a
method of class A, then that expression is wrapped as
___clang_class::___clang_expr(void*) { ... }
instead of ___clang_expr(void*) { ... }.

- ___clang_class is resolved as the type of the target
of the "this" pointer in the method the expression
is defined in.

- When reporting the type of ___clang_class, a method
with the signature ___clang_expr(void*) is added to
that class, so that Clang doesn't complain about a
method being defined without a corresponding
declaration.

- Whenever the expression gets called, "this" gets
looked up, type-checked, and then passed in as the
first argument.

This required the following changes:

- The ABIs were changed to support passing of the "this"
pointer as part of trivial calls.

- ThreadPlanCallFunction and ClangFunction were changed
to support passing of an optional "this" pointer.

- ClangUserExpression was extended to perform the
wrapping described above.

- ClangASTSource was changed to revert the changes
required by the hack.

- ClangExpressionParser, IRForTarget, and
ClangExpressionDeclMap were changed to handle
different manglings of ___clang_expr flexibly. This
meant no longer searching for a function called
___clang_expr, but rather looking for a function whose
name *contains* ___clang_expr.

- ClangExpressionParser and ClangExpressionDeclMap now
remember whether "this" is required, and know how to
look it up as necessary.

A few inheritance bugs remain, and I'm trying to resolve
these. But it is now possible to use "this" as well as
refer implicitly to member variables, when in the proper
context.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114384 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
cc0746247880e9c87711031ce8a535544f4499d7 14-Sep-2010 Sean Callanan <scallanan@apple.com> Added code to support use of "this" and "self" in
expressions. This involved three main changes:

- In ClangUserExpression::ClangUserExpression(),
we now insert the following lines into the
expression:
#define this ___clang_this
#define self ___clang_self

- In ClangExpressionDeclMap::GetDecls(), we
special-case ___clang_(this|self) and instead
look up "this" or "self"

- In ClangASTSource, we introduce the capability
to generate Decls with a different, overridden,
name from the one that was requested, e.g.
this for ___clang_this.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
b291abe0be41fd503e1b25d20a95c65130f8db4c 13-Aug-2010 Sean Callanan <scallanan@apple.com> Added documentation to ClangASTSource and
NameSearchContext.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110980 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
93a4b1a8d6ad9a5d1e18a38b5ec55de5b7f6e724 04-Aug-2010 Sean Callanan <scallanan@apple.com> Added support for accessing members of C++ objects,
including superclass members. This involved ensuring
that access control was ignored, and ensuring that
the operands of BitCasts were properly scanned for
variables that needed importing.

Also laid the groundwork for declaring objects of
custom types; however, this functionality is disabled
for now because of a potential loop in ASTImporter.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
0fc7358d61218ba5d5abb5c2ea489a9ef936bbf7 27-Jul-2010 Sean Callanan <scallanan@apple.com> Changed SymbolContext so when you search for functions
it returns a list of functions as a SymbolContextList.

Rewrote the clients of SymbolContext to use this
SymbolContextList.

Rewrote some of the providers of the data to SymbolContext
to make them respect preferences as to whether the list
should be cleared first; propagated that change out.

ClangExpressionDeclMap and ClangASTSource use this new
function list to properly generate function definitions -
even for functions that don't have a prototype in the
debug information.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
1e591ce17f01f672ac9512a604c1010c3361d768 16-Jul-2010 Greg Clayton <gclayton@apple.com> Fixed a copyright header.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108544 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
3c821cc8a7704df107cf87c8ef885ea1b706f353 23-Jun-2010 Sean Callanan <scallanan@apple.com> Fixes for array handling and dynamic type casting
errors pointed out by John McCall.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
8f0dc34f45576dfb719f879b6d3ea5f61de0e918 23-Jun-2010 Sean Callanan <scallanan@apple.com> Added support to the expression parser for locating
externally-defined functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
e49f79dd0afe39829873fa2dcede8ef68b2485f0 12-Jun-2010 Greg Clayton <gclayton@apple.com> Switched over to using the new lldb::SharingPtr from Howard Hinnant.
We need to put this in LLDB since we need to vend this in our API
because our public API uses shared pointers to our private objects.

Removed a deprecated file: include/lldb/Host/Types.h

Added the new SharingPtr.cpp/.h files into source/Utility.

Added a shell script build phase that fixes up all headers in the
LLDB.framework.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105895 91177308-0d34-0410-b5e6-96231b3b80d8
/external/lldb/source/Expression/ClangASTSource.cpp
24943d2ee8bfaa7cf5893e4709143924157a5c1e 08-Jun-2010 Chris Lattner <sabre@nondot.org> Initial checkin of lldb code from internal Apple repo.


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