summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
* PR45083: Mark statement expressions as being dependent if they appear inRichard Smith2020-03-122-0/+2
| | | | | | | | | | | | | | | | a dependent context. This matches the GCC behavior. We track the enclosing template depth when determining whether a statement expression is within a dependent context; there doesn't appear to be any other reliable way to determine this. We previously assumed they were neither value- nor instantiation-dependent under any circumstances, which would lead to crashes and other misbehavior. (cherry picked from commit 5c845c1c50ac89a6f12557d1571678f3d1432478)
* [Concepts] Add constraints checks to isSameEntitySaar Raz2020-03-101-6/+61
| | | | | | | | | isSameEntity was missing constraints checking, causing constrained overloads to not travel well accross serialization. (bug #45115) Add constraints checking to isSameEntity. (cherry picked from commit 7fb562c1ab373a3d4e14003e40556791ec032bab)
* [Concepts] Add FoundDecl to ConceptSpecializationExpr serializationSaar Raz2020-03-102-0/+2
| | | | | | FoundDecl was missing from ConceptSpecializationExpr serialization - add it. (cherry picked from commit f9e63891597630405a4655298f06b193e4ceb384)
* Revert "make -fmodules-codegen and -fmodules-debuginfo work also with PCHs"Hans Wennborg2020-02-274-27/+11
| | | | | | | | This caused PR44953. See also the discussion on D74846. This reverts commit cbc9d22e49b434b6ceb2eb94b67079d02e0a7b74. (cherry picked from commit 7ea9a6e0220da36ff2fd1fbc29c2755be23e5166)
* Fix a reentrance bug with deserializing ObjC type parameters.John McCall2020-02-131-1/+1
| | | | | | | | | | | | | This is a longstanding bug that seems to have been hidden by a combination of (1) the normal flow being to deserialize the interface before deserializing its parameter and (2) a precise ordering of work that was apparently recently disturbed, perhaps by my abstract-serialization work or Bruno's ObjC module merging work. Fixes rdar://59153545. (cherry picked from commit 77b2ffc498e92cce7546d191f6712a3046300501)
* [Concepts] Placeholder constraints and abbreviated templatesSaar Raz2020-01-244-7/+42
| | | | | | | | | | | | | | | | | | | | | | | This patch implements P1141R2 "Yet another approach for constrained declarations". General strategy for this patch was: - Expand AutoType to include optional type-constraint, reflecting the wording and easing the integration of constraints. - Replace autos in parameter type specifiers with invented parameters in GetTypeSpecTypeForDeclarator, using the same logic previously used for generic lambdas, now unified with abbreviated templates, by: - Tracking the template parameter lists in the Declarator object - Tracking the template parameter depth before parsing function declarators (at which point we can match template parameters against scope specifiers to know if we have an explicit template parameter list to append invented parameters to or not). - When encountering an AutoType in a parameter context we check a stack of InventedTemplateParameterInfo structures that contain the info required to create and accumulate invented template parameters (fields that were already present in LambdaScopeInfo, which now inherits from this class and is looked up when an auto is encountered in a lambda context). Resubmit after fixing MSAN failures caused by incomplete initialization of AutoTypeLocs in TypeSpecLocFiller. Differential Revision: https://reviews.llvm.org/D65042 (cherry picked from commit b481f028144ca91c15d1db3649ce14f174259e7e)
* [Concepts] Requires ExpressionsSaar Raz2020-01-246-32/+249
| | | | | | | | | | Implement support for C++2a requires-expressions. Re-commit after compilation failure on some platforms due to alignment issues with PointerIntPair. Differential Revision: https://reviews.llvm.org/D50360 (cherry picked from commit a0f50d731639350c7a79f140f026c27a18215531)
* [ODRHash] Fix wrong error message with bitfields and mutable.Weverything2020-01-141-8/+16
| | | | | Add a check to bitfield mismatches that may have caused Clang to give an error about the bitfield instead of being mutable.
* [Concepts] Type ConstraintsSaar Raz2020-01-154-13/+40
| | | | | | | Add support for type-constraints in template type parameters. Also add support for template type parameters as pack expansions (where the type constraint can now contain an unexpanded parameter pack). Differential Revision: https://reviews.llvm.org/D44352
* make -fmodules-codegen and -fmodules-debuginfo work also with PCHsLuboš Luňák2020-01-154-11/+27
| | | | | | | | | | Allow to build PCH's (with -building-pch-with-obj and the extra .o file) with -fmodules-codegen -fmodules-debuginfo to allow emitting shared code into the extra .o file, similarly to how it works with modules. A bit of a misnomer, but the underlying functionality is the same. This saves up to 20% of build time here. Differential Revision: https://reviews.llvm.org/D69778
* -fmodules-codegen should not emit extern templatesLuboš Luňák2020-01-141-2/+3
| | | | | | | | | | | | If a header contains 'extern template', then the template should be provided somewhere by an explicit instantiation, so it is not necessary to generate a copy. Worse, this can lead to an unresolved symbol, because the codegen's object file will not actually contain functions from such a template because of the GVA_AvailableExternally, but the object file for the explicit instantiation will not contain them either because it will be blocked by the information provided by the module. Differential Revision: https://reviews.llvm.org/D69779
* GlobalModuleIndex - Fix use-after-move clang static analyzer warning.Simon Pilgrim2020-01-111-4/+5
| | | | Shadow variable names meant we were referencing the Buffer input argument, not the GlobalModuleIndex member that its std::move()'d it.
* [Concepts] Function trailing requires clausesSaar Raz2020-01-092-2/+6
| | | | | | Function trailing requires clauses now parsed, supported in overload resolution and when calling, referencing and taking the address of functions or function templates. Differential Revision: https://reviews.llvm.org/D43357
* [OpenMP][NFCI] Use the libFrontend ProcBindKind in ClangJohannes Doerfert2019-12-262-3/+2
| | | | | | | | | | | | This removes the OpenMPProcBindClauseKind enum in favor of llvm::omp::ProcBindKind which lives in OpenMPConstants.h and was introduced in D70109. No change in behavior is expected. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D70289
* [OPENMP50]Basic support for conditional lastprivate.Alexey Bataev2019-12-242-0/+7
| | | | Added parsing/sema checks for conditional lastprivates.
* [OPENMP50]Codegen for nontemporal clause.Alexey Bataev2019-12-232-0/+7
| | | | | | | | | | | | | | | | Summary: Basic codegen for the declarations marked as nontemporal. Also, if the base declaration in the member expression is marked as nontemporal, lvalue for member decl access inherits nonteporal flag from the base lvalue. Reviewers: rjmccall, hfinkel, jdoerfert Subscribers: guansong, arphaman, caomhin, kkwli0, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71708
* [Concepts] Constrained partial specializations and function overloads.Saar Raz2019-12-232-8/+10
| | | | | | | Added support for constraint satisfaction checking and partial ordering of constraints in constrained partial specialization and function template overloads. Re-commit after fixing another crash (added regression test). Differential Revision: https://reviews.llvm.org/D41910
* Revert "[Concepts] Constrained partial specializations and function overloads."Reid Kleckner2019-12-222-10/+8
| | | | | | This reverts commit d3f5769d5e93b30d4a8b4696381d5e4a304992fa. Causes crashes on Chromium. Have reproducer, will reduce and send along.
* [Concepts] Constrained partial specializations and function overloads.Saar Raz2019-12-222-8/+10
| | | | | | | Added support for constraint satisfaction checking and partial ordering of constraints in constrained partial specialization and function template overloads. Re-commit after fixing some crashes and warnings. Differential Revision: https://reviews.llvm.org/D41910
* Revert concepts changes from D41910Vedant Kumar2019-12-182-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These changes caused LibcxxVariantDataFormatterTestCase in lldb to fail with an assert: Assertion failed: (Idx < size() && "Out-of-bounds Bit access."), function operator[], file /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/ADT/SmallBitVector.h, line 452. In: 7 clang-10 0x00000001094b79d9 isAtLeastAsSpecializedAs(clang::Sema&, clang::SourceLocation, clang::FunctionTemplateDecl*, clang::FunctionTemplateDecl*, clang::TemplatePartialOrderingContext, unsigned int) + 1865 8 clang-10 0x00000001094b7111 clang::Sema::getMoreSpecializedTemplate(clang::FunctionTemplateDecl*, clang::FunctionTemplateDecl*, clang::SourceLocation, clang::TemplatePartialOrderingContext, unsigned int, unsigned int) + 97 9 clang-10 0x000000010939bf88 clang::isBetterOverloadCandidate(clang::Sema&, clang::OverloadCandidate const&, clang::OverloadCandidate const&, clang::SourceLocation, clang::OverloadCandidateSet::CandidateSetKind) + 1128 Revert "[Concepts] Fix incorrect move out of temporary in D41910" This reverts commit 11d5fa6e87e3584f72056ecc2b17f88c58323dde. Revert "[Concepts] Fix crash in D41910" This reverts commit 12038be20ee6a903cdbd3fddce65535ef683e31d. Revert "[Concepts] Constrained partial specializations and function overloads." This reverts commit fc0731b98a67c793862288f8ae334322666214dc.
* [Concepts] Constrained partial specializations and function overloads.Saar Raz2019-12-182-8/+10
| | | | | | Added support for constraint satisfaction checking and partial ordering of constraints in constrained partial specialization and function template overloads. Phabricator: D41910
* [OPENMP50]Add parsing/sema analysis for nontemporal clause.Alexey Bataev2019-12-172-0/+21
| | | | | Add basic support for parsing/sema analysis of the nontemporal clause in simd-based directives.
* Move ASTRecordWriter into its own header; NFC.John McCall2019-12-143-11/+27
| | | | | | | | | | Similar motivations to the movement of ASTRecordReader: AbstractBasicWriter.h already has quite a few dependencies, and it's going to get pretty large as we generate more and more into it. Meanwhile, most clients don't depend on this detail of the implementation and shouldn't need to be recompiled. I've also made OMPClauseWriter private, like it belongs.
* Move ASTRecordReader into its own header; NFC.John McCall2019-12-143-13/+33
| | | | | | | | | | | | | AbstractBasicReader.h has quite a few dependencies already, and that's only likely to increase. Meanwhile, ASTRecordReader is really an implementation detail of the ASTReader that is only used in a small number of places. I've kept it in a public header for the use of projects like Swift that might want to plug in to Clang's serialization framework. I've also moved OMPClauseReader into an implementation file, although it can't be made private because of friendship.
* Abstract serialization: TableGen the (de)serialization code for Types.John McCall2019-12-142-1406/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic technical design here is that we have three levels of readers and writers: - At the lowest level, there's a `Basic{Reader,Writer}` that knows how to emit the basic structures of the AST. CRTP allows this to be metaprogrammed so that the client only needs to support a handful of primitive types (e.g. `uint64_t` and `IdentifierInfo*`) and more complicated "inline" structures such as `DeclarationName` can just be emitted in terms of those primitives. In Clang's binary-serialization code, these are `ASTRecord{Reader,Writer}`. For now, a large number of basic structures are still emitted explicitly by code on those classes rather than by either TableGen or CRTP metaprogramming, but I expect to move more of these over. - In the middle, there's a `Property{Reader,Writer}` which is responsible for processing the properties of a larger object. The object-level reader/writer asks the property-level reader/writer to project out a particular property, yielding a basic reader/writer which will be used to read/write the property's value, like so: ``` propertyWriter.find("count").writeUInt32(node->getCount()); ``` Clang's binary-serialization code ignores this level (it uses the basic reader/writer as the property reader/writer and has the projection methods just return `*this`) and simply relies on the roperties being read/written in a stable order. - At the highest level, there's an object reader/writer (e.g. `Type{Reader,Writer}` which emits a logical object with properties. Think of this as writing something like a JSON dictionary literal. I haven't introduced support for bitcode abbreviations yet --- it turns out that there aren't any operative abbreviations for types besides the QualType one --- but I do have some ideas of how they should work. At any rate, they'll be necessary in order to handle statements. I'm sorry for not disentangling the patches that added basic and type reader/writers; I made some effort to, but I ran out of energy after disentangling a number of other patches from the work. Negligible impact on module size, time to build a set of about 20 fairly large modules, or time to read a few declarations out of them.
* Standardize the reader methods in ASTReader; NFC.John McCall2019-12-143-1075/+976
| | | | | | | | | | | | | | | | | | | | | | | | | | There are three significant changes here: - Most of the methods to read various embedded structures (`APInt`, `NestedNameSpecifier`, `DeclarationName`, etc.) have been moved from `ASTReader` to `ASTRecordReader`. This cleans up quite a bit of code which was passing around `(F, Record, Idx)` arguments everywhere or doing explicit indexing, and it nicely parallels how it works on the writer side. It also sets us up to then move most of these methods into the `BasicReader`s that I'm introducing as part of abstract serialization. As part of this, several of the top-level reader methods (e.g. `readTypeRecord`) have been converted to use `ASTRecordReader` internally, which is a nice readability improvement. - I've standardized most of these method names on `readFoo` rather than `ReadFoo` (used in some of the helper structures) or `GetFoo` (used for some specific types for no apparent reason). - I've changed a few of these methods to return their result instead of reading into an argument passed by reference. This is partly for general consistency and partly because it will make the metaprogramming easier with abstract serialization.
* [Support] Add TimeTraceScope constructor without detail argRussell Gallop2019-12-111-2/+2
| | | | | | | This simplifies code where no extra details are required Also don't write out detail when it is empty. Differential Revision: https://reviews.llvm.org/D71347
* [OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.hJohannes Doerfert2019-12-102-4/+4
| | | | | | | | | | | | | | | | | | | Summary: The new OpenMPConstants.h is a location for all OpenMP related constants (and helpers) to live. This patch moves the directives there (the enum OpenMPDirectiveKind) and rewires Clang to use the new location. Initially part of D69785. Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim Subscribers: jholewinski, ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69853
* [c++20] Fix handling of unqualified lookups from a defaulted comparisonRichard Smith2019-12-092-0/+25
| | | | | | | | | | function. We need to perform unqualified lookups from the context of a defaulted comparison, but not until we implicitly define the function, at which point we can't do those lookups any more. So perform the lookup from the end of the class containing the =default declaration and store the lookup results on the defaulted function until we synthesize the body.
* Remove Expr.h include from ASTContext.h, NFCReid Kleckner2019-12-061-1/+2
| | | | | | | ASTContext.h is popular, prune its includes. Expr.h brings in Attr.h, which is also expensive. Move BlockVarCopyInit to Expr.h to accomplish this.
* [ObjC] Make sure that the implicit arguments for direct methods have been setupAlex Lorenz2019-12-062-6/+5
| | | | | | | | | | | | | | | | | | | | This commit sets the Self and Imp declarations for ObjC method declarations, in addition to the definitions. It also fixes a bunch of code in clang that had wrong assumptions about when getSelfDecl() would be set: - CGDebugInfo::getObjCMethodName and AnalysisConsumer::getFunctionName would assume that it was set for method declarations part of a protocol, which they never were, and that self would be a Class type, which it isn't as it is id for a protocol. Also use the Canonical Decl to index the set of Direct methods so that when calls and implementations interleave, the same llvm::Function is used and the same symbol name emitted. Radar-Id: rdar://problem/57661767 Patch by: Pierre Habouzit Differential Revision: https://reviews.llvm.org/D71091
* [Concepts] Constraint Enforcement & DiagnosticsSaar Raz2019-12-062-3/+41
| | | | | | | | | Part of the C++20 concepts implementation effort. - Associated constraints (requires clauses, currently) are now enforced when instantiating/specializing templates and when considering partial specializations and function overloads. - Elaborated diagnostics give helpful insight as to why the constraints were not satisfied. Phabricator: D41569 Re-commit, after fixing some memory bugs.
* [OpenMP50] Add parallel master constructcchen2019-12-052-0/+21
| | | | | | | | | | | | Reviewers: ABataev, jdoerfert Reviewed By: ABataev Subscribers: rnk, jholewinski, guansong, arphaman, jfb, cfe-commits, sandoval, dreachem Tags: #clang Differential Revision: https://reviews.llvm.org/D70726
* Reapply af57dbf12e54 "Add support for options -frounding-math, ↵Melanie Blower2019-12-052-0/+2
| | | | | | | | | | | | ftrapping-math, -ffp-model=, and -ffp-exception-behavior=" Patch was reverted because https://bugs.llvm.org/show_bug.cgi?id=44048 The original patch is modified to set the strictfp IR attribute explicitly in CodeGen instead of as a side effect of IRBuilder. In the 2nd attempt to reapply there was a windows lit test fail, the tests were fixed to use wildcard matching. Differential Revision: https://reviews.llvm.org/D62731
* Revert "[OpenMP50] Add parallel master construct, by Chi Chun Chen."Reid Kleckner2019-12-042-21/+0
| | | | | | This reverts commit 713dab21e27c987b9114547ce7136bac2e775de9. Tests do not pass on Windows.
* Revert " Reapply af57dbf12e54 "Add support for options ↵Melanie Blower2019-12-042-2/+0
| | | | | | | -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior="" This reverts commit cdbed2dd856c14687efd741c2d8321686102acb8. Build break on Windows (lit fail)
* [OpenMP50] Add parallel master construct, by Chi Chun Chen.cchen2019-12-042-0/+21
| | | | | | | | | | | | Reviewers: ABataev, jdoerfert Reviewed By: ABataev Subscribers: jholewinski, guansong, arphaman, jfb, cfe-commits, sandoval, dreachem Tags: #clang Differential Revision: https://reviews.llvm.org/D70726
* Reapply af57dbf12e54 "Add support for options -frounding-math, ↵Melanie Blower2019-12-042-0/+2
| | | | | | | | | | ftrapping-math, -ffp-model=, and -ffp-exception-behavior=" Patch was reverted because https://bugs.llvm.org/show_bug.cgi?id=44048 The original patch is modified to set the strictfp IR attribute explicitly in CodeGen instead of as a side effect of IRBuilder Differential Revision: https://reviews.llvm.org/D62731
* [clang][modules] Add support for merging lifetime-extended temporariesTyker2019-12-021-0/+22
| | | | | | | | | | | | | | Summary: Add support for merging lifetime-extended temporaries Reviewers: rsmith Reviewed By: rsmith Subscribers: xbolva00, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70190
* Revert "[clang][modules] Add support for merging lifetime-extended temporaries"Tyker2019-12-011-22/+0
| | | | This reverts commit a3cbe1a202df6ec8e23bd55e14db254e4bc33021.
* [clang][modules] Add support for merging lifetime-extended temporariesTyker2019-12-011-0/+22
| | | | | | | | | | | | | | Summary: Add support for merging lifetime-extended temporaries Reviewers: rsmith Reviewed By: rsmith Subscribers: xbolva00, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70190
* Revert "[clang][modules] Add support for merging lifetime-extended temporaries"Tyker2019-12-011-22/+0
| | | | This reverts commit 85c74384778909789389b9012a75cfcca7964a28.
* [clang][modules] Add support for merging lifetime-extended temporariesTyker2019-11-301-0/+22
| | | | | | | | | | | | | | Summary: Add support for merging lifetime-extended temporaries Reviewers: rsmith Reviewed By: rsmith Subscribers: xbolva00, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70190
* Revert "[clang][modules] Add support for merging lifetime-extended temporaries"Tyker2019-11-301-26/+0
| | | | This reverts commit 3c7f6b439699a9cbbc0ac8d288cc70aff357446b.
* [clang][modules] Add support for merging lifetime-extended temporariesTyker2019-11-301-0/+26
| | | | | | | | | | | | | | Summary: Add support for merging lifetime-extended temporaries Reviewers: rsmith Reviewed By: rsmith Subscribers: xbolva00, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70190
* clang/Modules: Move Serialization/Module.{h,cpp} to ModuleFile, NFCDuncan P. N. Exon Smith2019-11-217-11/+11
| | | | | | | | | Remove some cognitive load by renaming clang/Serialization/Module.h to clang/Serialization/ModuleFile.h, since it declares the ModuleFile class. This also makes editing a bit easier, since the basename of the file no long conflicts with clang/Basic/Module.h, which declares the Module class. Also move lib/Serialization/Module.cpp to lib/Serialization/ModuleFile.cpp.
* clang/Modules: Sink ASTReadResult in ReadControlBlock, NFCDuncan P. N. Exon Smith2019-11-191-5/+5
| | | | | | | | Simplify the code by avoiding some state that wasn't being used. The function-level `Result` was only assigned a value other than `Success` in the handler for `OPTIONS_BLOCK_ID`, but in that case it also hits an early return. Remove it at the function-level to make it obvious that the normal case always returns `Success`.
* [NFC] Refactor representation of materialized temporariesTyker2019-11-195-7/+37
| | | | | | | | | | | | | | | Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: thakis, sammccall, ilya-biryukov, rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
* Revert "[NFC] Refactor representation of materialized temporaries"Nico Weber2019-11-175-37/+7
| | | | | | This reverts commit 08ea1ee2db5f9d6460fef1d79d0d1d1a5eb78982. It broke ./ClangdTests/FindExplicitReferencesTest.All on the bots, see comments on https://reviews.llvm.org/D69360
* [NFC] Refactor representation of materialized temporariesTyker2019-11-165-7/+37
| | | | | | | | | | | | | | | Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
OpenPOWER on IntegriCloud