summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* Prototype of modules codegenDavid Blaikie2017-01-303-11/+50
| | | | | | | | | | | | | | | | | | | | | First pass at generating weak definitions of inline functions from module files (& skipping (-O0) or emitting available_externally (optimizations) definitions where those modules are used). External functions defined in modules are emitted into the modular object file as well (this may turn an existing ODR violation (if that module were imported into multiple translations) into valid/linkable code). Internal symbols (static functions, for example) are not correctly supported yet. The symbol will be produced, internal, in the modular object - unreferenceable from the users. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D28845 llvm-svn: 293456
* Modules: Fix a minor performance bug from r293393Duncan P. N. Exon Smith2017-01-291-3/+4
| | | | | | | | | | | | Oops... r293393 started calling ReadSignature in ModuleManager::addModule even when there was no ExpectedSignature. Whether or not this would have a measurable performance impact (I spotted this by inspection, and ReadSignature should be fairly fast), we might as well get what we can. Add an extra check against ExpectedSignature to avoid the hit. llvm-svn: 293415
* Modules: Simplify the ModuleFile constructor; likely NFCDuncan P. N. Exon Smith2017-01-291-22/+0
| | | | | | | | | | | | Zero-initialize ModuleFile members directly in the class definition, and move the (now uninteresting) constructor into the class definition. There were a few members that weren't being initialized at all. I zero-initialized them for consistency, but it's likely that they were somehow initialized before their first use; i.e., there's likely no functionality change here. llvm-svn: 293404
* Modules: Return early in ModuleManager::addModule; NFCDuncan P. N. Exon Smith2017-01-281-71/+72
| | | | | | | | | Invert the main branch in ModuleManager::addModule to return early and reduce indentation, and clean up a bunch of logic as a result. I split out a function called updateModuleImports to avoid triggering code duplication. llvm-svn: 293400
* Modules: Clean up ModuleFile::Imports in ModuleManager::removeModulesDuncan P. N. Exon Smith2017-01-281-3/+3
| | | | | | | | | | I don't have a testcase for this (and I'm not sure if it's an observable bug), but it seems obviously wrong that ModuleManager::removeModules is failing to clean up deleted modules from ModuleFile::Imports. See the code in ModuleManager::addModule that inserts into ModuleFile::Imports; we need the inverse operation. llvm-svn: 293399
* Modules: Enforce that ModuleManager::removeModules deletes the tailDuncan P. N. Exon Smith2017-01-282-15/+16
| | | | | | | | | | | | | | | ModuleManager::removeModules always deletes a tail of the ModuleManager::Chain. Change the API to enforce that so that we can simplify the code inside. There's no real functionality change, although there's a slight performance hack to loop to the First deleted module instead of the final module in the chain (skipping the about-to-be-deleted tail). Also document something suspicious: we fail to clean deleted modules out of ModuleFile::Imports. llvm-svn: 293398
* Modules: Clarify ownership of ModuleFile instances in ModuleManager, NFCDuncan P. N. Exon Smith2017-01-281-34/+25
| | | | | | | Use std::unique_ptr to clarify the ownership of the ModuleFile instances in ModuleManager. llvm-svn: 293395
* Modules: Return ModuleFile& from ModuleManager::begin, etc.; NFCDuncan P. N. Exon Smith2017-01-283-51/+49
| | | | | | | | Hide the pointer indirection in ModuleManager::begin, ModuleManager::end, ModuleManager::rbegin, and ModuleManager::rend. Besides tidying up the call sites, this is preparation for making ownership of ModuleFile explicit. llvm-svn: 293394
* Modules: Separate out a checkSignature helper, almost NFCDuncan P. N. Exon Smith2017-01-281-13/+16
| | | | | | | | | | | | The main point is to move the delete-the-new-module logic into the same block that creates it, so I can simplify the memory management in a follow-up, but I think it's clearer to use use a checkSignature helper here anyway. There is a minor functionality change: we now scan ahead to pull the signature out of the control block *only* if this is a new ModuleFile. For old ones, ASTReader::ReadControlBlock will have already read the signature. llvm-svn: 293393
* [modules] When reading / writing a typedef that is a name for linkage forRichard Smith2017-01-262-0/+6
| | | | | | | | | | | | | | another declaration, ensure we actually serialize / deserialize that declaration. Before this patch, if another copy of the typedef were merged with the parsed version, we would emit type information referring to the merged version and consequently emit nothing about the parsed anonymous struct. This resulted in us losing information, particularly the visible merged module set for the parsed definition. Force that information to be emitted and to be loaded when the typedef is used. llvm-svn: 293219
* PR0091R3: Implement parsing support for using templates as types.Richard Smith2017-01-262-0/+27
| | | | | | | | | | | | | | | This change adds a new type node, DeducedTemplateSpecializationType, to represent a type template name that has been used as a type. This is modeled around AutoType, and shares a common base class for representing a deduced placeholder type. We allow deduced class template types in a few more places than the standard does: in conditions and for-range-declarators, and in new-type-ids. This is consistent with GCC and with discussion on the core reflector. This patch does not yet support deduced class template types being named in typename specifiers. llvm-svn: 293207
* Remove and replace DiagStatePoint tracking and lookup data structure.Richard Smith2017-01-262-52/+93
| | | | | | | | | | | | | | | | | | | | | | | Rather than storing a single flat list of SourceLocations where the diagnostic state changes (in source order), we now store a separate list for each FileID in which there is a diagnostic state transition. (State for other files is built and cached lazily, on demand.) This has two consequences: 1) We can now sensibly support modules, and properly track the diagnostic state for modular headers (this matters when, for instance, triggering instantiation of a template defined within a module triggers diagnostics). 2) It's much faster than the old approach, since we can now just do a binary search on the offsets within the FileID rather than needing to call isBeforeInTranslationUnit to determine source order (which is surprisingly slow). For some pathological (but real world) files, this reduces total compilation time by more than 10%. For now, the diagnostic state points for modules are loaded eagerly. It seems feasible to defer this until diagnostic state information for one of the module's files is needed, but that's not part of this patch. llvm-svn: 293123
* [OpenMP] Support for thread_limit-clause on the 'target teams' directive.Arpith Chacko Jacob2017-01-252-0/+2
| | | | | | | | | | | The thread_limit-clause on the combined directive applies to the 'teams' region of this construct. We modify the ThreadLimitClause class to capture the clause expression within the 'target' region. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29087 llvm-svn: 293049
* [OpenMP] Support for num_teams-clause on the 'target teams' directive.Arpith Chacko Jacob2017-01-252-0/+2
| | | | | | | | | | | The num_teams-clause on the combined directive applies to the 'teams' region of this construct. We modify the NumTeamsClause class to capture the clause expression within the 'target' region. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29085 llvm-svn: 293048
* [OpenMP] Support for the num_threads-clause on 'target parallel'.Arpith Chacko Jacob2017-01-252-0/+2
| | | | | | | | | | | | | | | The num_threads-clause on the combined directive applies to the 'parallel' region of this construct. We modify the NumThreadsClause class to capture the clause expression within the 'target' region. The offload runtime call for 'target parallel' is changed to __tgt_target_teams() with 1 team and the number of threads set by this clause or a default if none. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29082 llvm-svn: 292997
* Switch TableGen to emit calls to ASTRecordReader for AttrPCHRead.David L. Jones2017-01-241-6/+5
| | | | | | | | | | | | | | | Summary: This patch changes TableGen-generated code in AttrPCHRead to call functions on ASTRecordReader, instead of passing separate parameters to ASTReader. This is a follow-up to r290217. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28007 llvm-svn: 292868
* [OpenMP] Support for the if-clause on the combined directive 'target parallel'.Arpith Chacko Jacob2017-01-182-1/+5
| | | | | | | | | | | | | | | | | | | | | | | The if-clause on the combined directive potentially applies to both the 'target' and the 'parallel' regions. Codegen'ing the if-clause on the combined directive requires additional support because the expression in the clause must be captured by the 'target' capture statement but not the 'parallel' capture statement. Note that this situation arises for other clauses such as num_threads. The OMPIfClause class inherits OMPClauseWithPreInit to support capturing of expressions in the clause. A member CaptureRegion is added to OMPClauseWithPreInit to indicate which captured statement (in this case 'target' but not 'parallel') captures these expressions. To ensure correct codegen of captured expressions in the presence of combined 'target' directives, OMPParallelScope was added to 'parallel' codegen. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D28781 llvm-svn: 292437
* [ASTReader] Add a DeserializationListener callback for IMPORTED_MODULESGraydon Hoare2017-01-181-1/+4
| | | | | | | | | | | | | | | | | Summary: Add a callback from ASTReader to DeserializationListener when the former reads an IMPORTED_MODULES block. This supports Swift in using PCH for bridging headers. Reviewers: doug.gregor, manmanren, bruno Reviewed By: manmanren Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28779 llvm-svn: 292436
* [Clang] - Update code to match upcoming llvm::zlib API.George Rimar2017-01-172-17/+36
| | | | | | | | | | | | | | D28684 changed llvm::zlib to return Error instead of Status. It was accepted and committed in r292214, but then reverted in r292217 because I missed that clang code also needs to be updated. Patch do that. D28684 recommitted again as r292226 Differential revision: https://reviews.llvm.org/D28807 llvm-svn: 292227
* Tracking exception specification source locationsMalcolm Parsons2017-01-122-0/+3
| | | | | | | | | | | | | | | | | | | | Summary: We do not currently track the source locations for exception specifications such that their source range can be queried through the AST. This leads to trying to write more complex code to determine the source range for uses like FixItHints (see D18575 for an example). In addition to use within tools like clang-tidy, I think this information may become more important to track as exception specifications become more integrated into the type system. Patch by Don Hinton. Reviewers: rsmith Subscribers: malcolm.parsons, sbarzowski, alexfh, hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D20428 llvm-svn: 291771
* Serialize the UsesSEH bit on FunctionDeclReid Kleckner2017-01-102-0/+3
| | | | | | Fixes PR31539 llvm-svn: 291600
* [OpenMP] Sema and parsing for 'target teams distribute simd’ pragmaKelvin Li2017-01-102-0/+19
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute simd’ pragma. Differential Revision: https://reviews.llvm.org/D28252 llvm-svn: 291579
* PCH: fix a regression that reports a module is defined in both pch and pcm.Manman Ren2017-01-091-11/+0
| | | | | | | | | | | | | | | | | In r276159, we started to say that a module X is defined in a pch if we specify -fmodule-name when building the pch. This caused a regression that reports module X is defined in both pch and pcm if we generate the pch with -fmodule-name=X and then in a separate clang invocation, we include the pch and also import X.pcm. This patch adds an option CompilingPCH similar to CompilingModule. When we use -fmodule-name=X while building a pch, modular headers in X will be textually included and the compiler knows that we are not building module X, so we don't put module X in SUBMODULE_DEFINITION of the pch. Differential Revision: http://reviews.llvm.org/D28415 llvm-svn: 291465
* Simplify ASTReader ctor by using in-class initializers for many member variablesDavid Blaikie2017-01-051-19/+1
| | | | llvm-svn: 291155
* Simplify ASTReader ctor by using in-class initializers (NSDMIs to the rest ↵David Blaikie2017-01-051-18/+4
| | | | | | of you) for many member variables llvm-svn: 291154
* Use shared_ptr instead of IntrusiveRefCntPtr for ModuleFileExtensionDavid Blaikie2017-01-053-35/+30
| | | | | | | The intrusiveness wasn't needed here, so this simplifies/clarifies the ownership model. llvm-svn: 291150
* Fix for LLVM Bitcode API change (to use std::shared_ptr)David Blaikie2017-01-043-118/+118
| | | | llvm-svn: 291018
* [OpenMP] Sema and parsing for 'target teams distribute parallel for simd’ ↵Kelvin Li2017-01-032-0/+20
| | | | | | | | | | pragma This patch is to implement sema and parsing for 'target teams distribute parallel for simd’ pragma. Differential Revision: https://reviews.llvm.org/D28202 llvm-svn: 290862
* [OpenMP] Sema and parsing for 'target teams distribute parallel for’ pragmaKelvin Li2016-12-292-0/+19
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute parallel for’ pragma. Differential Revision: https://reviews.llvm.org/D28160 llvm-svn: 290725
* [OpenMP] Sema and parsing for 'target teams distribute' pragmaKelvin Li2016-12-252-2/+21
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute' pragma. Differential Revision: https://reviews.llvm.org/D28015 llvm-svn: 290508
* Rename several methods on ASTRecordReader to follow LLVM style (lowerCamelCase).David L. Jones2016-12-212-365/+365
| | | | | | | | | | | | | | Summary: This follows up to r290217, and makes functions on ASTRecordReader consistent and valid style. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28008 llvm-svn: 290236
* Store the "current position" index within the ASTRecordReader.David L. Jones2016-12-213-715/+723
| | | | | | | | | | | | | | | | | | Summary: For ASTDeclReader and ASTStmtReader, every parameter "unsigned &Idx" ultimately comes from a variable that is defined on the stack, next to the RecordData. This change moves that index into the ASTRecordReader. TypeLocReader cannot be transitioned, due to TableGen-generated code which calls ASTReader::GetTypeSourceInfo. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27836 llvm-svn: 290217
* [c++1z] P0195R2: Support pack-expansion of using-declarations.Richard Smith2016-12-203-0/+28
| | | | | | | | | | | | | | This change introduces UsingPackDecl as a marker for the set of UsingDecls produced by pack expansion of a single (unresolved) using declaration. This is not strictly necessary (we just need to be able to map from the original using declaration to its expansions somehow), but it's useful to maintain the invariant that each declaration reference instantiates to refer to one declaration. This is a re-commit of r290080 (reverted in r290092) with a fix for a use-after-lifetime bug. llvm-svn: 290203
* [ASTReader] Sort RawComments before mergingBruno Cardoso Lopes2016-12-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | `RawComments` are sorted by comparing underlying `SourceLocation`'s. This is done by comparing `FileID` and `Offset`; when the `FileID` is the same it means the locations are within the same TU and the `Offset` is used. FileID, from the source code: "A mostly-opaque identifier, where 0 is "invalid", >0 is this module, and <-1 is something loaded from another module.". That said, when de-serializing SourceLocations, FileID's from RawComments loaded from other modules get negative IDs where previously they were positive. This makes imported RawComments unsorted, leading to a wrong merge with other comments from the current TU. Fix that by sorting RawComments properly after de-serialization and before merge. This fixes an assertion in `ASTContext::getRawCommentForDeclNoCache`, which fires only in a debug build of clang. Differential Revision: https://reviews.llvm.org/D27546 rdar://problem/29287314 llvm-svn: 290134
* Revert "[c++1z] P0195R2: Support pack-expansion of using-declarations."Daniel Jasper2016-12-193-28/+0
| | | | | | | This reverts commit r290080 as it leads to many Clang crashes, e.g.: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/1814 llvm-svn: 290092
* [c++1z] P0195R2: Support pack-expansion of using-declarations.Richard Smith2016-12-193-0/+28
| | | | | | | | | | | This change introduces UsingPackDecl as a marker for the set of UsingDecls produced by pack expansion of a single (unresolved) using declaration. This is not strictly necessary (we just need to be able to map from the original using declaration to its expansions somehow), but it's useful to maintain the invariant that each declaration reference instantiates to refer to one declaration. llvm-svn: 290080
* Attempt to fix build failure and regressions due to r290056Yaxun Liu2016-12-182-4/+4
| | | | | | | Add llvm:: namespace to StringRef. Make conversion between bool and uint64_t explicit. llvm-svn: 290058
* Recommit r289979 [OpenCL] Allow disabling types and declarations associated ↵Yaxun Liu2016-12-182-12/+76
| | | | | | | | with extensions Fixed undefined behavior due to cast integer to bool in initializer list. llvm-svn: 290056
* [OpenMP] Sema and parsing for 'target teams' pragmaKelvin Li2016-12-172-0/+20
| | | | | | | | This patch is to implement sema and parsing for 'target teams' pragma. Differential Revision: https://reviews.llvm.org/D27818 llvm-svn: 290038
* Revert r289979 due to regressionsYaxun Liu2016-12-162-76/+12
| | | | llvm-svn: 289991
* [OpenCL] Allow disabling types and declarations associated with extensionsYaxun Liu2016-12-162-12/+76
| | | | | | | | | | | | | | | | | | Added a map to associate types and declarations with extensions. Refactored existing diagnostic for disabled types associated with extensions and extended it to declarations for generic situation. Fixed some bugs for types associated with extensions. Allow users to use pragma to declare types and functions for supported extensions, e.g. #pragma OPENCL EXTENSION the_new_extension_name : begin // declare types and functions associated with the extension here #pragma OPENCL EXTENSION the_new_extension_name : end Differential Revision: https://reviews.llvm.org/D21698 llvm-svn: 289979
* Add a class ASTRecordReader which wraps an ASTReader, a RecordData, and ↵David L. Jones2016-12-153-1447/+1378
| | | | | | | | | | | | | | | | | | | | | ModuleFile. Summary: When reading an ASTRecord, each RecordData is logically contained within a single ModuleFile, and global(er) state is contained by a single ASTReader. This means that any operations that read from a RecordData and reference an ASTReader or a ModuleFile, will always reference the same ASTReader or ModuleFile. ASTRecordReader groups these together so that parameters don't need to be duplicated ad infinitum. Most uses of the Idx variable seem to be redunant aliases as well, but I'll leave that for now. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27784 llvm-svn: 289870
* Remove unused variable found by GCC warning.Richard Smith2016-12-141-1/+1
| | | | llvm-svn: 289698
* Remove custom handling of array copies in lambda by-value array capture andRichard Smith2016-12-144-68/+16
| | | | | | | | | | | copy constructors of classes with array members, instead using ArrayInitLoopExpr to represent the initialization loop. This exposed a bug in the static analyzer where it was unable to differentiate between zero-initialized and unknown array values, which has also been fixed here. llvm-svn: 289618
* Add two new AST nodes to represent initialization of an array in terms ofRichard Smith2016-12-122-0/+30
| | | | | | | | | | | | | | | | | | | | initialization of each array element: * ArrayInitLoopExpr is a prvalue of array type with two subexpressions: a common expression (an OpaqueValueExpr) that represents the up-front computation of the source of the initialization, and a subexpression representing a per-element initializer * ArrayInitIndexExpr is a prvalue of type size_t representing the current position in the loop This will be used to replace the creation of explicit index variables in lambda capture of arrays and copy/move construction of classes with array elements, and also C++17 structured bindings of arrays by value (which inexplicably allow copying an array by value, unlike all of C++'s other array declarations). No uses of these nodes are introduced by this change, however. llvm-svn: 289413
* [modules] Add optional out-param to ASTReader::ReadAST for imported submodules.Graydon Hoare2016-12-091-1/+6
| | | | | | | | | | | | | | | | | | | | Summary: The Swift frontend is acquiring the ability to load non-module PCH files containing bridging definitions from C/ObjC. As part of this work, it needs to know which submodules were imported by a PCH in order to wrap them in local Swift modules. This information is collected by ASTReader::ReadAST in a local vector, but is currently kept private. The change here is just to make the type of the vector elements public, and provide an optional out-parameter to the ReadAST method to provide the vector's contents to a caller after a successful read. Reviewers: manmanren, rsmith, doug.gregor Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27580 llvm-svn: 289276
* Don't assert when redefining a built-in macro in a PCH, PR29119Nico Weber2016-12-091-1/+1
| | | | | | | | | | | | | | | | PCH files store the macro history for a given macro, and the whole history list for one identifier is given to the Preprocessor at once via Preprocessor::setLoadedMacroDirective(). This contained an assert that no macro history exists yet for that identifier. That's usually true, but it's not true for builtin macros, which are created in Preprocessor() before flags and pchs are processed. Luckily, ASTWriter stops writing macro history lists at builtins (see shouldIgnoreMacro() in ASTWriter.cpp), so the head of the history list was missing for builtin macros. So make the assert weaker, and splice the history list to the existing single define for builtins. https://reviews.llvm.org/D27545 llvm-svn: 289228
* [OpenMP] Sema and parsing for 'teams distribute parallel for' pragmaKelvin Li2016-12-092-0/+19
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute parallel for' pragma. Differential Revision: https://reviews.llvm.org/D27345 llvm-svn: 289179
* [OpenCL] Refactor read_only/write_only pipes.Joey Gouly2016-12-012-17/+6
| | | | | | | | | | | This adds the access qualifier to the Pipe Type, rather than using a class hierarchy. It also fixes mergeTypes for Pipes, by disallowing merges. Only identical pipe types can be merged. The test case in invalid-pipes-cl2.0.cl is added to check that. llvm-svn: 288332
* [OpenMP] Sema and parsing for 'teams distribute parallel for simd' pragmaKelvin Li2016-11-302-0/+19
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute parallel for simd' pragma. Differential Revision: https://reviews.llvm.org/D27084 llvm-svn: 288294
OpenPOWER on IntegriCloud