summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* [ODRHash] Finish FieldDecl support by handling mutable and initializers.Richard Trieu2017-02-241-1/+48
| | | | | | https://reviews.llvm.org/rL296170 llvm-svn: 296198
* [ODRHash] Add handling of bitfieldsRichard Trieu2017-02-241-0/+26
| | | | | | Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 296170
* [ODRHash] Add handling of TypedefType and DeclarationNameRichard Trieu2017-02-241-0/+47
| | | | | | Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 296078
* Represent pass_object_size attrs in ExtParameterInfoGeorge Burgess IV2017-02-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal of this is to fix a bug in modules where we'd merge FunctionDecls that differed in their pass_object_size attributes. Since we can overload on the presence of pass_object_size attributes, this behavior is incorrect. We don't represent `N` in `pass_object_size(N)` as part of ExtParameterInfo, since it's an error to overload solely on the value of N. This means that we have a bug if we have two modules that declare functions that differ only in their pass_object_size attrs, like so: // In module A, from a.h void foo(char *__attribute__((pass_object_size(0)))); // In module B, from b.h void foo(char *__attribute__((pass_object_size(1)))); // In module C, in main.c #include "a.h" #include "b.h" At the moment, we'll merge the foo decls, when we should instead emit a diagnostic about an invalid overload. We seem to have similar (silent) behavior if we overload only on the return type of `foo` instead; I'll try to find a good place to put a FIXME (or I'll just file a bug) soon. This patch also fixes a bug where we'd not output the proper extended parameter info for declarations with pass_object_size attrs. llvm-svn: 296076
* [ODRHash] Add IdentiferInfo and FieldDecl support.Richard Trieu2017-02-231-0/+22
| | | | | | | | | IdentifierInfo is hashed based on the stored string. FieldDecl versus other Decl is now detected, as well as differently named fields. Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 295911
* [ODRHash] static_cast and Stmt hashing.Richard Trieu2017-02-221-0/+101
| | | | | | | | | | Add support for static_cast in classes. Add pointer-independent profiling for Stmt's, sharing most of the logic with Stmt::Profile. This is the first of the deep sub-Decl diffing for error messages. Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 295890
* Fix 'control reaches end of non-void function' warningSimon Pilgrim2017-02-221-1/+2
| | | | llvm-svn: 295829
* [ODRHash] Avoid dereferencing end() of a SmallVector.Benjamin Kramer2017-02-221-1/+2
| | | | | | Found by MSAN. llvm-svn: 295820
* Add more ODR checking.Richard Trieu2017-02-221-12/+132
| | | | | | | | | | Add the basics for the ODRHash class, which will only process Decl's from a whitelist, which currently only has AccessSpecDecl. Different access specifiers in merged classes can now be detected. Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 295800
* Part of adding an improved ODR checker.Richard Trieu2017-02-182-0/+3
| | | | | | | | | Reserve a spot for ODR hash in CXXRecordDecl and in its modules storage. Default the hash value to 0 for all classes. Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 295533
* [modules] Load the ModuleOffsetMap from the module header lazily.Richard Smith2017-02-182-85/+113
| | | | | | | | If we never need to map any ID within the module to its global ID, we don't need the module offset map. If a compilation transitively depends on lots of unused module files, this can result in a modest performance improvement. llvm-svn: 295517
* [OpenMP] Prepare Sema for initial implementation for pragma 'distribute ↵Carlo Bertolli2017-02-172-0/+4
| | | | | | | | | | | | | | | parallel for' https://reviews.llvm.org/D29922 This patch adds two fields for use in the implementation of 'distribute parallel for': The increment expression for the distribute loop. As the chunk assigned to a team is executed by multiple threads within the 'parallel for' region, the increment expression has to correspond to the value returned by the related runtime call (for_static_init). The upper bound of the innermost loop ('for' in 'distribute parallel for') is not the globalUB expression normally used for pragma 'for' when found in isolation. It is instead the upper bound of the chunk assigned to the team ('distribute' loop). In this way, we prevent teams from executing chunks assigned to other teams. The use of these two fields can be see in a related explanatory patch: https://reviews.llvm.org/D29508 llvm-svn: 295497
* Add an explicit derived class of FunctionDecl to model deduction guides ratherRichard Smith2017-02-173-0/+15
| | | | | | | | than just treating them as FunctionDecls with a funny name. No functionality change intended. llvm-svn: 295491
* Revert r295421, new ODR checker for modules, to fix build bot.Richard Trieu2017-02-173-631/+10
| | | | llvm-svn: 295427
* Add better ODR checking for modules.Richard Trieu2017-02-173-10/+631
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A slightly weaker form of ODR checking than previous attempts, but hopefully won't break the modules build bot. Future work will be needed to catch all cases. When objects are imported for modules, there is a chance that a name collision will cause an ODR violation. Previously, only a small number of such violations were detected. This patch provides a stronger check based on AST nodes. The information needed to uniquely identify an object is taken from the AST and put into a one-dimensional byte stream. This stream is then hashed to give a value to represent the object, which is stored with the other object data in the module. When modules are loaded, and Decl's are merged, the hash values of the two Decl's are compared. Only Decl's with matched hash values will be merged. Mismatch hashes will generate a module error, and if possible, point to the first difference between the two objects. The transform from AST to byte stream is a modified depth first algorithm. Due to references between some AST nodes, a pure depth first algorithm could generate loops. For Stmt nodes, a straight depth first processing occurs. For Type and Decl nodes, they are replaced with an index number and only on first visit will these nodes be processed. As an optimization, boolean values are saved and stored together in reverse order at the end of the byte stream to lower the ammount of data that needs to be hashed. Compile time impact was measured at 1.5-2.0% during module building, and negligible during builds without module building. Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 295421
* [OpenCL] Correct ndrange_t implementationAnastasia Stulova2017-02-162-6/+0
| | | | | | | | | | | | | | | Removed ndrange_t as Clang builtin type and added as a struct type in the OpenCL header. Use type name to do the Sema checking in enqueue_kernel and modify IR generation accordingly. Review: D28058 Patch by Dmitry Borisenkov! llvm-svn: 295311
* Revert r295284: Add better ODR checking for modules.Richard Trieu2017-02-163-633/+10
| | | | | | Fix modules build bot. llvm-svn: 295293
* Loosen a Type check ODR checking to try to fix the build bot.Richard Trieu2017-02-161-2/+4
| | | | llvm-svn: 295286
* Add better ODR checking for modules.Richard Trieu2017-02-163-10/+631
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recommit r293585 that was reverted in r293611 with new fixes. The previous issue was determined to be an overly aggressive AST visitor from forward declared objects. The visitor will now only deeply visit certain Decl's and only do a shallow information extraction from all other Decl's. When objects are imported for modules, there is a chance that a name collision will cause an ODR violation. Previously, only a small number of such violations were detected. This patch provides a stronger check based on AST nodes. The information needed to uniquely identify an object is taken from the AST and put into a one-dimensional byte stream. This stream is then hashed to give a value to represent the object, which is stored with the other object data in the module. When modules are loaded, and Decl's are merged, the hash values of the two Decl's are compared. Only Decl's with matched hash values will be merged. Mismatch hashes will generate a module error, and if possible, point to the first difference between the two objects. The transform from AST to byte stream is a modified depth first algorithm. Due to references between some AST nodes, a pure depth first algorithm could generate loops. For Stmt nodes, a straight depth first processing occurs. For Type and Decl nodes, they are replaced with an index number and only on first visit will these nodes be processed. As an optimization, boolean values are saved and stored together in reverse order at the end of the byte stream to lower the ammount of data that needs to be hashed. Compile time impact was measured at 1.5-2.0% during module building, and negligible during builds without module building. Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 295284
* [Modules] Consider enable_if attrs in isSameEntity.George Burgess IV2017-02-151-2/+42
| | | | | | | | | | | | | | Two functions that differ only in their enable_if attributes are considered overloads, so we should check for those when we're trying to figure out if two functions are mergeable. We need to do the same thing for pass_object_size, as well. Looks like that'll be a bit less trivial, since we sometimes do these merging checks before we have pass_object_size attributes available (see the merge checks in ASTDeclReader::VisitFunctionDecl that happen before we read parameters, and merge checks in calls to ReadDeclAs<>()). llvm-svn: 295252
* Delete useless / in comment. NFC.George Burgess IV2017-02-141-1/+1
| | | | llvm-svn: 295032
* ASTReader: Refactor common code for writing function definitions, to match ↵David Blaikie2017-02-121-17/+15
| | | | | | the writing code llvm-svn: 294904
* [Concepts] Class template associated constraintsHubert Tong2017-02-101-0/+1
| | | | | | | | | | | | | | | | Summary: This adds associated constraints as a property of class templates. An error is produced if redeclarations are not similarly constrained. Reviewers: rsmith, faisalv, aaron.ballman Reviewed By: rsmith Subscribers: cfe-commits, nwilson Differential Revision: https://reviews.llvm.org/D25674 llvm-svn: 294697
* Sink IsExplicitSpecified flag from CXXConstructorDecl and CXXConversionDeclRichard Smith2017-02-102-6/+3
| | | | | | | into FunctionDecl. Makes CXXConversionDecl 8 bytes smaller. No functionality change intended. llvm-svn: 294684
* [ASTReader] Improve ReadASTBlock error message when module not availableBruno Cardoso Lopes2017-02-071-1/+4
| | | | | | | | Point to the PCM file that could not be found. rdar://problem/30381981 llvm-svn: 294362
* [PCH] Fix a regression when PCH is used with -fmodulesBruno Cardoso Lopes2017-02-071-1/+2
| | | | | | | | | | | | | | | | | Following up on r291465 after a regression in r276159. 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 don't serialize such headers in the PCH as being part of a module, because at this point they are not. This was causing subtle bugs and malformed AST crashes, for instance, when using the PCH in subsequent compiler invocation with -fmodules, the HFI for a modular header would map to the PCH, which would force a module load of and unexistent module ID. rdar://problem/30171164 llvm-svn: 294361
* P0091R3: Implement basic parsing support for C++17 deduction-guides.Richard Smith2017-02-072-4/+19
| | | | | | | | | | | We model deduction-guides as functions with a new kind of name that identifies the template whose deduction they guide; the bulk of this patch is adding the new name kind. This gives us a clean way to attach an extensible list of guides to a class template in a way that doesn't require any special handling in AST files etc (and we're going to need these functions we come to performing deduction). llvm-svn: 294266
* Fix modules codegen to be compatible with modules-tsDavid Blaikie2017-01-311-2/+2
| | | | | | | | | | | | | | | | | The Module::WithCodegen flag was only being set when the module was parsed from a ModuleMap. Instead set it late, in the ASTWriter to match the layer where the MODULAR_CODEGEN_DECLs list is determined (the WithCodegen flag essentially means "are this module's decls in MODULAR_CODEGEN_DECLs"). When simultaneous emission of AST file and modular object is implemented this may need to change - the Module::WithCodegen flag will need to be set earlier, and ideally the MODULAR_CODEGEN_DECLs gathering will consult this flag (that's not possible right now since Decls destined for an AST File don't have a Module - only if they're /read/ from a Module is that true - I expect that would need to change as well). llvm-svn: 293692
* Revert r293585 "Add better ODR checking for modules."Sam McCall2017-01-313-631/+10
| | | | | | | | | | | We're seeing what we believe are false positives. (It's hard to tell with the available diagnostics, and I'm not sure how to reduce them yet). I'll send Richard reproduction details offline. djasper/chandlerc suggested this should be a warning for now, to make rolling it out feasible. llvm-svn: 293611
* Add better ODR checking for modules.Richard Trieu2017-01-313-10/+631
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When objects are imported for modules, there is a chance that a name collision will cause an ODR violation. Previously, only a small number of such violations were detected. This patch provides a stronger check based on AST nodes. The information needed to uniquely identify an object is taked from the AST and put into a one-dimensional byte stream. This stream is then hashed to give a value to represent the object, which is stored with the other object data in the module. When modules are loaded, and Decl's are merged, the hash values of the two Decl's are compared. Only Decl's with matched hash values will be merged. Mismatch hashes will generate a module error, and if possible, point to the first difference between the two objects. The transform from AST to byte stream is a modified depth first algorithm. Due to references between some AST nodes, a pure depth first algorithm could generate loops. For Stmt nodes, a straight depth first processing occurs. For Type and Decl nodes, they are replaced with an index number and only on first visit will these nodes be processed. As an optimization, boolean values are saved and stored together in reverse order at the end of the byte stream to lower the ammount of data that needs to be hashed. Compile time impact was measured at 1.5-2.0% during module building, and negligible during builds without module building. Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 293585
* [c-index-test] Provide capability to index module file imports and dump ↵Argyrios Kyrtzidis2017-01-301-0/+16
| | | | | | | | their input files. This ensures the capability to index a module file using an existing ASTReader from a compiler instance or ASTUnit. llvm-svn: 293461
* 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
OpenPOWER on IntegriCloud