Commit Graph

207 Commits

Author SHA1 Message Date
Douglas Gregor 3f35bb2d15 Add a new libclang API to return a CXCompletionString for an arbitrary
cursor, from Connor Wakamo! Addresses <rdar://problem/9087798>.

llvm-svn: 136911
2011-08-04 20:04:59 +00:00
Douglas Gregor ea777403f9 Add new libclang API, clang_codeCompleteGetObjCSelector(), which
provides the partial Objective-C selector used in a code
completion. From Connor Wakamo!

llvm-svn: 136084
2011-07-26 15:24:30 +00:00
Douglas Gregor c1679ecf3b Added clang_getCursorReferenceNameRange to libclang to to retrieve parts of
a cursor reference, from Erik Verbruggen!

llvm-svn: 135920
2011-07-25 17:48:11 +00:00
Douglas Gregor 63745d5935 New libclang API to expose container type for code completion, from
Connor Wakamo!

llvm-svn: 135651
2011-07-21 01:05:26 +00:00
Chandler Carruth de81fc8557 NestedMacroInstantiations -> NestedMacroExpansions
This is switches all the interfaces points (and most of the commenst
/ local variables I saw on my way through) regarding the
NestedMacroInstantiations bit.

The libclang enums corresponding to this state were renamed, but
a legacy enum was added with the old name, and the same value to keep
existing clients working. I've added a documentation blurb for it, but
let me know if there is a canonical way to document legacy elemenst of
the libclang interface.

No functionality changed here, even in tests.

llvm-svn: 135141
2011-07-14 09:02:10 +00:00
Argyrios Kyrtzidis dd76300464 Fix linker problem in buildbot.
llvm-svn: 134849
2011-07-09 22:35:06 +00:00
Douglas Gregor 2132584d36 Introduce a new libclang aPI function,
clang_codeCompleteGetContexts(), that provides the client with
information about the context in which code completion has occurred
and what kinds of entities make sense as completions at that
point. Patch by Connor Wakamo!

llvm-svn: 134615
2011-07-07 16:03:39 +00:00
Francois Pichet abcfbecf39 MSVC doesn't like mixing declarations and statements in a C file.
llvm-svn: 134550
2011-07-06 22:09:44 +00:00
Douglas Gregor 30c80fa3eb libclang: Allow callers of clang_saveTranslationUnit() to distinguish
between different classes of errors. Addresses most of
<rdar://problem/9660328>.

llvm-svn: 134495
2011-07-06 16:43:36 +00:00
Chandler Carruth 5dea0dc575 Remove ARCMigrate from more builds that it isn't needed in now that the
layering problem has been addressed.

llvm-svn: 133217
2011-06-16 23:53:28 +00:00
John McCall 32e02a431b c-index-test also depends on ARCMigrate, oh boy
llvm-svn: 133147
2011-06-16 05:29:03 +00:00
Douglas Gregor a8d0c774da Add c-index-test printing and tests for static and virtual method
query functions, from Erik Verbruggen!

llvm-svn: 131295
2011-05-13 15:54:42 +00:00
Douglas Gregor 998caead70 Introduce a new libclang parsing flag,
CXTranslationUnit_NestedMacroInstantiations, which indicates whether
we want to see "nested" macro instantiations (e.g., those that occur
inside other macro instantiations) within the detailed preprocessing
record. Many clients (e.g., those that only care about visible tokens)
don't care about this information, and in code that uses preprocessor
metaprogramming, this information can have a very high cost.

Addresses <rdar://problem/9389320>.

llvm-svn: 130990
2011-05-06 16:33:08 +00:00
Douglas Gregor 37aa4938c8 Introduce a new libclang API, clang_isFileMultipleIncludeGuarded(),
which determines whether a particular file is actually a header that
is intended to be guarded from multiple inclusions within the same
translation unit.

llvm-svn: 130808
2011-05-04 00:14:37 +00:00
Ted Kremenek 23324124e4 Rename 'CXTUMemoryUsage…' to 'CXTUResourceUsage…'.
llvm-svn: 129857
2011-04-20 16:41:07 +00:00
Ted Kremenek 11d1a42e84 Report memory usage for global code completion results in CXTUMemoryUsage.
llvm-svn: 129733
2011-04-18 23:42:53 +00:00
Francois Pichet 45cc546271 Unbreak the MSVC build: Don't mix variable declarations and statements in a .c file.
llvm-svn: 129732
2011-04-18 23:33:22 +00:00
Ted Kremenek 83f642e54a Add libclang API to query how much memory is used by a CXTranslationUnit. This is a WIP. Currently we report
the amount used for expressions, types, identifiers, and selectors.

llvm-svn: 129730
2011-04-18 22:47:10 +00:00
NAKAMURA Takumi d3cc220d97 c-index-test.c: Fix cygwin warning not to pass signed char to islower(c).
Cygwin's ctype.h says;
/* These macros are intentionally written in a manner that will trigger
   a gcc -Wall warning if the user mistakenly passes a 'char' instead
   of an int containing an 'unsigned char'.
   (snip) */

llvm-svn: 127308
2011-03-09 03:02:28 +00:00
NAKAMURA Takumi 8fbf64f420 [PR9321] "make install" does not need install c-index-test. It is used for testing.
llvm-svn: 126634
2011-02-28 05:21:34 +00:00
Peter Collingbourne 8f5cf74c77 Re-instate r125819 and r125820 with no functionality change
llvm-svn: 126060
2011-02-19 23:03:58 +00:00
Rafael Espindola a6d2bff0c5 Revert 125820 and 125819 to fix PR9266.
llvm-svn: 126050
2011-02-19 21:39:31 +00:00
Peter Collingbourne 14a552b2d7 Move CompilerInstance::LLVMContext and LLVMContext ownership to CodeGenAction
This removes the final dependency edge from any lib outside of CodeGen
to core.  As a result we can, and do, trim the dependency on core
from libclang, PrintFunctionNames, the unit tests and c-index-test.
While at it, review and trim other unneeded dependencies.

llvm-svn: 125820
2011-02-18 02:25:12 +00:00
NAKAMURA Takumi 98dd73d66c CMake: LLVM_NO_RTTI must be obsolete now!
llvm-svn: 125275
2011-02-10 09:15:32 +00:00
Douglas Gregor 149239651d If any Fix-Its attached to a diagnostic have invalid source locations
or source locations that refer into a macro instantiation, delete all
of the Fix-Its on that diagnostic.

llvm-svn: 124833
2011-02-03 23:41:12 +00:00
Douglas Gregor 7a964ad4ce Teach Diagnostic::setClient() to free the existing, owned
client. Fixes a libclang leak.

llvm-svn: 124614
2011-01-31 22:04:05 +00:00
Douglas Gregor ffd6dc432e Teach ASTUnit to save the specified target features, since
TargetInfo::CreateTargetInfo() mangles the target options in a way
that is not idempotent. Fixes <rdar://problem/8807535>.

llvm-svn: 124382
2011-01-27 18:02:58 +00:00
Douglas Gregor 56a6380cb7 Add libclang functions to determine the const/volatile/restrict
qualifiers on a CXType. Patch from Stefan Seefeld, test by me.

llvm-svn: 124377
2011-01-27 16:27:11 +00:00
Douglas Gregor b42f34b652 De-C99-ify for loop
llvm-svn: 120395
2010-11-30 06:04:54 +00:00
Douglas Gregor 2f6358b100 Teach c-index-test to reparse the source file a few times when testing
clang_getCursor() via -cursor-at=??? and CINDEXTEST_EDITING is set in
the environment. This mirrors how we test code completion and
source-loading in the presence of this environment variable.

llvm-svn: 120392
2010-11-30 05:52:55 +00:00
Douglas Gregor a750e8e6d8 Extend the libclang diagnostic API to provide information about the
option name, category ID, and category name corresponding to a diagnostic.

llvm-svn: 119802
2010-11-19 16:18:16 +00:00
Ted Kremenek 915542850b Change CXTranslationUnit to not directly cast to an ASTUnit*,
but to wrap both an ASTUnit and a "string pool"
that will be used for fast USR generation.

This requires a bunch of mechanical changes, as
there was a ton of code that assumed that CXTranslationUnit
and ASTUnit* were the same.

Along with this change, introduce CXStringBuf,
which provides an llvm::SmallVector<char> backing
for repeatedly generating CXStrings without a huge
amount of malloc() traffic.  This requires making
some changes to the representation of CXString
by renaming a few fields (but keeping the size
of the object the same).

llvm-svn: 119337
2010-11-16 08:15:36 +00:00
Ted Kremenek 4b4f36990d Move CXString creation/management routines into
their own .cpp file and make the interpretation
of its flags private.

llvm-svn: 119319
2010-11-16 01:56:27 +00:00
Douglas Gregor c65929299d Tweak libclang's heuristics for building precompiled preambles and
caching global code-completion results. In particular, don't perform
either operation the first time we parse, but do both after the first
reparse. 

llvm-svn: 119285
2010-11-15 23:00:34 +00:00
Douglas Gregor 229bebdeb5 ntroduce clang_getSpellingLocation() into libclang, to provide the
location where we're spelling a token even within a
macro. clang_getInstantiationLocation() tells where we instantiated
the macro.

I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs,
since they gloss over macro-instantiation information.

Take 2: this time, adjusted tests appropriately and used a "simple"
approach to the spelling location.

llvm-svn: 118495
2010-11-09 06:24:54 +00:00
Douglas Gregor 12a610d1fa Revert r118492, which didn't update all of its tests accordingly
llvm-svn: 118494
2010-11-09 05:52:02 +00:00
Douglas Gregor d1ea3f0d29 Introduce clang_getSpellingLocation() into libclang, to provide the
location where we're spelling a token even within a
macro. clang_getInstantiationLocation() tells where we instantiated
the macro.

I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs,
since they gloss over macro-instantiation information.

llvm-svn: 118492
2010-11-09 05:28:47 +00:00
Benjamin Kramer 112fc6cdfb Adjust return type of thread_runner.
llvm-svn: 118259
2010-11-04 19:11:31 +00:00
Daniel Dunbar 23397c3dd6 c-index-test: Switch to using clang_executeOnThread instead of mucking about
with system specific stuff.

llvm-svn: 118224
2010-11-04 01:26:31 +00:00
Douglas Gregor f428bf80e1 Add an environment variable that allows us to turn off threading in c-index-test
llvm-svn: 117449
2010-10-27 16:00:01 +00:00
Douglas Gregor 796d76a663 Extend the preprocessing record and libclang with support for
inclusion directives, keeping track of every #include, #import,
etc. in the translation unit. We keep track of the source location and
kind of the inclusion, how the file name was spelled, and the
underlying file to which the inclusion resolved.

llvm-svn: 116952
2010-10-20 22:00:55 +00:00
Ted Kremenek 983fb5de5f Call clang_disposeTokens() when we are done with the set of tokens.
llvm-svn: 116946
2010-10-20 21:22:15 +00:00
Francois Pichet 85e6da1f19 This patch remove the Win32 XFAIL from remap-complete.c
The problem was that text files were open in text mode and Microsoft implementation of fread and write will try to do nasty line-feed conversion which make the line position no longer valid. The fix is to read and write files in binary mode.

llvm-svn: 116286
2010-10-12 01:01:43 +00:00
Douglas Gregor 36e3b5c79e Switch c-index-test from clang_codeComplete() over to
clang_codeCompleteAt(). This uncovered a few issues with the latter:

  - ASTUnit wasn't saving/restoring diagnostic state appropriately between
    reparses and code completions.
  - "Overload" completions weren't being passed through to the client

llvm-svn: 116241
2010-10-11 21:37:58 +00:00
Douglas Gregor 7845f1e80e Eliminate clang_setUseExternalASTGeneration() from libclang. Between
improvements to the compiler and the introduction of crash recovery,
it no longer makes sense to allow this mode. Moreover, this eliminates
one use of the "clang" executable from within libclang; we'd like them
all to go away.

llvm-svn: 116207
2010-10-11 16:52:23 +00:00
Douglas Gregor 8ed5b77008 Fix the mapping of vertical-space cursor kinds to produce a newline,
rather than a space.

llvm-svn: 116097
2010-10-08 20:39:29 +00:00
Douglas Gregor 97c7571ef3 Introduce a new libclang function, clang_getCursorDisplayName(), which
produces a simple "display" name that captures the
arguments/parameters for a function, function template, class
template, or class template specialization.

llvm-svn: 115428
2010-10-02 22:49:11 +00:00
Douglas Gregor 99a26afd49 Extend libclang with an API that determines, given a C++ virtual
member function or an Objective-C method, which other member
functions/methods it overrides.

llvm-svn: 115338
2010-10-01 20:25:15 +00:00
Dawn Perchik 0d3d0b7489 perform_code_completion(): fix type declaration for TU.
llvm-svn: 115224
2010-09-30 22:26:05 +00:00
Daniel Dunbar 08b33d0791 c-index-test: Run inside a separate thread iff we have pthread support, to
ensure we at least get some minimal testing of running in a multithreaded
environment (for example, having a reduced stack size).

llvm-svn: 115200
2010-09-30 20:39:47 +00:00