Commit Graph

434 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 0e0e98c015 [index] Rename SymbolSubKind -> SymbolProperty, NFC.
This better reflects what it represents.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286680 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 23:49:55 +00:00
Mehdi Amini e5f86e2485 Turn cl::values() (for enum) from a vararg function to using C++ variadic template
The core of the change is supposed to be NFC, however it also fixes
what I believe was an undefined behavior when calling:

 va_start(ValueArgs, Desc);

with Desc being a StringRef.

Differential Revision: https://reviews.llvm.org/D25342

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283671 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 19:41:06 +00:00
Argyrios Kyrtzidis 5dc810c1b5 [c-index-test] Make sure to check that clang_Cursor_getNumTemplateArguments did not return -1.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277261 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 02:20:21 +00:00
Richard Smith 094ed6b130 Update to match LLVM r272232.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272233 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 00:53:41 +00:00
Manman Ren c4b3e82875 Indexer: add CXObjCPropertyAttr_class for class properties.
rdar://25963227


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271351 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 23:22:04 +00:00
Ehsan Akhgari d3c40bafee clang-c: Add the clang_getCursorVisibility() API
This patch adds an API for querying the visibility of the entity
referred to by a cursor.

Patch by Michael Wu <mwu@mozilla.com>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271292 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 15:55:51 +00:00
Ehsan Akhgari dafa8b9142 Revert r253909 because it was committed with an incorrect message
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271291 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 15:39:10 +00:00
David Blaikie f2899fa354 [scan-build] fix dead store warnings emitted on clang code base
This fixes dead store warnings of the type "dead assignment" reported
by CLang Static Analyzer on the following file:

- tools/c-index-test/c-index-test.c.

Patch by Apelete Seketeli <apelete@seketeli.net>!

Differential Revision: http://reviews.llvm.org/D19831

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268453 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 22:14:14 +00:00
Jonathan Coe f376e8cf30 Expose cxx constructor and method properties through libclang and python bindings.
Summary:
I have exposed the following function through libclang and the clang.cindex python bindings:

clang_CXXConstructor_isConvertingConstructor,
clang_CXXConstructor_isCopyConstructor,
clang_CXXConstructor_isDefaultConstructor,
clang_CXXConstructor_isMoveConstructor,
clang_CXXMethod_isDefaulted

I need (some of) these methods for a C++ code model I am building in Python to drive a code generator.

Reviewers: compnerd, skalinichev

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15469

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267706 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 12:48:25 +00:00
Argyrios Kyrtzidis 17e80200b6 [index] Add a SymbolSubKind for an ObjC unit test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267117 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 07:21:10 +00:00
Argyrios Kyrtzidis a0cb91f335 [index] Change SymbolCXXTemplateKind to a 'SymbolSubKinds' bitset.
This provides a more general and flexible way to annotate special symbols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267116 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 07:21:04 +00:00
Vedant Kumar 68459edd2a [c-index-test] Fix leak in print_completion_result, NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-03 00:54:46 +00:00
Vedant Kumar f7d61c9051 [c-index-test] Delete dead function, NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264874 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 16:03:02 +00:00
Manuel Klimek ac0a11ae22 Optionally demote fatal errors to non-fatal errors.
This behavior is enabled when the new CXTranslationUnit_KeepGoing
option is passed to clang_parseTranslationUnit{,2}. It is geared
towards use by IDEs and similar consumers of the clang-c API where
fatal errors may arise when parsing incomplete code mid-edit, or
when include paths are not properly configured yet. In such situations
one still wants to get as much information as possible about a TU.
Previously, the semantic analysis would not instantiate templates
or report additional fatal errors after the first fatal error was
encountered.

Fixes PR24268.

Patch by Milian Wolff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262318 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 10:56:19 +00:00
Argyrios Kyrtzidis cf6bc2febe [index] Print and test module import references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262208 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-29 07:56:07 +00:00
Argyrios Kyrtzidis c34c0ec7b6 [c-index-test] CMake: When installing c-index-test to a different prefix directory, add an rpath so that
it can find libclang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261445 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 20:34:55 +00:00
Argyrios Kyrtzidis 1c8c47123f [AST/index] Introduce an option 'SuppressTemplateArgsInCXXConstructors' in printing policy.
Enable it for USRs and names when indexing.
Forward references can have different template argument names; including them
makes USRs and names unstable, since the name depends on whether we saw a forward reference or not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260866 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-15 01:32:36 +00:00
Argyrios Kyrtzidis 62caeb12d2 [index] Factor libclang's functionality to determing the mangled name of symbols into the clangIndex library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260858 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-14 22:30:14 +00:00
Benjamin Kramer c077371eb6 Don't leak the ASTUnit when done with testing.
Found by lsan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260850 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-14 13:18:06 +00:00
NAKAMURA Takumi 3bbaf24411 c-index-test: Fix libdeps corresponding to r260841.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260847 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-14 09:19:04 +00:00
Argyrios Kyrtzidis 8b4af64863 [c-index-test] Fix a gcc build error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260844 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-14 07:08:31 +00:00
Argyrios Kyrtzidis d3a0b2f8a5 [index] Fix gcc builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260843 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-14 06:53:20 +00:00
Argyrios Kyrtzidis 4d8332ae58 [index] Enhance c-index-test tool and have it link and test the clangIndex library directly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260842 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-14 06:39:11 +00:00
Chris Bieneman 171280519b Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

    "This is the way [autoconf] ends
    Not with a bang but a whimper."
    -T.S. Eliot

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D16472

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258862 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 21:30:40 +00:00
Argyrios Kyrtzidis c5f92b66c8 [libclang] Introduce APIs for evaluating a cursor and checking if a macro is builtin/function.
rdar://24091595

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257968 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-16 00:20:02 +00:00
Sergey Kalinichev 1e91237549 [libclang] Handle AutoType in clang_getTypeDeclaration
Differential Revision: http://reviews.llvm.org/D13001


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257043 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-07 09:20:40 +00:00
Erik Verbruggen 8f8b710193 Show inclusions from a preamble in clang_getInclusions.
When reparsing a translation unit with preamble generation turned on,
no includes are found. This is due to the fact that all SLocs from
AST/PCH files are skipped as they are 'loaded', and inclusions from a
preamble are also 'loaded'. So, in case a file has a preamble, it first
needs to process those loaded inclusions, and then check for any local
inclusions. This latter one is for any includes that are not part of the
preamble, like includes half-way through a file.

This fixes PR24748.

Differential Revision: http://reviews.llvm.org/D14329

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256939 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-06 15:12:51 +00:00
Benjamin Kramer bdb673743a [libclang] Add a flag to create the precompiled preamble on the first parse.
Summary:
The current default is to create the preamble on the first reparse, aka
second parse. This is useful for clients that do not want to block when
opening a file because serializing the preamble takes a bit of time.
However, this makes the reparse much more expensive and that may be on the
critical path as it's the first interaction a user has with the source code.

YouCompleteMe currently optimizes for the first code interaction by parsing
the file twice when loaded. That's just unnecessarily slow and this flag
helps to avoid that.

Reviewers: doug.gregor, klimek

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15490

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255635 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15 09:30:31 +00:00
Ehsan Akhgari b5395ff11a Make clang_Cursor_getMangling not mangle if the declaration isn't mangled
Right now clang_Cursor_getMangling will attempt to mangle any
declaration, even if the declaration isn't mangled (extern C).  This
results in a partially mangled name which isn't useful for much. This
patch makes clang_Cursor_getMangling return an empty string if the
declaration isn't mangled.

Patch by Michael Wu <mwu@mozilla.com>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253909 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 19:56:46 +00:00
Argyrios Kyrtzidis cb1efc9aa9 [CMake] Don't install c-index-test when LLVM_INSTALL_TOOLCHAIN_ONLY=ON.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253099 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 22:41:14 +00:00
Argyrios Kyrtzidis 426b990c35 [CMake] If 'INTERNAL_INSTALL_PREFIX' is set, use it for determining the install destination of c-index-test and the libclang headers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 01:46:18 +00:00
Ismail Donmez d441b2e2d5 Fix c-index-test install path
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252890 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 13:47:35 +00:00
Saleem Abdulrasool cdfd2b5933 libclang: add clang_Cursor_getCXXManglings
This function permits the mangling of a C++ 'structor.  Depending on the ABI and
the declaration, the declaration may contain more than one associated symbol for
a given declaration.  This allows the consumer to retrieve all of the associated
symbols for the declaration the cursor points to.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252853 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 03:57:22 +00:00
Argyrios Kyrtzidis 070e9f2e4a [CMake] Setup an install component for libclang and c-index-test.
Also don't create libclang dylib symlinks on darwin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252836 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 00:46:57 +00:00
Saleem Abdulrasool 08e335a648 Index: expose is_mutable_field
Expose isMutable via libClang and python bindings.

Patch by Jonathan B Coe!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251410 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 15:50:22 +00:00
Craig Topper 40bf428a9f Fix a -Wdeclaration-after-statement warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249652 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 03:37:36 +00:00
Ehsan Akhgari bf978b5a0b Make clang_Cursor_getMangling not mangle if the declaration isn't mangled
Right now clang_Cursor_getMangling will attempt to mangle any
declaration, even if the declaration isn't mangled (extern C).  This
results in a partially mangled name which isn't useful for much. This
patch makes clang_Cursor_getMangling return an empty string if the
declaration isn't mangled.

Patch by Michael Wu <mwu@mozilla.com>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249639 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 00:01:20 +00:00
Ehsan Akhgari 1233ac35f7 Revert r249437
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249440 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-06 18:53:12 +00:00
Ehsan Akhgari 70e8b815c5 Make clang_Cursor_getMangling don't mangle if the declaration isn't mangled
Right now clang_Cursor_getMangling will attempt to mangle any
declaration, even if the declaration isn't mangled (extern "C").  This
results in a partially mangled name which isn't useful for much. This
patch makes clang_Cursor_getMangling return an empty string if the
declaration isn't mangled.

Patch by Michael Wu <mwu@mozilla.com>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249437 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-06 18:24:33 +00:00
Chandler Carruth 8fd59d7392 [UB] Avoid a really broken call to realloc that would later result in
a bad call to memcpy.

When we only have a buffer from one of the two reparse calls, we can
just return that buffer rather than going through the realloc/memcpy
dance.

Found with UBsan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243950 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-04 03:53:04 +00:00
NAKAMURA Takumi d6e98d6837 Tweak libclang's users, c-arcmt-test, c-index-test and libclangTests to satisfy LDFLAGS=-static.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241992 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-12 12:17:55 +00:00
NAKAMURA Takumi 89c2339b72 Reformat Makefile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241991 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-12 12:14:39 +00:00
Adrian Prantl 7edf3602fc Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240025 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-18 16:41:51 +00:00
Yaron Keren 142e7f3289 Revert r237339 as sanitizer-ppc64-linux1 does not like it.
Complains:

/home/buildbots/sanitizerslave1/sanitizer-ppc64-1/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:829:30: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat]
                     I, TAK, clang_Cursor_getTemplateArgumentValue(Cursor, I));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm not sure now how this should be fixed. %lld is non-standard
and not accepted by mingw on Windows while PRId64 is bad for this bot.

Is long long longer than 64 bits here? if not, why is PRId64
incompatible with it? something seems wrong.

Probably all the datatypes should be replaced to unsigned or uint64_t
depending upin requirements instead of the non standard long long.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237346 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 06:53:31 +00:00
Yaron Keren 8a01070d81 Replace non-standard %lld printf usage with PRId64.
See also r180024.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237339 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 05:40:50 +00:00
Argyrios Kyrtzidis 11a6a5c1d6 [libclang] Add functions to get information about fields.
Patch by Loïc Jaquemet!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234762 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-13 16:55:04 +00:00
Adrian Prantl 9f65c56340 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230454 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-25 02:44:04 +00:00
Adrian Prantl 407c31db6c Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

This reapplies r230044 with a fixed configure+make build and updated
dependencies and testcase requirements. Over the last iteration this
version adds
- missing target requirements for testcases that specify an x86 triple,
- a missing clangCodeGen.a dependency to libClang.a in the make build.

rdar://problem/19104245

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230423 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-25 01:31:45 +00:00
Adrian Prantl 947bca71d3 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit r230305.
Off to fix another round of missing dependencies on various platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230309 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 05:14:17 +00:00
Adrian Prantl b114a1de0a Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

rdar://problem/19104245

This reapplies r230044 with a fixed configure+make build and updated
dependencies. Take 3.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230305 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 04:25:59 +00:00