summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang
Commit message (Collapse)AuthorAgeFilesLines
...
* Add Attribute NoThrow as an Exception Specifier TypeErich Keane2019-05-301-0/+2
| | | | | | | | | | | | | | | In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became clear that the current mechanism of hacking through checks for the exception specification of a function gets confused really quickly when there are alternate exception specifiers. This patch introcues EST_NoThrow, which is the equivilent of EST_noexcept when caused by EST_noThrow. The existing implementation is left in place to cover functions with no FunctionProtoType. Differential Revision: https://reviews.llvm.org/D62435 llvm-svn: 362119
* [libclang] visit c++14 lambda capture init expressionsNikolai Kosjar2019-05-211-2/+6
| | | | | | | | Patch by Milian Wolff. Differential Revision: https://reviews.llvm.org/D60672 llvm-svn: 361234
* Implement __builtin_LINE() et. al. to support source location capture.Eric Fiselier2019-05-161-0/+1
| | | | | | | | | | | | | | | | | Summary: This patch implements the source location builtins `__builtin_LINE(), `__builtin_FUNCTION()`, `__builtin_FILE()` and `__builtin_COLUMN()`. These builtins are needed to implement [`std::experimental::source_location`](https://rawgit.com/cplusplus/fundamentals-ts/v2/main.html#reflection.src_loc.creation). With the exception of `__builtin_COLUMN`, GCC also implements these builtins, and Clangs behavior is intended to match as closely as possible. Reviewers: rsmith, joerg, aaron.ballman, bogner, majnemer, shafik, martong Reviewed By: rsmith Subscribers: rnkovacs, loskutov, riccibruno, mgorny, kunitoki, alexr, majnemer, hfinkel, cfe-commits Differential Revision: https://reviews.llvm.org/D37035 llvm-svn: 360937
* [libclang] Forward isInline for NamespaceDecl to libclangNikolai Kosjar2019-05-102-0/+9
| | | | llvm-svn: 360428
* [c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whoseRichard Smith2019-05-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | template name is not visible to unqualified lookup. In order to support this without a severe degradation in our ability to diagnose typos in template names, this change significantly restructures the way we handle template-id-shaped syntax for which lookup of the template name finds nothing. Instead of eagerly diagnosing an undeclared template name, we now form a placeholder template-name representing a name that is known to not find any templates. When the parser sees such a name, it attempts to disambiguate whether we have a less-than comparison or a template-id. Any diagnostics or typo-correction for the name are delayed until its point of use. The upshot should be a small improvement of our diagostic quality overall: we now take more syntactic context into account when trying to resolve an undeclared identifier on the left hand side of a '<'. In fact, this works well enough that the backwards-compatible portion (for an undeclared identifier rather than a lookup that finds functions but no function templates) is enabled in all language modes. llvm-svn: 360308
* [libclang] PR41649: Remove pointless duplicate flag. NFC.Nikolai Kosjar2019-05-081-3/+2
| | | | llvm-svn: 360249
* Allow field offset lookups in types with incomplete arrays within libclang.Aaron Ballman2019-05-071-2/+10
| | | | | | Patch thanks to Jorn Vernee llvm-svn: 360147
* Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an ↵Leonard Chan2019-05-071-0/+4
| | | | | | | | attribute declaration" Updated with fix for read of uninitialized memory. llvm-svn: 360109
* [c++20] Implement P1009R2: allow omitting the array bound in an arrayRichard Smith2019-05-061-1/+1
| | | | | | | | | | new expression. This was voted into C++20 as a defect report resolution, so we retroactively apply it to all prior language modes (though it can never actually be used before C++11 mode). llvm-svn: 360006
* Revert "[Attribute/Diagnostics] Print macro if definition is an attribute ↵Leonard Chan2019-05-031-4/+0
| | | | | | | | declaration" This reverts commit fc40cbd9d8c63e65eed3590ba925321afe782e1d. llvm-svn: 359859
* [Attribute/Diagnostics] Print macro if definition is an attribute declarationLeonard Chan2019-05-021-0/+4
| | | | | | | | | | | | | If an address_space attribute is defined in a macro, print the macro instead when diagnosing a warning or error for incompatible pointers with different address_spaces. We allow this for all attributes (not just address_space), and for multiple attributes declared in the same macro. Differential Revision: https://reviews.llvm.org/D51329 llvm-svn: 359826
* [libclang] Add missing export for clang_Cursor_isAnonymousRecordDeclIvan Donchevskii2019-04-291-0/+1
| | | | | | Follow up for D61232 to fix build. llvm-svn: 359453
* [libclang] Restore old clang_Cursor_isAnonymous behaviourIvan Donchevskii2019-04-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | D54996 Changed the behaviour of clang_Cursor_isAnonymous, but there is no alternative available to get the old behaviour in some cases, which is essential for determining if a record is syntactically accessible, e.g. struct { int x; int y; } foo; struct { struct { int x; int y; }; } bar; void fun(struct { int x; int y; } *param); The only 'anonymous' struct here is the one nested in bar, since there is no way to reference the struct itself, only the fields within. Though the anonymity applies to the instance itself, not the type. To avoid confusion, I have added a new function called clang_Cursor_isAnonymousRecordDecl which has the old behaviour of clang_Cursor_isAnonymous (and updated the doc for the latter as well, which was seemingly forgotten). Patch by Jorn Vernee. Differential Revision: https://reviews.llvm.org/D61232 llvm-svn: 359448
* [NFC] test commit removing excess lineNikolai Kosjar2019-04-251-1/+0
| | | | llvm-svn: 359172
* Attempt to fix LLVM_ENABLE_THREADS=OFF build after r358665Nico Weber2019-04-211-0/+2
| | | | llvm-svn: 358858
* [CodeComplete] Remove obsolete isOutputBinary().Sam McCall2019-04-181-3/+2
| | | | | | | | | | | | | | | | Summary: It's never set to true. Its only effect would be to set stdout to binary mode. Hopefully we have better ways of doing this by now :-) Reviewers: hokein Subscribers: jkorous, arphaman, kadircet, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60871 llvm-svn: 358696
* [clang][CIndex] Use llvm::set_thread_priorityKadir Cetinkaya2019-04-181-3/+1
| | | | | | | | | | | | Reviewers: jkorous, gribozavr Subscribers: dexonsmith, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60867 llvm-svn: 358665
* [libclang] Expose ext_vector_typeSven van Haastregt2019-04-171-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D60775 llvm-svn: 358566
* Make SourceManager::createFileID(UnownedTag, ...) take a const ↵Nico Weber2019-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | llvm::MemoryBuffer* Requires making the llvm::MemoryBuffer* stored by SourceManager const, which in turn requires making the accessors for that return const llvm::MemoryBuffer*s and updating all call sites. The original motivation for this was to use it and fix the TODO in CodeGenAction.cpp's ConvertBackendLocation() by using the UnownedTag version of createFileID, and since llvm::SourceMgr* hands out a const llvm::MemoryBuffer* this is required. I'm not sure if fixing the TODO this way actually works, but this seems like a good change on its own anyways. No intended behavior change. Differential Revision: https://reviews.llvm.org/D60247 llvm-svn: 357724
* Range-style std::find{,_if} -> llvm::find{,_if}. NFCFangrui Song2019-03-312-8/+6
| | | | llvm-svn: 357359
* [OPENMP]Initial support for 'allocate' clause.Alexey Bataev2019-03-271-0/+4
| | | | | | Added parsing/sema analysis of the allocate clause. llvm-svn: 357068
* libclang/CIndexer.cpp: Use loadquery() on AIX for path to libraryHubert Tong2019-03-231-0/+59
| | | | | | | | | | | | | | | | | | | Summary: `dladdr` is not available on AIX. Similar functionality is presented through `loadquery`. This patch replaces a use of `dladdr` with a version based on `loadquery`. Reviewers: sfertile, xingxue, jasonliu Reviewed By: xingxue Subscribers: jsji, lhames, majnemer, asb, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59233 llvm-svn: 356843
* [libclang] Expose aligned() attribute.Emilio Cobos Alvarez2019-03-132-0/+3
| | | | | | | | | | | | | | | | | Summary: This is useful because otherwise there's no easy way to distinguish #pragma packed(N) from attribute(packed, aligned(N)) that isn't looking at field offsets (since pragma packed() also creates a packed attribute). Reviewers: Anastasia, arphaman, serge-sans-paille Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59299 llvm-svn: 356062
* [OPENMP 5.0]Initial support for 'allocator' clause.Alexey Bataev2019-03-121-0/+4
| | | | | | | Added parsing/sema analysis/serialization/deserialization for the 'allocator' clause of the 'allocate' directive. llvm-svn: 355952
* [OPENMP 5.0]Add initial support for 'allocate' directive.Alexey Bataev2019-03-071-0/+1
| | | | | | | Added parsing/sema analysis/serialization/deserialization support for 'allocate' directive. llvm-svn: 355614
* [libclang] Fix CXTranslationUnit_KeepGoingIvan Donchevskii2019-03-071-1/+1
| | | | | | | | | | | | | | | | | | Since commit 56f548bbbb7e4387a69708f70724d00e9e076153 [modules] Round-trip -Werror flag through explicit module build. the behavior of CXTranslationUnit_KeepGoing changed: Unresolved #includes are fatal errors again. As a consequence, some templates are not instantiated and lead to confusing errors. Revert to the old behavior: With CXTranslationUnit_KeepGoing fatal errors are mapped to errors. Patch by Nikolai Kosjar. Differential Revision: https://reviews.llvm.org/D58501 llvm-svn: 355586
* [clang][OpenMP] Revert "OMPFlushClause is synthetic, no such clause exists"Roman Lebedev2019-03-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This reverts rL352390 / D57280. As discussed in https://reviews.llvm.org/D57112#inline-506781, 'flush' clause does not exist in the OpenMP spec, it can not be specified, and `OMPFlushClause` class is just a helper class. Now, here's the caveat. I have read @ABataev's > Well, I think it would be good to filter out OMPC_flush somehow > because there is no such clause actually, it is a pseudo clause > for better handling of the flush directive. as if that clause is pseudo clause that only exists for the sole purpose of simplifying the parser. As in, it never reaches AST. I did not however try to verify that. Too bad, i was wrong. It absolutely *does* reach AST. Therefore my understanding/justification for the change was flawed, which makes the patch a regression which **must** be reverted. @gribozavr has brought that up again in https://reviews.llvm.org/D57112#inline-521238 > > ... > Sorry to be late for this discussion, but I don't think this conclusion > follows. ASTMatchers are supposed to match the AST as it is. > Even if OMPC_flush is synthetic, it exists in the AST, and users might > want to match it. I think users would find anything else (trying to filter > out AST nodes that are not in the source code) to be surprising. For example, > there's a matcher materializeTemporaryExpr even though this AST node is a > Clang invention and is not a part of the C++ spec. > > Matching only constructs that appear in the source code is not feasible with > ASTMatchers, because they are based on Clang's AST that exposes tons of semantic > information, and its design is dictated by the structure of the semantic information. > See "RFC: Tree-based refactorings with Clang" in cfe-dev for a library that will > focus on representing source code as faithfully as possible. > > Not to even mention that this code is in ASTTypeTraits, a general library for > handling AST nodes, not specifically for AST Matchers... Reviewers: gribozavr, ABataev, rjmccall, aaron.ballman Reviewed By: gribozavr, ABataev Subscribers: dylanmckay, guansong, arphaman, jdoerfert, cfe-commits, gribozavr, ABataev Tags: #clang, #openmp Differential Revision: https://reviews.llvm.org/D58979 llvm-svn: 355486
* [build] Rename clang-headers to clang-resource-headersShoaib Meenai2019-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The current install-clang-headers target installs clang's resource directory headers. This is different from the install-llvm-headers target, which installs LLVM's API headers. We want to introduce the corresponding target to clang, and the natural name for that new target would be install-clang-headers. Rename the existing target to install-clang-resource-headers to free up the install-clang-headers name for the new target, following the discussion on cfe-dev [1]. I didn't find any bots on zorg referencing install-clang-headers. I'll send out another PSA to cfe-dev to accompany this rename. [1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits Tags: #clang, #sanitizers, #lldb, #openmp, #llvm Differential Revision: https://reviews.llvm.org/D58791 llvm-svn: 355340
* Fix file headers. NFCFangrui Song2019-03-016-28/+27
| | | | llvm-svn: 355176
* [libclang] Avoid crashing when getting layout info of an undeduced type.Emilio Cobos Alvarez2019-02-261-0/+6
| | | | | | | | | | When the type is not deducible, return an error instead of crashing. This fixes https://bugs.llvm.org/show_bug.cgi?id=40813. Differential Revision: https://reviews.llvm.org/D58569 llvm-svn: 354885
* [libclang] Expose warn_unused and warn_unused_result attributes.Emilio Cobos Alvarez2019-02-252-0/+6
| | | | | | | | | This is helpful to properly detect them, and fixing issues like https://github.com/rust-lang/rust-bindgen/issues/1518. Differential Revision: https://reviews.llvm.org/D58570 llvm-svn: 354824
* [clang] Switch to LLVM_ENABLE_IDEShoaib Meenai2019-02-201-2/+2
| | | | | | | | | | | | r344555 switched LLVM to guarding install targets with LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPES, which expresses the intent more directly and can be overridden by a user. Make the corresponding change in clang. LLVM_ENABLE_IDE is computed by HandleLLVMOptions, so it should be available for both standalone and integrated builds. Differential Revision: https://reviews.llvm.org/D58284 llvm-svn: 354525
* [libclang] Add attribute support for 'convergent'.Sven van Haastregt2019-02-112-1/+4
| | | | | | | | | | This bumps CINDEX_VERSION_MINOR up (to 51). Patch by Hsin-Hsiao Lin. Differential Revision: https://reviews.llvm.org/D57946 llvm-svn: 353690
* [OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.Michael Kruse2019-02-011-0/+1
| | | | | | | | | | | | | | | | | This patch implements parsing and sema for "omp declare mapper" directive. User defined mapper, i.e., declare mapper directive, is a new feature in OpenMP 5.0. It is introduced to extend existing map clauses for the purpose of simplifying the copy of complex data structures between host and device (i.e., deep copy). An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(struct S s) map(s, s.d[0:s.len]) // Memory region that d points to is also mapped using this mapper. Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D56326 llvm-svn: 352906
* [libclang] Fix -DBUILD_SHARED_LIBS=on build after rC352803Fangrui Song2019-02-011-0/+1
| | | | llvm-svn: 352872
* Make clang/test/Index/pch-from-libclang.c pass in more placesNico Weber2019-01-311-5/+4
| | | | | | | | | | | | | | | - fixes the test on macOS with LLVM_ENABLE_PIC=OFF - together with D57343, gets the test to pass on Windows - makes it run everywhere (it seems to just pass on Linux) The main change is to pull out the resource directory computation into a function shared by all 3 places that do it. In CIndexer.cpp, this now works no matter if libclang is in lib/ or bin/ or statically linked to a binary in bin/. Differential Revision: https://reviews.llvm.org/D57345 llvm-svn: 352803
* [clang][OpenMP] OMPFlushClause is synthetic, no such clause existsRoman Lebedev2019-01-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed in https://reviews.llvm.org/D57112#inline-506781, 'flush' clause does not exist in the OpenMP spec, it can not be specified, and `OMPFlushClause` class is just a helper class. Therefore `OPENMP_CLAUSE()` in `clang/Basic/OpenMPKinds.def` should not contain 'flush' "clause". I have simply removed the `OPENMP_CLAUSE(flush, OMPFlushClause)` from `clang/Basic/OpenMPKinds.def`, grepped for `OPENMP_CLAUSE` and added `OPENMP_CLAUSE(flush, OMPFlushClause)` back to the **every** place where `OPENMP_CLAUSE` is defined and `clang/Basic/OpenMPKinds.def` is then included. So as-is, this patch is a NFC. Possibly, some of these `OPENMP_CLAUSE(flush, OMPFlushClause)` should be dropped, i don't really know. Test plan: `ninja check-clang` Reviewers: ABataev Reviewed By: ABataev Subscribers: guansong, arphaman, cfe-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D57280 llvm-svn: 352390
* Rename getTypeQualifiers to getMethodQualifiers.Anastasia Stulova2019-01-281-1/+1
| | | | | | | | Use more descriptive name for the method qualifiers getter. Differential Revision: https://reviews.llvm.org/D56792 llvm-svn: 352349
* Attempt to fix build on Windows with LLVM_ENABLE_PIC=OFFNico Weber2019-01-251-1/+1
| | | | | | | | | | | | | | libclang can be built in shared or static mode. On Windows, with LLVM_ENABLE_PIC=OFF, it was built in neither mode, leading to clients of libclang (c-index-test, c-arcmt-test) failing to link with it set. Since PIC isn't really a thing on Windows, build libclang in shared mode when LLVM_ENABLE_PIC=OFF there. This is also somewhat symmetric with the existing ENABLE_STATIC a few lines down. Differential Revision: https://reviews.llvm.org/D57258 llvm-svn: 352253
* [Sema] Fix Modified Type in address_space AttributedTypeLeonard Chan2019-01-241-1/+3
| | | | | | | | | | | This is a fix for https://reviews.llvm.org/D51229 where we pass the address_space qualified type as the modified type of an AttributedType. This change now instead wraps the AttributedType with either the address_space qualifier or a DependentAddressSpaceType. Differential Revision: https://reviews.llvm.org/D55447 llvm-svn: 351997
* Replace llvm::isPodLike<...> by llvm::is_trivially_copyable<...>Serge Guelton2019-01-201-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in https://bugs.llvm.org/show_bug.cgi?id=36651, the specialization for isPodLike<std::pair<...>> did not match the expectation of std::is_trivially_copyable which makes the memcpy optimization invalid. This patch renames the llvm::isPodLike trait into llvm::is_trivially_copyable. Unfortunately std::is_trivially_copyable is not portable across compiler / STL versions. So a portable version is provided too. Note that the following specialization were invalid: std::pair<T0, T1> llvm::Optional<T> Tests have been added to assert that former specialization are respected by the standard usage of llvm::is_trivially_copyable, and that when a decent version of std::is_trivially_copyable is available, llvm::is_trivially_copyable is compared to std::is_trivially_copyable. As of this patch, llvm::Optional is no longer considered trivially copyable, even if T is. This is to be fixed in a later patch, as it has impact on a long-running bug (see r347004) Note that GCC warns about this UB, but this got silented by https://reviews.llvm.org/D50296. Differential Revision: https://reviews.llvm.org/D54472 llvm-svn: 351701
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1932-128/+100
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [libclang] Fix clang_Cursor_isAnonymousIvan Donchevskii2019-01-101-3/+7
| | | | | | | | Use the same logic as in TypePrinter::printTag to determine that the tag is anonymous and the separate check for namespaces. Differential Revision: https://reviews.llvm.org/D54996 llvm-svn: 350805
* [libclang] Fix the mismatched delete operator for ExprEvalResultAlex Lorenz2019-01-081-1/+1
| | | | | | | | The '.stringVal' field in ExprEvalResult is allocated using new[], but was freed using a regular delete. That caused memory leaks in the test from r350666. llvm-svn: 350680
* [libclang] Recommit r336590 with a fix for the memory leak in the testAlex Lorenz2019-01-081-24/+23
| | | | | | | | | | | | | | | | | | | | | | | | The original commit had a memory leak in the test has a leak as it doesn't dispose of the evaluated cursor result. This also contains the follow-up NFC refactoring commit r336591. rdar://45893054 Original commit message: [libclang] evalute compound statement cursors before trying to evaluate the cursor like a declaration This change fixes a bug in libclang in which it tries to evaluate a statement cursor as a declaration cursor, because that statement still has a pointer to the declaration parent. rdar://38888477 Differential Revision: https://reviews.llvm.org/D49051 llvm-svn: 350666
* [libclang] CoroutineBody/Coreturn statements are UnexposedStmts and not ExprsAlex Lorenz2019-01-031-3/+6
| | | | | | | | | | | | | This change ensures that the libclang CXCursor represents the CoroutineBody and the Coreturn statement using the appropriate CXCursor_UnexposedStmt kind instead of CXCursor_UnexposedExpr. The problem with CXCursor_UnexposedExpr is that the consumer functions assumed that CoroutineBody/Coreturn statements were valid expressions and performed an invalid downcast to Expr causing assertion failures or other crashes. rdar://40204290 llvm-svn: 350282
* [AST] Unify the code paths of traversing lambda expressions.Haojian Wu2018-12-181-17/+11
| | | | | | | | | | | | | | | | | | | | | | Summary: This supposes to be a non-functional change. We have two code paths when traversing lambda expressions: 1) traverse the function proto typeloc when parameters and return type are explicit; 2) otherwise fallback to traverse parameter decls and return type loc individually; This patch unifies the code path to always traverse parameters and return type, rather than relying on traversing the full type-loc. Reviewers: ilya-biryukov Subscribers: arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55820 llvm-svn: 349494
* [libclang] Add dependency on clangSerialization to unbreak ↵Fangrui Song2018-12-151-0/+1
| | | | | | | | -DBUILD_SHARED_LIBS=1 build after rC349237 Frontend headers have undefined reference on the symbol `clang::PCHContainerOperations::PCHContainerOperations()` through some shared_ptr usage. Any dependents will get the undefined reference which can only be resolved by explicit dependency on clangSerialization (due to -z defs). llvm-svn: 349259
* Fix includes and dependencies for libclangRichard Trieu2018-12-155-6/+1
| | | | | | | | Remove unneeded includes Add needed include Remove dependency on Serialization llvm-svn: 349237
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-131-1/+1
| | | | | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Note: This recommits the previously reverted patch, but now it is commited together with a fix for lldb. Differential Revision: https://reviews.llvm.org/D54862 llvm-svn: 349019
OpenPOWER on IntegriCloud