summaryrefslogtreecommitdiffstats
path: root/clang/include
Commit message (Collapse)AuthorAgeFilesLines
...
* [lldb][modern-type-lookup] No longer import temporary declarations into the ↵Raphael Isemann2019-10-041-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | persistent AST Summary: As we figured out in D67803, importing declarations from a temporary ASTContext that were originally from a persistent ASTContext causes a bunch of duplicated declarations where we end up having declarations in the target AST that have no associated ASTImporter that can complete them. I haven't figured out how/if we can solve this in the current way we do things in LLDB, but in the modern-type-lookup this is solvable as we have a saner architecture with the ExternalASTMerger. As we can (hopefully) make modern-type-lookup the default mode in the future, I would say we try fixing this issue here. As we don't use the hack that was reinstated in D67803 during modern-type-lookup, the test case for this is essentially just printing any kind of container in `std::` as we would otherwise run into the issue that required a hack like D67803. What this patch is doing in essence is that instead of importing a declaration from a temporary ASTContext, we instead check if the declaration originally came from a persistent ASTContext (e.g. the debug information) and we directly import from there. The ExternalASTMerger is already connected with ASTImporters to these different sources, so this patch is essentially just two parts: 1. Mark our temporary ASTContext/ImporterSource as temporary when we import from the expression AST. 2. If the ExternalASTMerger sees we import from the expression AST, instead of trying to import these temporary declarations, check if we can instead import from the persistent ASTContext that is already connected. This ensures that all records from the persistent source actually come from the persistent source and are minimally imported in a way that allows them to be completed later on in the target AST. The next step is to run the ASTImporter for these temporary expressions with the MinimalImport mode disabled, but that's a follow up patch. This patch fixes most test failures with modern-type-lookup enabled by default (down to 73 failing tests, which includes the 22 import-std-module tests which need special treatment). Reviewers: shafik, martong Reviewed By: martong Subscribers: aprantl, rnkovacs, christof, abidh, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68326 llvm-svn: 373711
* [clang-format] [PR43333] Fix C# breaking before function name when using ↵Paul Hoad2019-10-041-32/+36
| | | | | | | | | | | | | | | | | | | | | | | | | Attributes Summary: This is a fix for https://bugs.llvm.org/show_bug.cgi?id=43333 This comes with 3 main parts - C# attributes cause function names on a new line even when AlwaysBreakAfterReturnType is set to None - Add AlwaysBreakAfterReturnType to None by default in the Microsoft style, - C# unit tests are not using Microsoft style (which we created to define the default C# style to match a vanilla C# project). Reviewers: owenpan, klimek, russellmcc, mitchell-stellar Reviewed By: mitchell-stellar Subscribers: cfe-commits Tags: #clang-tools-extra, #clang, #clang-format Differential Revision: https://reviews.llvm.org/D67629 llvm-svn: 373707
* Properly handle instantiation-dependent array bounds.Richard Smith2019-10-043-45/+50
| | | | | | | | | We previously failed to treat an array with an instantiation-dependent but not value-dependent bound as being an instantiation-dependent type. We now track the array bound expression as part of a constant array type if it's an instantiation-dependent expression. llvm-svn: 373685
* OverloadCandidate::getNumParams - silence static analyzer ↵Simon Pilgrim2019-10-031-2/+2
| | | | | | | | | | getAs<FunctionProtoType> null dereference warning. NFCI. The static analyzer is warning about a potential null dereference, but we should be able to use castAs<FunctionProtoType> directly and if not assert will fire for us. Also replaces an auto to make the type more obvious. llvm-svn: 373665
* [HIP] Use option -nogpulib to disable linking device libYaxun Liu2019-10-031-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D68300 llvm-svn: 373649
* Check for qualified function types after substituting into the operandRichard Smith2019-10-032-0/+4
| | | | | | | | | | of 'typeid'. This is a rare place where it's valid for a function type to be substituted but not valid for a qualified function type to be substituted, so needs a special check. llvm-svn: 373648
* [clang-format] Add ability to wrap braces after multi-line control statementsPaul Hoad2019-10-031-17/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Change the BraceWrappingFlags' AfterControlStatement from a bool to an enum with three values: * "Never": This is the default, and does not do any brace wrapping after control statements. * "MultiLine": This only wraps braces after multi-line control statements (this really only happens when a ColumnLimit is specified). * "Always": This always wraps braces after control statements. The first and last options are backwards-compatible with "false" and "true", respectively. The new "MultiLine" option is useful for when a wrapped control statement's indentation matches the subsequent block's indentation. It makes it easier to see at a glance where the control statement ends and where the block's code begins. For example: ``` if ( foo && bar ) { baz(); } ``` vs. ``` if ( foo && bar ) { baz(); } ``` Short control statements (1 line) do not wrap the brace to the next line, e.g. ``` if (foo) { bar(); } else { baz(); } ``` Reviewers: sammccall, owenpan, reuk, MyDeveloperDay, klimek Reviewed By: MyDeveloperDay Subscribers: MyDeveloperDay, cfe-commits Patch By: mitchell-stellar Tags: #clang-format, #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D68296 llvm-svn: 373647
* [NFC] Added missing changes for rL373614David Bolvansky2019-10-031-0/+3
| | | | llvm-svn: 373616
* [libTooling] Add various Stencil combinators for expressions.Yitzhak Mandelbaum2019-10-031-1/+16
| | | | | | | | | | | | | | | | | | | Summary: This revision adds three new Stencil combinators: * `expression`, which idiomatically constructs the source for an expression, including wrapping the expression's source in parentheses if needed. * `deref`, which constructs an idiomatic dereferencing expression. * `addressOf`, which constructs an idiomatic address-taking expression. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68315 llvm-svn: 373593
* [Alignment][Clang][NFC] Add CharUnits::getAsAlignGuillaume Chatelet2019-10-031-0/+5
| | | | | | | | | | | | | | | | | | Summary: This is a prerequisite to removing `llvm::GlobalObject::setAlignment(unsigned)`. This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: jholewinski, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68274 llvm-svn: 373592
* [clang][NFC] Fix misspellings in ExternalASTMerger.hRaphael Isemann2019-10-031-4/+4
| | | | llvm-svn: 373577
* Revert 373538 and follow-ups 373549 and 373552.Nico Weber2019-10-035-21/+2
| | | | | | They break tests on (at least) macOS. llvm-svn: 373556
* For P0784R7: support placement new-expressions in constant evaluation.Richard Smith2019-10-031-15/+29
| | | | | | | | | For now, we restrict this support to use from within the standard library implementation, since we're required to make parts of the standard library that use placement new work, but not permitted to make uses of placement new from user code work. llvm-svn: 373547
* For P0784R7: allow direct calls to operator new / operator delete fromRichard Smith2019-10-031-2/+13
| | | | | | std::allocator::{allocate,deallocate} in constant evaluation. llvm-svn: 373546
* [clang][ifs] Clang Interface Stubs ToolChain plumbing.Puyan Lotfi2019-10-025-2/+21
| | | | | | | | | | | | | | | | | | | | | This patch enables end to end support for generating ELF interface stubs directly from clang. Now the following: clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp will product an ELF binary with visible symbols populated. Visibility attributes and -fvisibility can be used to control what gets populated. * Adding ToolChain support for clang Driver IFS Merge Phase * Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain * Adds support for the clang Driver to involve llvm-ifs on ifs files. * Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file instead of the final object format (normally ELF) Differential Revision: https://reviews.llvm.org/D63978 llvm-svn: 373538
* [OPENMP50]Add parsing/sema analysis for declare variant score.Alexey Bataev2019-10-022-2/+20
| | | | | | | | Context selectors may include optional score clause in format `score(<expr>):`, where `<expr>` must be a constant integer expression. Added parsing/sema analysis only. llvm-svn: 373502
* [clang-rename] Better renaming the typedef decl.Haojian Wu2019-10-021-1/+11
| | | | | | | | | | | | | | Summary: when renaming a typedef decl, we used to rename the underlying decl of the typedef, we should rename the typedef itself. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68322 llvm-svn: 373440
* [ClangFormat] Future-proof Standard option, allow floating or pinning to ↵Sam McCall2019-10-021-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arbitrary lang version Summary: The historical context: - clang-format was written when C++11 was current, and the main language-version concern was >> vs > > template-closers. An option was added to allow selection of the 03/11 behavior, or auto-detection. - there was no option to choose simply "latest standard" so anyone who didn't ever want 03 behavior or auto-detection specified Cpp11. - In r185149 this option started to affect lexer mode. - no options were added to cover c++14, as parsing/formatting didn't change that much. The usage of Cpp11 to mean "latest" became codified e.g. in r206263 - c++17 added some new constructs. These were mostly backwards-compatible and so not used in old programs, so having no way to turn them off was OK. - c++20 added some new constructs and keywords (e.g. co_*) that changed the meaning of existing programs, and people started to complain that the c++20 parsing couldn't be turned off. New plan: - Default ('Auto') behavior remains unchanged: parse as latest, format template-closers based on input. - Add new 'Latest' option that more clearly expresses the intent "use modern features" that many projects have chosen for their .clang-format files. - Allow pinning to *any* language version, using the same name as clang -std: c++03, c++11, c++14 etc. These set precise lexer options, and any clang-format code depending on these can use a >= check. - For backwards compatibility, `Cpp11` is an alias for `Latest`, not `c++11`. This matches the historical documented semantics of this option. This spelling (and `Cpp03`) are deprecated. Reviewers: klimek, modocache Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67541 llvm-svn: 373439
* Rename TypeNodes.def to TypeNodes.inc for consistency across allJohn McCall2019-10-028-16/+16
| | | | | | | | our autogenerated files. NFC. As requested by Nico Weber. llvm-svn: 373425
* Remove TypeNodes.def from the modulemap.John McCall2019-10-021-1/+0
| | | | | | | | | | | | | | | | | We currently just look for files named in the modulemap in its associated source directory. This means that we can't name generated files, like TypeNodes.def now is, which means we can't explicitly mark it as textual. But fortunately that's okay because (as I understand it) the most important purpose of naming the header in the modulemap is to ensure that it's not treated as public, and the search for public headers also only considers files in the associated source directory. This isn't an elegant solution, since among other things it means that a build which wrote the generated files directly into the source directory would result in something that wouldn't build as a module, but that's a problem for all our other generated files as well. llvm-svn: 373416
* Emit TypeNodes.def with tblgen.John McCall2019-10-014-138/+112
| | | | | | | | | | | | | | | | | | The primary goal here is to make the type node hierarchy available to other tblgen backends, although it should also make it easier to generate more selective x-macros in the future. Because tblgen doesn't seem to allow backends to preserve the source order of defs, this is not NFC because it significantly re-orders IDs. I've fixed the one (fortunately obvious) place where we relied on the old order. Unfortunately, I wasn't able to share code with the existing AST-node x-macro generators because the x-macro schema we use for types is different in a number of ways. The main loss is that subclasses aren't ordered together, which doesn't seem important for types because the hierarchy is generally very shallow with little clustering. llvm-svn: 373407
* [Diagnostics] Make -Wenum-compare-conditional off by defaultDavid Bolvansky2019-10-012-2/+2
| | | | | | Too many false positives, eg. in Chromium. llvm-svn: 373371
* [Diagnostics] Move warning into the subgroup (-Wenum-compare-conditional)David Bolvansky2019-10-012-2/+3
| | | | llvm-svn: 373345
* [clang][lldb][NFC] Encapsulate ExternalASTMerger::ImporterSourceRaphael Isemann2019-10-011-1/+8
| | | | | | NFC preparation work for upcoming ExternalASTMerger patches. llvm-svn: 373312
* Fix crash on value-dependent delete-expressions.Richard Smith2019-09-301-2/+2
| | | | | | | We used to miscompute the 'value-dependent' bit, and would crash if we tried to evaluate a delete expression that should be value-dependent. llvm-svn: 373272
* [OPENMP50]Mark declare variant attribute as inheritable.Alexey Bataev2019-09-301-1/+2
| | | | | | Attribute must be inherited by the redeclarations. llvm-svn: 373257
* Teach CallGraph to look into Generic Lambdas.Erich Keane2019-09-302-0/+8
| | | | | | | | | | | | | | | | | | | | CallGraph visited LambdaExpr by getting the Call Operator from CXXRecordDecl (LambdaExpr::getCallOperator calls CXXRecordDecl::getLambdaCallOperator), which replaced generic lambda call operators with the non-instantiated FunctionDecl. The result was that the CallGraph would only pick up non-dependent calls. This patch does a few things: 1- Extend CXXRecordDecl to have a getDependentLambdaCallOperator, which will get the FunctionTemplateDecl, rather than immediately getting the TemplateDecl. 2- Define getLambdaCallOperator and getDependentLambdaCallOperator in terms of a common function. 3- Extend LambdaExpr with a getDependentCallOperator, which just calls the above function. 4- Changes CallGraph to handle Generic LambdaExprs. llvm-svn: 373247
* [Clang] Use -main-file-name for source filename if not setTeresa Johnson2019-09-301-1/+1
| | | | | | | | | | | | | | | | | | | -main-file-name is currently used to set the source name used in debug information. If the source filename is "-" and -main-file-name is set, then use the filename also for source_filename and ModuleID of the output. The argument is generally used outside the internal clang calls when running clang in a wrapper like icecc which gives the source via stdin but still wants to get a object file with the original source filename both in debug info and IR code. Patch by: the_jk (Joel Klinghed) Differential Revision: https://reviews.llvm.org/D67592 llvm-svn: 373217
* Correct function declarations; NFC.Aaron Ballman2019-09-301-2/+2
| | | | | | This header is included by C code so the functions need to have a prototype. Also, fix the function definitions so that they have C linkage rather than C++ linkage. llvm-svn: 373213
* DeclCXX/ExprCXX - silence static analyzer getAs<> null dereference warnings. ↵Simon Pilgrim2019-09-302-5/+4
| | | | | | | | NFCI. The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373198
* [lldb][clang][modern-type-lookup] Use ASTImporterSharedState in ↵Raphael Isemann2019-09-301-0/+6
| | | | | | | | | | | | | | | | | | ExternalASTMerger Summary: The ExternalASTMerger should use the ASTImporterSharedState. This allows it to handle std::pair in LLDB (but the rest of libc++ is still work in progress). Reviewers: martong, shafik, a.sidorin Subscribers: rnkovacs, christof, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68140 llvm-svn: 373193
* For now, disallow lifetime-extended temporaries with non-trivial (butRichard Smith2019-09-291-0/+3
| | | | | | | | | | | | constexpr) destructors from being used in the values of constexpr variables. The standard rules here are unclear at best, so rejecting the problematic cases seems prudent. Prior to this change, we would fail to run the destructors for these temporaries, even if they had side-effects, which is certainly not the right behavior. llvm-svn: 373161
* For P0784R7: compute whether a variable has constant destruction if itRichard Smith2019-09-293-6/+30
| | | | | | | | | | has a constexpr destructor. For constexpr variables, reject if the variable does not have constant destruction. In all cases, do not emit runtime calls to the destructor for variables with constant destruction. llvm-svn: 373159
* For P0784R7: add support for explicit destructor calls andRichard Smith2019-09-271-14/+21
| | | | | | pseudo-destructor calls in constant evaluation. llvm-svn: 373122
* [libTooling] Transformer: refine `SourceLocation` specified as anchor of ↵Yitzhak Mandelbaum2019-09-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | | changes. Summary: Every change triggered by a rewrite rule is anchored at a particular location in the source code. This patch refines how that location is chosen and defines it as an explicit function so it can be shared by other Transformer implementations. This patch was inspired by a bug found by a clang tidy, wherein two changes were anchored at the same location (the expansion loc of the macro) resulting in the discarding of the second change. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66652 llvm-svn: 373093
* [OpenCL] Pass LangOptions as const refSven van Haastregt2019-09-271-3/+3
| | | | llvm-svn: 373088
* [clang] [AST] Treat "inline gnu_inline" the same way as "extern inline ↵Martin Storsjo2019-09-271-0/+4
| | | | | | | | | | | | | | | | | gnu_inline" in C++ mode This matches how GCC handles it, see e.g. https://gcc.godbolt.org/z/HPplnl. GCC documents the gnu_inline attribute with "In C++, this attribute does not depend on extern in any way, but it still requires the inline keyword to enable its special behavior." The previous behaviour of gnu_inline in C++, without the extern keyword, can be traced back to the original commit that added support for gnu_inline, SVN r69045. Differential Revision: https://reviews.llvm.org/D67414 llvm-svn: 373078
* Revert r373034Nicholas Allegra2019-09-271-2/+1
| | | | | | It breaks the build on MSVC. llvm-svn: 373039
* For P0784R7: add support for new (std::nothrow).Richard Smith2019-09-271-0/+1
| | | | llvm-svn: 373037
* For P0784R7: Add support for dynamic allocation with new / delete duringRichard Smith2019-09-272-1/+89
| | | | | | constant evaluation. llvm-svn: 373036
* [Consumed][NFC] Refactor handleCall to take function argument list.Nicholas Allegra2019-09-261-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D67569 llvm-svn: 373034
* [OPENMP50]Emit warnings if the functions was defined/used before markedAlexey Bataev2019-09-261-2/+5
| | | | | | | | | declare variant. We can use the original function if it was used/emitted already. So, just use warnings for these cases, not errors. llvm-svn: 373010
* [analyzer] Avoid small vectors of non-default-constructibles.Artem Dergachev2019-09-261-1/+1
| | | | | | Unconfuses certain compilers. llvm-svn: 372942
* [libTooling] Add `run` combinator to Stencils.Yitzhak Mandelbaum2019-09-261-0/+5
| | | | | | | | | | | | | | | | Summary: This revision adds `run`, a StencilPart that runs a user-defined function that computes a result over `MatchFinder::MatchResult`. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67969 llvm-svn: 372936
* Simplify -fms-compatibility include lookup logic, NFCReid Kleckner2019-09-251-1/+1
| | | | | | | | | | | This include search logic has an extra parameter to deal with Windows includes with backslashes, which get normalized to forward slashes on non-Windows under -fms-compatibility. Hoist the conditional operator out of LookupHeaderIncludeOrImport and pass the result in instead of repeating the ?: expression everywhere. llvm-svn: 372926
* [clang-format] Modified SortIncludes and IncludeCategories to priority for ↵Paul Hoad2019-09-252-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | sorting #includes within the Group Category. Summary: This new Style rule is made as a part of adding support for NetBSD KNF in clang-format. NetBSD have it's own priority of includes which should be followed while formatting NetBSD code. This style sorts the Cpp Includes according to the priorities of NetBSD, as mentioned in the [Style Guide](http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style?rev=HEAD&content-type=text/x-cvsweb-markup) The working of this Style rule shown below: **Configuration:** This revision introduces a new field under IncludeCategories named `SortPriority` which defines the priority of ordering the `#includes` and the `Priority` will define the categories for grouping the `#include blocks`. Reviewers: cfe-commits, mgorny, christos, MyDeveloperDay Reviewed By: MyDeveloperDay Subscribers: lebedev.ri, rdwampler, christos, mgorny, krytarowski Patch By: Manikishan Tags: #clang, #clang-format Differential Revision: https://reviews.llvm.org/D64695 llvm-svn: 372919
* [OPENMP50]Parsing/sema support for 'implementation/vendor' contextAlexey Bataev2019-09-255-11/+75
| | | | | | | | | selector. Added basic parsing/semantic support for 'implementation={vendor(<vendor>)}' context selector. llvm-svn: 372917
* [Mangle] Add flag to asm labels to disable '\01' prefixingVedant Kumar2019-09-252-2/+42
| | | | | | | | | | | | | | LLDB synthesizes decls using asm labels. These decls cannot have a mangle different than the one specified in the label name. I.e., the '\01' prefix should not be added. Fixes an expression evaluation failure in lldb's TestVirtual.py on iOS. rdar://45827323 Differential Revision: https://reviews.llvm.org/D67774 llvm-svn: 372903
* Re-land r372863: [AST] Extract Decl::printNestedNameSpecifier helper from ↵Ilya Biryukov2019-09-251-0/+8
| | | | | | | | | | Decl::printQualifiedName Reverted in r372880 due to the test failure. Also contains a fix that adjusts printQualifiedName to return the same results as before in case of anonymous function locals and parameters. llvm-svn: 372889
* [NFC] Fix typo in `getPreviousDecl` comment.Yitzhak Mandelbaum2019-09-251-1/+1
| | | | llvm-svn: 372884
OpenPOWER on IntegriCloud