Граф коммитов

1426 Коммитов

Автор SHA1 Сообщение Дата
David Chisnall 3387c65a09 Added cursor visitor that takes a block as an argument. Tested compiling
libclang with both clang -fblocks and gcc (no blocks support).  Only exposed in
the header to compilers that do have blocks support.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118170 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 14:12:26 +00:00
Douglas Gregor 40749ee585 Improve source-location information for CXXConstructExpr nodes, by
ensuring that they cover all of their child nodes. There's still a
clang_getCursor()-related issue with CXXFunctionalCastExprs with
CXXConstructExprs as children (see FIXME in the test case); I'll look
at that separately.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118132 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03 00:35:38 +00:00
Ted Kremenek 0582c897ec Don't add Decls with an invalid location to DeclsInContainer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118111 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 23:17:51 +00:00
Ted Kremenek d8c370ca95 Hack to workaround deficiency in ObjC ASTs. Functions and variables may be declared
within an @implementation, but we have no way to record that information in the AST.
This may cause CursorVisitor to miss these Decls when doing a AST walk.

Fixes <rdar://problem/8595462>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118109 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 23:10:24 +00:00
Ted Kremenek 007a7c9d8d Encapsulate within CXCursor the notion of whether a VarDecl* is the first Decl in a DeclGroup. We use this
to recover some context that is currently not modeled directly in the AST.  Currently VarDecl's cannot
properly determine their source range because they have no context on whether or not they appear in a DeclGroup.
For the meantime, this bandaid suffices in libclang since that is where the correct SourceRange is directly needed.

Fixes <rdar://problem/8595749>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 23:26:51 +00:00
Douglas Gregor 81d3c04b09 Do not compare invalid source locations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 20:13:04 +00:00
Benjamin Kramer aeed3da83c Turns out that we may end up calling dladdr on GetExecutablePath, give it external linkage to make sure the lookup works on all platforms.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117813 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 17:32:40 +00:00
Benjamin Kramer 5e0cc38286 This function doesn't need external linkage either.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117786 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 14:28:41 +00:00
Ted Kremenek 1dfb26af4d Remove old CrashTracer cruft from CIndex.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117634 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 01:06:50 +00:00
Douglas Gregor 99ba202f65 Introduce libclang-level options for C++ precompiled preambles,
separating out chaining precompiled preambles from non-chaining ones.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117457 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 17:24:53 +00:00
Douglas Gregor 6160598bcd Add an environment variable that allows us to turn off threading in c-index-test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117449 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 16:00:01 +00:00
Douglas Gregor 38f28c1189 Teach clang_getCursorReferenced() and friends about BlockDeclRefExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117167 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 22:24:08 +00:00
Douglas Gregor 4419b67557 Improve the implementation of libclang's token-annotation logic for
entities in the preprocessing record. Previously, we would only end up
getting the first token of a preprocessing record annotated
correctly. For example, given

  #include "foo.h"

we would only get the '#' annotated as an inclusion directive; the
'include' and '"foo.h"' tokens would be given the general 'processing
directive' annotation.

Now, we get proper annotations for entities in the preprocessing
record.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117001 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 06:10:04 +00:00
Douglas Gregor ecdcb883cb 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 22:00:55 +00:00
Ted Kremenek 93f5e6a5d7 Call clang_disposeTokens() when we are done with the set of tokens.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 21:22:15 +00:00
Douglas Gregor c7b7b7a8ed Introduce code completion results for Objective-C methods, both when
declaring methods and when sending messages to them, by bringing all
of the selector into TypedCheck chunks in the completion result. This
way, we can improve the sorting of these results to account for the
full selector name rather than just the first chunk.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116746 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 21:05:04 +00:00
Oscar Fuentes 115bcd055b Do not use absolute path on the clang++ symlink.
Based on a patch by Ryuta Suzuki!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116695 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 02:25:54 +00:00
Oscar Fuentes fbfe899a1c Use a script for creating the clang++ executable.
The previous method used the DESTDIR environment variable at configure
time, but sometimes it is only available at install time. See PR8397.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116689 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-17 16:10:32 +00:00
Ted Kremenek 05acf8b689 Tweak scan-build to work with naked clang commands.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116651 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-16 00:29:16 +00:00
David Chisnall 83889a7f1f Add clang_getLocationForOffset() to libclang, for gives a source location from a character index into a file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116587 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15 17:07:39 +00:00
Fariborz Jahanian 8ac2d44982 Eliminate usage of ObjCSuperExpr used for
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116483 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 16:04:05 +00:00
David Chisnall 096428b351 Don't claim that things that are Objective-C keywords if preceded by an @ are keywords unless they are preceded by an @.
For example, don't claim that end is a keyword in:

unsigned end;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116439 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 21:44:48 +00:00
Rafael Espindola 4f036fad04 Call InitSections when assembling. This makes clang's output match that of
llvm-mc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 14:53:57 +00:00
Francois Pichet c44fe4bf29 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116286 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-12 01:01:43 +00:00
Douglas Gregor 4cd912aa94 When we load an ASTUnit from command-line arguments, hold on to the
diagnostics produced by the driver itself. Previously, we were
allowing these to either be dropped or to slip through to stderr.

Fixes <rdar://problem/7595339>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-12 00:50:20 +00:00
Douglas Gregor d1e6fdb4c5 Eliminate CIndexer::getClangPath(), since libclang no longer depends
on the presence of a 'clang' executable. Simplify
CIndexer::getClangResourcesPath() a bit.

Patch up the CMake makefiles to install headers into two locations in
the build tree, for those silly cases where 'clang' will end up
looking into the wrong build directory for headers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116260 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 23:17:59 +00:00
Douglas Gregor d3ab63e0f6 Eliminate -fdiagnostics-binary and all of the infrastructure for
emitting diagnostics in a binary form to be consumed by libclang,
since libclang no longer does any of its work out-of-process, making
this code dead. Besides, this stuff never worked at 100% anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 22:02:06 +00:00
Douglas Gregor e0cc52ef8a Eliminate clang_codeComplete(). libclang clients should be using the
faster, in-process, more-configurable clang_codeCompleteAt(). 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116245 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 21:51:20 +00:00
Douglas Gregor 32be4a588f 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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116241 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 21:37:58 +00:00
Douglas Gregor b10daedb8f 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116207 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 16:52:23 +00:00
Douglas Gregor 5a9c0bca45 Fix the mapping of vertical-space cursor kinds to produce a newline,
rather than a space.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-08 20:39:29 +00:00
Daniel Dunbar 48615ffe41 libclang: Disable LLVM pretty stack trace functionality, which inadvertently
sets up signal handlers it shouldn't when we are being used a shared library.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116084 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-08 19:30:33 +00:00
Douglas Gregor 9747583420 Fix a marvelous chained AST writing bug, where we end up with the
following amusing sequence:
  - AST writing schedules writing a type X* that it had never seen
  before
  - AST writing starts writing another declaration, ends up
  deserializing X* from a prior AST file. Now we have two type IDs for
  the same type!
  - AST writer tries to write X*. It only has the lower-numbered ID
  from the the prior AST file, so references to the higher-numbered ID
  that was scheduled for writing go off into lalaland.

To fix this, keep the higher-numbered ID so we end up writing the type
twice. Since this issue occurs so rarely, and type records are
generally rather small, I deemed this better than the alternative: to
keep a separate mapping from the higher-numbered IDs to the
lower-numbered IDs, which we would end up having to check whenever we
want to deserialize any type.

Fixes <rdar://problem/8511624>, I think.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115647 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-05 18:37:06 +00:00
Douglas Gregor 358559d8d7 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115428 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-02 22:49:11 +00:00
Douglas Gregor 3f0fee315c Teach clang_getCursorType() about base specifiers and other references
to types. 

Also, teach clang_getTypeDeclaration() about template specializations,
injected-class-names, and elaborated types.

Fixes <rdar://problem/8506460>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115425 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-02 21:57:58 +00:00
Douglas Gregor fe08e406c1 Don't add -fno-spell-checking in libclang if a spell-checking-related argument is already in the command-line arguments
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115420 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-02 20:06:51 +00:00
Douglas Gregor 1b0f7af641 Provide proper source location and range information for C++ base
specifier cursors in libclang. FIXME -=2, fixes the rest of
<rdar://problem/8274883>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115419 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-02 19:51:13 +00:00
Douglas Gregor db1314e3ef Teach clang_getCursorReferenced() about Objective-C property reference
and protocol expressions. Fixes <rdar://problem/7833565>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115346 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-01 21:11:22 +00:00
Douglas Gregor 9f59234a91 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115338 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-01 20:25:15 +00:00
Dawn Perchik 25d9b00ab0 perform_code_completion(): fix type declaration for TU.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 22:26:05 +00:00
Daniel Dunbar 6edc8001f2 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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115200 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 20:39:47 +00:00
Tom Care 4f2b10b24b Updated scan-build:
- Idempotent operations are on by default, to match --analyze in the driver.
- Integrated stats calculation based on parsing warnings emitted with the -analyzer-stats flag. The new -stats flag enables this.
- New -maxloop flag to pass down a maxloop value to the analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115123 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 01:12:05 +00:00
Tom Care a716f639a6 Modified the ccc-analyzer script to print the compiler command when log level verbosity is enabled. This is handy for debugging.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115109 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 23:48:31 +00:00
Douglas Gregor 2a2c50b330 Enable caching of global code completion results in the suggested
libclang options for editing a translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114810 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 05:49:58 +00:00
Douglas Gregor 8c8d5412cd Teach libclang to enable multithreading in LLVM, since libclang clients are likely to be multithreaded. Also move the printing of timers to somewhere better for multithreaded libclang clients
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-24 21:18:36 +00:00
Douglas Gregor 593b0c1047 Add some missing concurrency checks into libclang
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114682 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-23 18:47:53 +00:00
Douglas Gregor 2be5bc9ad3 Implement libclang API functions for retrieving the lexical and
semantic parents of the given cursor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114587 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-22 21:22:29 +00:00
Ted Kremenek a054fb46b1 Correctly register the class extension as the lexical DeclContext for ObjC methods declared with @property in class extensions.
This matches the behavior for setters.

Also pass the class extension to ProcessPropertyDecl as the lexical DeclContext, even when not redeclaring the @property.

This fixes the remaining issues in <rdar://problem/7410145>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114477 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 20:52:59 +00:00
Ted Kremenek 097727ba0c Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114394 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 04:47:01 +00:00
Ted Kremenek c52d069277 Check for null ObjCInterfaceDecls returned from getClassInterface() when generating USRs. While I have no test case for this (could not create one), this shows up in crash reports. Tentatively fixes <rdar://problem/8452791>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114392 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 04:45:46 +00:00