Commit Graph

152 Commits

Author SHA1 Message Date
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
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 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
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
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
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
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
Daniel Dunbar 186f74215f c-index-test: Diagnose parse / completion failures in -code-completion-at=.
llvm-svn: 111580
2010-08-19 23:44:06 +00:00
Daniel Dunbar ffc11e2a53 c-index-test: As with reparse, only honor remapped false during the code
completion step with -code-completion-at=, to allow testing simulated source
changes.

llvm-svn: 111579
2010-08-19 23:44:04 +00:00
Douglas Gregor 0e3da27c51 Fix a c-index-test leak with file remapping
llvm-svn: 111559
2010-08-19 20:50:29 +00:00
Daniel Dunbar ec29d712d4 c-index-test: Change -test-load-source-repase to only use remapped files for the
reparse, to allow testing distinct inputs.

llvm-svn: 111448
2010-08-18 23:09:16 +00:00
Sebastian Redl 135bcc791b Reintroduce the serialization library, with fixed dependencies.
llvm-svn: 111279
2010-08-17 20:43:28 +00:00
Douglas Gregor b14904c4a8 Implement caching of code-completion results for macro definitions
when the CXTranslationUnit_CacheCompletionResults option is given to
clang_parseTranslationUnit(). Essentially, we compute code-completion
results for macro definitions after we have parsed the file, then
store an ASTContext-agnostic version of those results (completion
string, cursor kind, priority, and active contexts) in the
ASTUnit. When performing code completion in that ASTUnit, we splice 
the macro definition results into the results provided by the actual
code-completion (which has had macros turned off) before libclang gets
those results. We use completion context information to only splice in
those results that make sense for that context.

With a completion involving all of the macros from Cocoa.h and a few other
system libraries (totally ~8500 macro definitions) living in a
precompiled header, we get about a 9% performance improvement from
code completion, since we no longer have to deserialize all of the
macro definitions from the precompiled header. 

Note that macro definitions are merely the canary; the cache is
designed to also support other top-level declarations, which should be
a bigger performance win. That optimization will be next.

Note also that there is no mechanism for determining when to throw
away the cache and recompute its contents.

llvm-svn: 111051
2010-08-13 22:48:40 +00:00
Douglas Gregor 6bb92ecc0a Add an options parameter to clang_saveTranslationUnit, because we'll want it later
llvm-svn: 111016
2010-08-13 15:35:05 +00:00
Douglas Gregor e938668003 Implement clang_saveTranslationUnit(), which saves a translation unit
into a PCH/AST file.

llvm-svn: 111006
2010-08-13 05:36:37 +00:00
Douglas Gregor de05118c84 Add a (currently unused) "options" parameter to
clang_reparseTranslationUnit(), along with a function to retrieve the
default recommended reparsing options for a translation unit.

Also, add the CXTranslationUnit_CacheCompletionResults flag, which is
also currently unused.

llvm-svn: 110811
2010-08-11 15:58:42 +00:00
Douglas Gregor 4a47bca47d Instead of having a specific CXTranslationUnit_* option flag for
"editing" mode, introduce a separate function
clang_defaultEditingTranslationUnitOptions() that retrieves the set of
options. No functionality change.

llvm-svn: 110613
2010-08-09 22:28:58 +00:00
Daniel Dunbar 8a37147ce2 Fix mixed declarations and code warning.
llvm-svn: 110602
2010-08-09 21:06:06 +00:00
Douglas Gregor 028d3e4d0f Use precompiled preambles for in-process code completion.
llvm-svn: 110596
2010-08-09 20:45:32 +00:00
Douglas Gregor b68bc59a2d Give clang_codeCompleteAt() an "options" parameter, and add a new
flags enumeration + default-generating function that allows
code-completion to be customized via the libclang API.

Plus, turn on spell-checking when performing code completion.

llvm-svn: 110319
2010-08-05 09:09:23 +00:00
Douglas Gregor 8e984da800 Add code-completion support directly to ASTUnit, which performs code
completion within the translation unit using the same command-line
arguments for parsing the translation unit. Eventually, we'll reuse
the precompiled preamble to improve code-completion performance, and
this also gives us a place to cache results.

Expose this function via the new libclang function
clang_codeCompleteAt(), which performs the code completion within a
CXTranslationUnit. The completion occurs in-process
(clang_codeCompletion() runs code completion out-of-process).

llvm-svn: 110210
2010-08-04 16:47:14 +00:00
Ted Kremenek 0c7476ad59 Add clang_isPODType() for querying if the CXType is POD. Implements <rdar://problem/8250669>.
llvm-svn: 109822
2010-07-30 00:14:11 +00:00
Dan Gohman e83f624f44 Fix an apparent bug.
llvm-svn: 109447
2010-07-26 21:44:15 +00:00
Douglas Gregor f2430ba223 Start removing the use of smart pointers from the Parse/Sema
interaction, by effectively defaulting to
DISABLE_SMART_POINTERS. We're embracing the model where all AST nodes
are ASTContext-allocated and live as long as the ASTContext lives.

llvm-svn: 109374
2010-07-25 17:39:21 +00:00
Douglas Gregor be2d8c6096 Basic plumbing for generating a precompiled preamble for an
ASTUnit/CXTranslationUnit. We can't actually use this preamble yet,
however.

llvm-svn: 109202
2010-07-23 00:33:23 +00:00
Chandler Carruth 718df592f7 This was still complaining about the length of the string. I've broken it here
to try to keep as much logical grouping as possible.

llvm-svn: 109085
2010-07-22 06:29:13 +00:00
Douglas Gregor 73a18fdd39 Slip up long string literal
llvm-svn: 108838
2010-07-20 14:34:35 +00:00
Douglas Gregor aa21cc401b Introduce a new libclang API, clang_reparseTranslationUnit(), which
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.

llvm-svn: 108756
2010-07-19 21:46:24 +00:00
Douglas Gregor 47815d5b8c Add a -code-completion-timing= mode to c-index-test, so that we can
test the performance of code-completion without testing the
performance of printf().

llvm-svn: 108172
2010-07-12 18:38:41 +00:00
Benjamin Kramer 1e63c74f60 Silence warning about C++-style comments.
llvm-svn: 106531
2010-06-22 09:29:44 +00:00
Ted Kremenek c62ab8d064 Add CXType support for querying the return type of Objective-C methods. This is done by
adding a clang_getCursorResultType() function (which complements clang_getResultType()).

llvm-svn: 106473
2010-06-21 20:48:56 +00:00
Ted Kremenek c150887fef Add CXType support for FunctionNoProto and FunctionProto types. This includes adding a new
function, clang_getResultType(), which returns the result type of the function type.

llvm-svn: 106459
2010-06-21 20:15:39 +00:00
Daniel Dunbar d04e1a7ef1 Makefiles: Remove unnecessary early include of Makefile.config.
llvm-svn: 105640
2010-06-08 20:57:22 +00:00
Daniel Dunbar ee6b692551 Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar e6c1daa8fd Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
- This eliminates most dependencies on how Clang is installed relative to LLVM.

llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Douglas Gregor a2db793ff0 Introduce priorities into the code-completion results.
llvm-svn: 104751
2010-05-26 22:00:08 +00:00
Ted Kremenek 6bca984b54 Add CXType and an initial set of supporting functions to libclang. This exposes details of
Clang's representation of the C type system to clients.  It is nowhere near complete, and will
be expanded on demand.

llvm-svn: 103809
2010-05-14 21:29:26 +00:00
Daniel Dunbar d5a2a073a0 Rename 'CIndex' to 'libclang', since it has basically become our stable public
(C) API, and will likely grow further in this direction in the future.

llvm-svn: 102779
2010-04-30 21:51:10 +00:00
Daniel Dunbar 9f84c7b600 Move include installation steps to better location, inside each include dir instead of at the top-level.
Also, don't set NO_INSTALL=1 for c-index-test.

llvm-svn: 102724
2010-04-30 17:59:38 +00:00
Ted Kremenek 6d159c1060 Fix USRs for 'extern' variables declaration in functions/method bodies.
Fix USRs for @synthesize.
Add more USR tests.

llvm-svn: 101954
2010-04-20 23:15:40 +00:00
Ted Kremenek 7afa85b8fa Rework USR generation for symbols with no linkage. Many of the USRs are now shortened,
and we now include the file name that declares the symbol with no linkage in the USR.
USRs for such symbols are generated only in restructed cases, e.g., anonymous enum declarations,
typedefs, etc.

llvm-svn: 101542
2010-04-16 21:31:52 +00:00
Ted Kremenek 599d73aa72 Add c-index-test support for printing USRs.
llvm-svn: 99476
2010-03-25 02:00:39 +00:00
Douglas Gregor 0b46650b66 c-index-test's printing of linkage was completely broken, as was the
test of this functionality. The API worked great, though! :)

llvm-svn: 97736
2010-03-04 19:36:27 +00:00
Ted Kremenek 83b28a2433 Add '-test-print-linkage-source' option to c-index-test
to test clang_getCursorLinkage()

llvm-svn: 97648
2010-03-03 06:37:58 +00:00
Douglas Gregor d770f73fac Rework the CIndex API for displaying diagnostics. Instead of printing
the diagnostics to a FILE*, return a CXString containing the formatted
diagnostic.

llvm-svn: 96823
2010-02-22 23:17:23 +00:00
Douglas Gregor 836ec94c8e Simplify the CIndex fix-it API, now that we have half-open CXSourceRanges.
llvm-svn: 96685
2010-02-19 18:16:06 +00:00
Douglas Gregor 1e21cc7d19 Re-apply my diagnostics-capture patch for CIndex, with some tweaks to
try to address the msvc failures.

llvm-svn: 96624
2010-02-18 23:07:20 +00:00