summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor functions PrintTemplateArgumentListSerge Pavlov2017-11-281-3/+3
| | | | | | | | | | | These functions were defined as static members of TemplateSpecializationType. Now they are moved to namespace level. Previously there were different implementations for lists containing TemplateArgument and TemplateArgumentLoc, now these implementations share the same code. This change is a result of refactoring patch D40508. NFC. llvm-svn: 319178
* [libclang] Fix cursors for in-class initializer of field declarationsBenjamin Kramer2017-11-151-0/+3
| | | | | | | | | | Fixes PR33745. Patch by Nikolai Kosjar! Differential Revision: https://reviews.llvm.org/D40027 llvm-svn: 318292
* [libclang] Allow crash recovery with LIBCLANG_NOTHREADSErik Verbruggen2017-11-143-28/+2
| | | | | | | | | | | Enabled crash recovery for some libclang operations on a calling thread even when LIBCLANG_NOTHREAD is specified. Previously it would only run under crash recovery if LIBCLANG_NOTHREAD is not set. Moved handling of LIBCLANG_NOTHREAD env variable into RunSafely from its call sites. llvm-svn: 318142
* Move the libclang-headers project into the Misc folder on IDEs like Visual ↵Aaron Ballman2017-11-041-0/+1
| | | | | | Studio rather than leave it in the root directory. NFC. llvm-svn: 317417
* [libclang] Add dummy libclang-headers targetShoaib Meenai2017-11-021-0/+5
| | | | | | | | | | `LLVM_DISTRIBUTION_COMPONENTS` assumes that each component has both `component` and `install-component` targets. Add a dummy no-op target for `libclang-headers` to placate this check. Differential Revision: https://reviews.llvm.org/D39524 llvm-svn: 317188
* Reverting r316278 due to failing build bots.Aaron Ballman2017-10-211-1/+2
| | | | | | | http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/11896 http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/12380 llvm-svn: 316279
* [libclang, bindings]: add spelling locationMasud Rahman2017-10-211-2/+1
| | | | | | | | | | | | | | | | | | o) Add a 'Location' class that represents the four properties of a physical location o) Enhance 'SourceLocation' to provide 'expansion' and 'spelling' locations, maintaining backwards compatibility with existing code by forwarding the four properties to 'expansion'. o) Update the implementation to use 'clang_getExpansionLocation' instead of the deprecated 'clang_getInstantiationLocation', which has been present since 2011. o) Update the implementation of 'clang_getSpellingLocation' to actually obtain spelling location instead of file location. llvm-svn: 316278
* [CMake] Use #cmakedefine01 for ↵NAKAMURA Takumi2017-10-181-2/+2
| | | | | | | | | | | | CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER) It'd be better that they are #cmakedefine01 rather than #cmakedefine. (#if FOO rather than #if defined(FOO)) Then we can find missing #include "clang/Config/config.h" in the future. Differential Revision: https://reviews.llvm.org/D35541 llvm-svn: 316061
* [libclang] Visit attributes for function and class templatesJonathan Coe2017-10-161-2/+4
| | | | | | | | | | | | | | | | | | Summary: Previously, `VisitAttributes` was not called for function and class templates and thus their attributes were not accessible using libclang. Reviewers: bkramer, arphaman, rsmith, jbcoe Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by jklaehn (Johann Klähn) Differential Revision: https://reviews.llvm.org/D36955 llvm-svn: 315958
* Convert clang::LangAS to a strongly typed enumAlexander Richardson2017-10-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Convert clang::LangAS to a strongly typed enum Currently both clang AST address spaces and target specific address spaces are represented as unsigned which can lead to subtle errors if the wrong type is passed. It is especially confusing in the CodeGen files as it is not possible to see what kind of address space should be passed to a function without looking at the implementation. I originally made this change for our LLVM fork for the CHERI architecture where we make extensive use of address spaces to differentiate between capabilities and pointers. When merging the upstream changes I usually run into some test failures or runtime crashes because the wrong kind of address space is passed to a function. By converting the LangAS enum to a C++11 we can catch these errors at compile time. Additionally, it is now obvious from the function signature which kind of address space it expects. I found the following errors while writing this patch: - ItaniumRecordLayoutBuilder::LayoutField was passing a clang AST address space to TargetInfo::getPointer{Width,Align}() - TypePrinter::printAttributedAfter() prints the numeric value of the clang AST address space instead of the target address space. However, this code is not used so I kept the current behaviour - initializeForBlockHeader() in CGBlocks.cpp was passing LangAS::opencl_generic to TargetInfo::getPointer{Width,Align}() - CodeGenFunction::EmitBlockLiteral() was passing a AST address space to TargetInfo::getPointerWidth() - CGOpenMPRuntimeNVPTX::translateParameter() passed a target address space to Qualifiers::addAddressSpace() - CGOpenMPRuntimeNVPTX::getParameterAddress() was using llvm::Type::getPointerTo() with a AST address space - clang_getAddressSpace() returns either a LangAS or a target address space. As this is exposed to C I have kept the current behaviour and added a comment stating that it is probably not correct. Other than this the patch should not cause any functional changes. Reviewers: yaxunl, pcc, bader Reviewed By: yaxunl, bader Subscribers: jlebar, jholewinski, nhaehnle, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D38816 llvm-svn: 315871
* Dependent Address Space SupportAndrew Gozillon2017-10-021-0/+1
| | | | | | | | | | | | | | This patch relates to: https://reviews.llvm.org/D33666 This adds support for template parameters to be passed to the address_space attribute. The main goal is to add further flexibility to the attribute and allow for it to be used easily with templates. The main additions are a new type (DependentAddressSpaceType) alongside its TypeLoc and its mangling. As well as the logic required to support dependent address spaces which mainly resides in TreeTransform.h and SemaType.cpp. llvm-svn: 314649
* [index] Generate class & metaclass manglings for objcDave Lee2017-09-222-0/+15
| | | | | | | | | | | | | | | | | | | | | | | Summary: ObjC classes have two associated symbols, one for the class and one for the metaclass. This change overloads `CodegenNameGenerator::getAllManglings` to produce both class and metaclass symbols. While this function is called by `clang_Cursor_getCXXManglings`, it's only called for CXXRecordDecl and CXXMethodDecl, and so libclang's behavior is unchanged. Reviewers: arphaman, abdulras, alexshap, compnerd Reviewed By: compnerd Subscribers: compnerd Differential Revision: https://reviews.llvm.org/D37671 llvm-svn: 313997
* libclang: expose `clang_getCursorTLSKind`Saleem Abdulrasool2017-09-132-0/+17
| | | | | | | | | | Introduce the 'TLS Kind' property of variable declarations through libclang. Additionally, provide a Python accessor for it, and test that functionality. Patch by Masud Rahman! llvm-svn: 313111
* [Lexer] Report more precise skipped regions (PR34166)Vedant Kumar2017-09-111-1/+2
| | | | | | | | | | | | | | | | | | | | This patch teaches the preprocessor to report more precise source ranges for code that is skipped due to conditional directives. The new behavior includes the '#' from the opening directive and the full text of the line containing the closing directive in the skipped area. This matches up clang's behavior (we don't IRGen the code between the closing "endif" and the end of a line). This also affects the code coverage implementation. See llvm.org/PR34166 (this also happens to be rdar://problem/23224058). The old behavior (report the end of the skipped range as the end location of the 'endif' token) is preserved for indexing clients. Differential Revision: https://reviews.llvm.org/D36642 llvm-svn: 312947
* Recommit "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-1/+3
| | | | | | | | This is a recommit of r312781; in some build configurations variable names are omitted, so changed the new regression test accordingly. llvm-svn: 312794
* Revert "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-3/+1
| | | | | | | The clang-with-lto-ubuntu bot didn't like the new regression test, revert while I investigate the issue. llvm-svn: 312784
* Add _Float16 as a C/C++ source language typeSjoerd Meijer2017-09-081-1/+3
| | | | | | | | | | | This adds _Float16 as a source language type, which is a 16-bit floating point type defined in C11 extension ISO/IEC TS 18661-3. In follow up patches documentation and more tests will be added. Differential Revision: https://reviews.llvm.org/D33719 llvm-svn: 312781
* [libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*Erik Verbruggen2017-08-291-0/+6
| | | | | | | | | | | | | | | | | Looks like this one was forgotten for clang_parseTranslationUnit*, as LIBCLANG_NOTHREADS is checked for/in: clang_saveTranslationUnit() clang_reparseTranslationUnit() clang_codeCompleteAt() clang_indexTranslationUnit() clang_indexSourceFile() Patch by Nikolai Kosjar! Differential Revision: https://reviews.llvm.org/D36821 llvm-svn: 311990
* [index] Add indexing for unresolved-using declarationsBen Langmuir2017-08-161-0/+1
| | | | | | | | | | | In dependent contexts we end up referencing these, so make sure they have USRs, and have their declarations indexed. For the most part they behave like typedefs, but we also need to worry about having multiple using declarations with the same "name". rdar://problem/33883650 llvm-svn: 311053
* [libclang] Determinize order of platform availability attrsReid Kleckner2017-08-041-1/+2
| | | | | | | | | | Previously this code was doing std::sort on IdentifierInfo pointers. Now it sorts alphabetically by platform name. This should de-flake clang/test/Index/availability.c, which was failing non-deterministically for me. llvm-svn: 310138
* [CMake][Modules] libclang: Ignore _CINDEX_LIB_ and CLANG_TOOL_EXTRA_BUILD ↵NAKAMURA Takumi2017-07-311-0/+9
| | | | | | | | | | | | | for -fmodules. CLANG_TOOL_EXTRA_BUILD doesn't affect headers. _CINDEX_LIB_ is defined when the target is SHARED. On Win32, it affects clang-c/Platform.h and it shouldn't be ignored. This is part of https://reviews.llvm.org/D35559 llvm-svn: 309557
* [OPENMP] Codegen for 'in_reduction' clause.Alexey Bataev2017-07-271-0/+2
| | | | | | | | | | | | | | | | | | Added codegen for task-based directive with in_reduction clause. ``` <body> ``` The next code is emitted: ``` void *td; ... td = call i8* @__kmpc_task_reduction_init(); ... <type> *priv = (<type> *)call i8* @__kmpc_task_reduction_get_th_data(i32 GTID, i8* td, i8* <orig>) ``` llvm-svn: 309270
* [OPENMP] Codegen for 'task_reduction' clause.Alexey Bataev2017-07-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added codegen for taskgroup directive with task_reduction clause. ``` <body> ``` The next code is emitted: ``` %struct.kmp_task_red_input_t red_init[n]; void *td; call void @__kmpc_taskgroup(%ident_t id, i32 gtid) ... red_init[i].shar = &<item>; red_init[i].size = sizeof(<item>); red_init[i].init = (void*)initializer_function; red_init[i].fini = (void*)destructor_function; red_init[i].comb = (void*)combiner_function; red_init[i].flags = flags; ... td = call i8* @__kmpc_task_reduction_init(i32 gtid, i32 n, i8* (void*)red_init); call void @__kmpc_end_taskgroup(%ident_t id, i32 gtid) void initializer_function(i8* priv) { *(<type>*)priv = <red_init>; ret void; } void destructor_function(i8* priv) { (<type>*)priv->~(); ret void; } void combiner_function(i8* inout, i8* in) { *(<type>*)inout = *(<type>*)inout <red_id> *(<type>*)in; ret void; } ``` llvm-svn: 308979
* [OPENMP] Initial support for 'in_reduction' clause.Alexey Bataev2017-07-211-0/+17
| | | | | | | Parsing/sema analysis for 'in_reduction' clause for task-based directives. llvm-svn: 308768
* [OPENMP] Initial support for 'task_reduction' clause.Alexey Bataev2017-07-181-0/+17
| | | | | | Parsing/sema analysis of the 'task_reduction' clause. llvm-svn: 308352
* [CMake] Move CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER) into ↵NAKAMURA Takumi2017-07-181-0/+1
| | | | | | | | | | | | | | clang/Config/config.h. LLVM_ENABLE_MODULES is sensitive of -D. Move them into config.h. FIXME: It'd be better that they are #cmakedefine01 rather than #cmakedefine. (#if FOO rather than #if defined(FOO)) Then we can find missing #include "clang/Config/config.h" in the future. Differential Revision: https://reviews.llvm.org/D35527 llvm-svn: 308277
* [AArch64] Add support for __builtin_ms_va_list on aarch64Martin Storsjo2017-07-171-1/+1
| | | | | | | | | | | Move builtins from the x86 specific scope into the global scope. Their use is still limited to x86_64 and aarch64 though. This allows wine on aarch64 to properly handle variadic functions. Differential Revision: https://reviews.llvm.org/D34475 llvm-svn: 308218
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-1/+1
| | | | | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. I will also directly update some extra clang tooling that is broken by the change from Argument to Parameter. Hopefully the bots will stay appeased. Thanks! llvm-svn: 308190
* Revert changes from my previous refactoring - will need to fix dependencies ↵Faisal Vali2017-07-171-1/+1
| | | | | | | | in clang's extra tooling (such as clang-tidy etc.). Sorry about that. llvm-svn: 308158
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-1/+1
| | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. Thanks! llvm-svn: 308157
* [libclang] Support for querying whether an enum is scopedAlex Lorenz2017-07-122-0/+10
| | | | | | | | | | | This commit allows checking whether an enum declaration is scoped through libclang and clang.cindex (Python). Patch by Johann Klähn! Differential Revision: https://reviews.llvm.org/D35187 llvm-svn: 307771
* Revert r307769 (Forgot to mention the name of the contributor).Alex Lorenz2017-07-122-10/+0
| | | | llvm-svn: 307770
* [libclang] Support for querying whether an enum is scopedAlex Lorenz2017-07-122-0/+10
| | | | | | | | | This commit allows checking whether an enum declaration is scoped through libclang and clang.cindex (Python). Differential Revision: https://reviews.llvm.org/D35187 llvm-svn: 307769
* Fix warnings introduced by r307434.Richard Smith2017-07-082-1/+5
| | | | llvm-svn: 307455
* Teach ASTReader how to read only the Preprocessor state from an AST file, ↵Richard Smith2017-06-291-1/+2
| | | | | | | | | not the ASTContext state. We use this when running a preprocessor-only action on an AST file in order to avoid paying the runtime cost of loading the extra information. llvm-svn: 306760
* [libclang] Support for querying the exception specification type through ↵Jonathan Coe2017-06-272-0/+20
| | | | | | | | | | | | | | | | | | | libclang Summary: This patch exposes the exception specification type (noexcept, etc.) of a C++ function through libclang and Python clang.cindex. Reviewers: rsmith, aaron.ballman Reviewed By: aaron.ballman Subscribers: jbcoe, cfe-commits Differential Revision: https://reviews.llvm.org/D34091 Patch by Andrew Bennieston llvm-svn: 306483
* Revert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""Christof Douma2017-06-271-18/+12
| | | | | | | | | | | | | | | | | | | | | | This reverts commit r305688 meaning it reintroduces r305684. To repeat: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. This breaks clang-tidy and clng-query which will be fixed in a commit soon after. Patch by Sanne Wouda Differential Revision: https://reviews.llvm.org/D31709 llvm-svn: 306384
* Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"Christof Douma2017-06-191-12/+18
| | | | | | | This reverts commit 305684. This patch breaks extra/tools/clang-tidy llvm-svn: 305688
* [NFC] Refactor DiagnosticRenderer to use FullSourceLocChristof Douma2017-06-191-18/+12
| | | | | | | | | | | | | | | | Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. Patch by Sanne Wouda Review: https://reviews.llvm.org/D31709 Change-Id: If351a112cdf6718e2d3ef6721b8da9c6376b32dd llvm-svn: 305684
* Recommit r305117: [libclang] Merge multiple availability clauses whenAlex Lorenz2017-06-121-38/+82
| | | | | | | | | | getting the platform's availability Patch by Ronald Wampler! Differential Revision: https://reviews.llvm.org/D33478 llvm-svn: 305221
* Revert r305117Alex Lorenz2017-06-091-82/+38
| | | | | | It caused `Index/availability.c` test failure on Linux llvm-svn: 305122
* [libclang] Merge multiple availability clauses when getting the platform'sAlex Lorenz2017-06-091-38/+82
| | | | | | | | | | availability Patch by Ronald Wampler! Differential Revision: https://reviews.llvm.org/D33478 llvm-svn: 305117
* [libclang] Introduce a new parsing option ↵Argyrios Kyrtzidis2017-06-091-2/+4
| | | | | | | | 'CXTranslationUnit_SingleFileParse' that puts preprocessor in a mode for parsing a single file only. This is useful for parsing a single file, as a fast/inaccurate 'mode' that can still provide declarations from the file, like the classes and their methods. llvm-svn: 305044
* [libclang] Expose typedef and address space functionsSven van Haastregt2017-06-082-0/+24
| | | | | | | | | | | | Expose the following functions: - clang_getTypedefName - clang_getAddressSpace Patch by Simon Perretta. Differential Revision: https://reviews.llvm.org/D33598 llvm-svn: 304978
* [libclang] Allow to suspend a translation unit.Erik Verbruggen2017-05-302-0/+15
| | | | | | | | | | | | | | | | | A suspended translation unit uses significantly less memory but on the other side does not support any other calls than clang_reparseTranslationUnit to resume it or clang_disposeTranslationUnit to dispose it completely. This helps IDEs to reduce the memory footprint. The data that is freed by a call to clang_suspendTranslationUnit will be re-generated on the next (re)parse anyway. Used with a preamble, this allows pretty fast resumption of the translation unit for further use (compared to disposal of the translation unit and a parse from scratch). Patch by Nikolai Kosjar! llvm-svn: 304212
* [Tooling][libclang] Remove unused CompilationDatabase::MappedSourcesKrasimir Georgiev2017-05-231-22/+9
| | | | | | | | | | | | | | | | Summary: This field is never assigned to and it's only ever read from libclang. This patch removes it and adapts libclang to return constants. Reviewers: klimek, bkramer Reviewed By: klimek Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D32351 llvm-svn: 303635
* [libclang] [OpenCL] Expose more OpenCL CIndex typesSven van Haastregt2017-05-231-0/+16
| | | | | | | | | | | | | | Expose pipe, sampler_t, clk_event_t, queue_t, reserve_id_t, and all image types. Update the opencl-types.cl test RUN line such that we can test the OpenCL 2.0 types. Patch by Simon Perretta. Differential Revision: https://reviews.llvm.org/D33197 llvm-svn: 303626
* [index] Fix forward declarations interfering with USR generation of external ↵Argyrios Kyrtzidis2017-05-201-10/+1
| | | | | | | | | source symbols Patch by Nathan Hawes. https://reviews.llvm.org/D33346 llvm-svn: 303484
* [libclang] Introduce clang_Cursor_isExternalSymbol that provides info about ↵Argyrios Kyrtzidis2017-05-102-0/+30
| | | | | | decls marked with external_source_symbol attribute llvm-svn: 302677
* [modules] Round-trip -Werror flag through explicit module build.Richard Smith2017-05-031-1/+1
| | | | | | | | | | | | | | | The intent for an explicit module build is that the diagnostics produced within the module are those that were configured when the module was built, not those that are enabled within a user of the module. This includes diagnostics that don't actually show up until the module is used (for instance, diagnostics produced during template instantiation and weird cases like -Wpadded). We serialized and restored the diagnostic state for individual warning groups, but previously did not track the state for flags like -Werror and -Weverything, which are implemented as separate bits rather than as part of the diagnostics mapping information. llvm-svn: 301992
OpenPOWER on IntegriCloud