Commit Graph

156 Commits

Author SHA1 Message Date
Douglas Gregor 2b88c115f9 Provide proper type-source location information for
CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and
CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the
process.

llvm-svn: 113319
2010-09-08 00:15:04 +00:00
Douglas Gregor 0744ef6371 Improve source-location information for CXXNewExpr, by hanging on to
the TypeSourceInfo for the allocated type. Fixes PR7501.

llvm-svn: 113291
2010-09-07 21:49:58 +00:00
Douglas Gregor 09c0eb1510 Synchronize code-completion cursor kinds with indexing cursor
kinds. How shameful that this code was duplicated!

llvm-svn: 113033
2010-09-03 23:30:36 +00:00
Douglas Gregor 901a0fabfc Implement libclang visitation for UnresolvedMemberExpr. This is the
last of the C++-specific expressions where we have decent source
information in the AST already. In particular, various
object-construction expressions (CXXNewExpr, CXXTemporaryObjectExpr)
still have poor source-location information that needs to be addressed.

llvm-svn: 112981
2010-09-03 18:01:25 +00:00
Douglas Gregor 4583827e13 libclang visitation for CXXDependentScopeMemberExpr
llvm-svn: 112978
2010-09-03 17:35:34 +00:00
Douglas Gregor 4ae34afaf9 libclang visitation for DependentScopeDeclRefExpr
llvm-svn: 112975
2010-09-03 17:24:10 +00:00
Douglas Gregor f24eaee2b3 Teach libclang to visit OverloadExprs, so that we can reuse this
code. Also, teach it about explicitly-specified template arguments.

llvm-svn: 112884
2010-09-02 22:29:21 +00:00
Douglas Gregor 3ca46b4275 Add libclang visitation for UnresolvedLookupExprs
llvm-svn: 112879
2010-09-02 22:19:24 +00:00
Douglas Gregor 4edb2ff89f Add libclang visitation for C++ pseudo-destructor expressions.
llvm-svn: 112873
2010-09-02 22:09:03 +00:00
Douglas Gregor 6429f5cf29 Eliminate CXXBindReferenceExpr, which was used in a ton of
well-intentioned but completely unused code.

llvm-svn: 112868
2010-09-02 21:50:02 +00:00
Douglas Gregor fd81cea70c Teach libclang not to recursive into default argument expressions
llvm-svn: 112866
2010-09-02 21:38:13 +00:00
Douglas Gregor 46af501065 Add libclang visitation for C++ typeid expressions.
llvm-svn: 112862
2010-09-02 21:20:16 +00:00
Douglas Gregor 32e4c861c8 In libclang, visit the nested-name-specifier and explicitly-specified template arguments of a MemberExpr.
llvm-svn: 112860
2010-09-02 21:07:44 +00:00
Douglas Gregor aac7c8106a Visit the nested-name-specifier and explicitly-specified template
arguments of a DeclRefExpr.

llvm-svn: 112854
2010-09-02 20:35:02 +00:00
Douglas Gregor 3335f48448 Implement basic visitation for nested name specifiers via libclang
cursors. Sadly, this visitation is a hack, because we don't have
proper source-location information for nested-name-specifiers in the
AST. It does improve on the status quo, however.

llvm-svn: 112837
2010-09-02 17:35:32 +00:00
Douglas Gregor d3f48bd3be Introduce a new libclang function,
clang_getSpecializedCursorTemplate(), which determines the template
(or member thereof) that the given cursor specializes or from which it
was instantiated. This routine can be used to establish a link between
templates and their instantiations/specializations.

llvm-svn: 112780
2010-09-02 00:07:54 +00:00
Douglas Gregor 06c7d2df9b Teach libclang to visit the default arguments of template parameters.
llvm-svn: 112734
2010-09-01 20:16:53 +00:00
Douglas Gregor a9aa29cf0b Implement libclang support for using declarations. Clang actually uses
three different kinds of AST nodes to represent using declarations:
UsingDecl, UnresolvedUsingValueDecl, and
UnresolvedUsingTypenameDecl. These three are collapsed into a single
cursor kind for using declarations, since libclang clients don't need
the distinction.

Several related changes here:
  - Cursor visitation of the three AST nodes for using declarations
  - Proper source-range computation for these AST nodes
  - Using declarations have no USRs, since they don't actually declare
    any entities.

llvm-svn: 112730
2010-09-01 19:52:22 +00:00
Douglas Gregor 9dc243c3eb Improve libclang indexing support for class template specializations
in a few related ways:

  - Don't recurse into instantiations of templates.
  - Recurse into explicit specializations.
  - Visit the template arguments of an explicit specialization or
    explicit instantiation.
  - Include template specialization arguments in the USRs for class
    template specializations.

llvm-svn: 112720
2010-09-01 17:32:36 +00:00
Douglas Gregor 57879faf91 Make it clear that libclang does not modify the command-line arguments
it is given.

llvm-svn: 112717
2010-09-01 16:43:19 +00:00
Douglas Gregor 01a430134f Implement libclang support for using directives (cursor + visitation +
suppressing USRs). Also, fix up the source location information for
using directives so that the declaration location refers to the
namespace name.

llvm-svn: 112693
2010-09-01 03:07:18 +00:00
Douglas Gregor a89314e396 Add libclang support for namespace aliases (visitation + USRs) along
with a new cursor kind for a reference to a namespace. 

There's still some oddities in the source location information for
NamespaceAliasDecl that I'll address with a separate commit, so the
source locations displayed in the load-namespaces.cpp test will
change.

llvm-svn: 112676
2010-08-31 23:48:11 +00:00
Douglas Gregor f11309e194 Add a new libclang function clang_getTemplateCursorKind(), which
determines the kind of declaration that would be generated if the
given template were instantiated. This allows a client to distinguish
among class/struct/union templates and function/member function/static
member function templates.

Also, teach clang_CXXMethod_isStatic() about function templates.

llvm-svn: 112655
2010-08-31 22:12:17 +00:00
Douglas Gregor a23e8f7a0f Extend libclang with a new cursor kind that indicates a reference to a
template. Such cursors occur, for example, in template specialization
types such as vector<int>. Note that we do not handle the
super-interesting case where the template name is unresolved, e.g.,
within a template.

llvm-svn: 112636
2010-08-31 20:37:03 +00:00
Douglas Gregor f96abb293a Add libclang support for class template partial specializations,
including a cursor kind, visitation, and USRs.

llvm-svn: 112629
2010-08-31 19:31:58 +00:00
Douglas Gregor 1fbaeb196b Add a libclang cursor kind, visitation support and USR support for C++
class templates. 

llvm-svn: 112627
2010-08-31 19:02:00 +00:00
Douglas Gregor 713602bb09 Implement basic support for indexing function templates in
libclang. This includes:
  - Cursor kind for function templates, with visitation logic
  - Cursor kinds for template parameters, with visitation logic
  - Visitation logic for template specialization types, qualified type
  locations
  - USR generation for function templates, template specialization
  types, template parameter types.

Also happens to fix PR7804, which I tripped across while testing.

llvm-svn: 112604
2010-08-31 17:01:39 +00:00
Douglas Gregor 12bca22e91 libclang indexing support for C++ constructors, destructors, and
conversion functions. This introduces new cursor kinds for these three
C++ entities, and reworks visitation of function declarations so that
we get type-source information for the names.

llvm-svn: 112600
2010-08-31 14:41:23 +00:00
Alexis Hunt 3b7918625c Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out.

llvm-svn: 112493
2010-08-30 17:47:05 +00:00
Alexis Hunt 79eb5469e0 Implement C++0x user-defined string literals.
The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

llvm-svn: 112458
2010-08-29 21:26:48 +00:00
Ted Kremenek 378e93c210 Add source file I meant to include in my previous commit.
llvm-svn: 112303
2010-08-27 21:57:20 +00:00
Ted Kremenek ae9e221513 Implement CXCursor support for walking C++ base specifiers. This includes adding the API hooks clang_isVirtualBase() and clang_getCXXAccessSpecifier() to query properties of the base specifier.
Implements <rdar://problem/8274883>.

llvm-svn: 112296
2010-08-27 21:34:58 +00:00
Douglas Gregor 9704c75b1f Teach clang_codeComplete to always sort its code-completion results
llvm-svn: 112292
2010-08-27 21:13:41 +00:00
Douglas Gregor 67c692cc3d Implement code completion for @selector expressions
llvm-svn: 112186
2010-08-26 15:07:07 +00:00
Douglas Gregor 49f67ce4b3 Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.

3rd try. How embarrassing.

llvm-svn: 112180
2010-08-26 13:48:20 +00:00
Daniel Dunbar bef185c835 Revert r112149, "Move the sorting of code-completion results out of the main
path and ...", it is failing tests.

llvm-svn: 112161
2010-08-26 03:53:50 +00:00
Daniel Dunbar 60e3749181 Revert r112154, "Fix thinko in sorting operation", it depends on r112149 which
doth lay upon the chopping block.

llvm-svn: 112160
2010-08-26 03:53:44 +00:00
Douglas Gregor db967a58eb Fix thinko in sorting operation
llvm-svn: 112154
2010-08-26 02:54:05 +00:00
Douglas Gregor 78ecc499eb Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

Provide a libclang function that sorts the results.

llvm-svn: 112149
2010-08-26 02:23:45 +00:00
Ted Kremenek a594082210 Add libclang API hook "clang_getIBOutletCollectionType" to query the collection type for iboutletcollection attributes.
llvm-svn: 112139
2010-08-26 01:42:22 +00:00
Douglas Gregor 1099865124 Revert "Move the sorting of code-completion results out of the main path and
into the clients", because the C standard library sucks. Where's my
stable sort, huh?

llvm-svn: 112121
2010-08-26 00:30:24 +00:00
Ted Kremenek 65b2cc061d When annotating tokens, don't fallback to annotating with a null cursor for cursors that come before a macro instantiation. Fixes <rdar://problem/7974151>.
llvm-svn: 112096
2010-08-25 22:16:02 +00:00
Douglas Gregor ebb7c84891 Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

llvm-svn: 112095
2010-08-25 22:15:42 +00:00
John McCall 276321a9ec Teach Sema to live without CodeCompleteConsumer.h.
llvm-svn: 112028
2010-08-25 06:19:51 +00:00
Ted Kremenek cc7f215872 USRs for class extensions should "mangle" in the location of the extension. (<rdar://problem/8350262>)
llvm-svn: 111991
2010-08-24 23:13:41 +00:00
Douglas Gregor f757a12dfc Introduce new libclang API functions that determine the availability
of a cursor or code-completion result, e.g., whether that result
refers to an unavailable, deleted, or deprecated declaration.

llvm-svn: 111858
2010-08-23 23:00:57 +00:00
Daniel Dunbar f10f9bec83 libclang: Print more information when recovering from crashes in
clang_parseTranslationUnit.

llvm-svn: 111855
2010-08-23 22:35:34 +00:00
Eli Friedman 04831926ec Detabify.
llvm-svn: 111768
2010-08-22 01:00:03 +00:00
John McCall 8b0666cf79 Another step in the process of making the parser depend on Sema:
- move DeclSpec &c into the Sema library
  - move ParseAST into the Parse library
Reflect this change in a thousand different includes.
Reflect this change in the link orders.

llvm-svn: 111667
2010-08-20 18:27:03 +00:00
Douglas Gregor b97b666c47 When performing code-completion in the presence of a preamble, make
sure to (1) actually use the remapped files we were given rather
than old data, and (2) keep the remapped files alive until the
code-completion results are destroyed. Big thanks to Daniel for the
test case.

llvm-svn: 111597
2010-08-20 00:59:43 +00:00