summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* PR26237: Fix iterator invalidation bug that occurs if serializingRichard Smith2016-02-241-11/+11
| | | | | | | | | | | | specializations of a template manages to trigger deserialization of more specializations of the same template. No test case provided: this is hard to reliably test due to standard library differences. Patch by Vassil Vassilev! llvm-svn: 261781
* Fix rejects-valid caused by r261297.Nico Weber2016-02-242-0/+3
| | | | | | | | | | | | | | | | r261297 called hasUserProvidedDefaultConstructor() to check if defining a const object is ok. This is incorrect for this example: struct X { template<typename ...T> X(T...); int n; }; const X x; // formerly OK, now bogus error Instead, track if a class has a defaulted default constructor, and disallow a const object for classes that either have defaulted default constructors or if they need an implicit constructor. Bug report and fix approach by Richard Smith, thanks! llvm-svn: 261770
* Implement the likely resolution of core issue 253.Nico Weber2016-02-192-0/+3
| | | | | | | | | | | | | | | | | | C++11 requires const objects to have a user-provided constructor, even for classes without any fields. DR 253 relaxes this to say "If the implicit default constructor initializes all subobjects, no initializer should be required." clang is currently the only compiler that implements this C++11 rule, and e.g. libstdc++ relies on something like DR 253 to compile in newer versions. This change makes it possible to build code that says `const vector<int> v;' again when using libstdc++5.2 and _GLIBCXX_DEBUG (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60284). Fixes PR23381. http://reviews.llvm.org/D16552 llvm-svn: 261297
* [OPENMP 4.5] Codegen support for data members in 'firstprivate' clause.Alexey Bataev2016-02-172-2/+3
| | | | | | Added codegen for captured data members in non-static member functions. llvm-svn: 261089
* [OPENMP] Improved handling of pseudo-captured expressions in OpenMP.Alexey Bataev2016-02-162-7/+19
| | | | | | | | Expressions inside 'schedule'|'dist_schedule' clause must be captured in combined directives to avoid possible crash during codegen. Patch improves handling of such constructs llvm-svn: 260954
* Reduce the number of implicit StringRef->std::string conversions by ↵Benjamin Kramer2016-02-131-1/+1
| | | | | | | | threading StringRef through more APIs. No functionality change intended. llvm-svn: 260815
* [Modules] Early-exit if ReadOptionsBlock fails to avoid crashingBen Langmuir2016-02-111-3/+4
| | | | | | | | | | | | | | | If we didn't tell ReadOptionsBlock to allow failures then we can't assume that the stream is not in the middle of a block if it returns out-of-date. This was causing a crash when we tried to continue reading. Also, it's just generally a good idea to early-exit if we're doing implicit module builds, since we will want to immediately rebuild this module anyway and there's no reason to waste time continuing after failure. rdar://problem/24114938 llvm-svn: 260563
* [Modules] Don't infinite recurse on implicit import of circular modules in ↵Ben Langmuir2016-02-111-1/+3
| | | | | | | | | | | | | | preamble Update the Preprocessor's VisibleModuleSet when typo-correction creates an implicit module import so that we won't accidentally write an invalid SourceLocation into the preamble AST. This would later lead to infinite recursion when loading the preamble AST because we use the value in ImportLocs to prevent visiting a module twice. rdar://problem/24440990 llvm-svn: 260543
* [OPENMP] Rename OMPCapturedFieldDecl to OMPCapturedExprDecl, NFC.Alexey Bataev2016-02-113-8/+8
| | | | | | | | OMPCapturedExprDecl allows caopturing not only of fielddecls, but also other expressions. It also allows to simplify codegen for several clauses. llvm-svn: 260492
* [OPENMP 4.5] Ccapture/codegen of private non-static data members.Alexey Bataev2016-02-083-0/+15
| | | | | | | OpenMP 4.5 introduces privatization of non-static data members of current class in non-static member functions. To correctly handle such kind of privatization a new (pseudo)declaration VarDecl-based node is added. It allows to reuse an existing code for capturing variables in Lambdas/Block/Captured blocks of code for correct privatization and codegen. llvm-svn: 260077
* [modules] Compress files embedded into a .pcm file, to reduce the disk usage ↵Richard Smith2016-02-062-37/+70
| | | | | | of -fembed-all-files mode. llvm-svn: 259976
* [modules] Separately track whether an identifier's preprocessor information andRichard Smith2016-02-051-1/+5
| | | | | | | | | | name lookup information have changed since deserialization. For a C++ modules build, we do not need to re-emit the identifier into the serialized identifier table if only the name lookup information has changed (and in all cases, we don't need to re-emit the macro information if only the name lookup information has changed). llvm-svn: 259901
* [modules] Factor out common code to mark identifier being "from AST", and add aRichard Smith2016-02-051-15/+15
| | | | | | | call in one more place to reduce the size of identifier tables in non-leaf modules. No behavior change. llvm-svn: 259866
* PR25271: When attaching default template arguments to redeclarations of aRichard Smith2016-02-041-0/+2
| | | | | | | | | template, keep looking for default arguments if we see a template parameter pack. There may be default arguments preceding a pack with no default argument. Patch by Jannis Harder! llvm-svn: 259836
* Fix predefine for __NSConstantString struct typeBen Langmuir2016-02-042-0/+5
| | | | | | | | | | | | | | | | | Per review feedback the name was wrong and it can be used outside Objective-C. Unfortunately, making the internal struct visible broke some ASTMatchers tests that assumed that the first record decl would be from user code, rather than a builtin type. I'm worried that this will also affect users' code. So this patch adds a typedef to wrap the internal struct and only makes the typedef visible to namelookup. This is sufficient to allow the ASTReader to merge the decls we need without making the struct itself visible. rdar://problem/24425801 llvm-svn: 259734
* Reapply r259624, it is likely not the commit causing the bot failures.Quentin Colombet2016-02-032-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original message: Make CF constant string decl visible to name lookup to fix module errors The return type of the __builtin___*StringMakeConstantString functions is a pointer to a struct, so we need that struct to be visible to name lookup so that we will correctly merge multiple declarations of that type if they come from different modules. Incidentally, to make this visible to name lookup we need to rename the type to __NSConstantString, since the real NSConstantString is an Objective-C interface type. This shouldn't affect anyone outside the compiler since users of the constant string builtins cast the result immediately to CFStringRef. Since this struct type is otherwise implicitly created by the AST context and cannot access namelookup, we make this a predefined type and initialize it in Sema. Note: this issue of builtins that refer to types not visible to name lookup technically also affects other builtins (e.g. objc_msgSendSuper), but in all other cases the builtin is a library builtin and the issue goes away if you include the library that defines the types it uses, unlike for these constant string builtins. rdar://problem/24425801 llvm-svn: 259721
* Revert r259624 - Make CF constant string decl visible to name lookup to fix ↵Quentin Colombet2016-02-032-5/+0
| | | | | | | | | module errors. This breaks some internal bots in stage2: clang seg fault. Looking with Ben to see what is going on. llvm-svn: 259715
* [OpenMP] Parsing + sema for target parallel for directive.Arpith Chacko Jacob2016-02-032-0/+21
| | | | | | | | | | | Summary: This patch adds parsing + sema for the target parallel for directive along with testcases. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16759 llvm-svn: 259654
* Make CF constant string decl visible to name lookup to fix module errorsBen Langmuir2016-02-032-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | The return type of the __builtin___*StringMakeConstantString functions is a pointer to a struct, so we need that struct to be visible to name lookup so that we will correctly merge multiple declarations of that type if they come from different modules. Incidentally, to make this visible to name lookup we need to rename the type to __NSConstantString, since the real NSConstantString is an Objective-C interface type. This shouldn't affect anyone outside the compiler since users of the constant string builtins cast the result immediately to CFStringRef. Since this struct type is otherwise implicitly created by the AST context and cannot access namelookup, we make this a predefined type and initialize it in Sema. Note: this issue of builtins that refer to types not visible to name lookup technically also affects other builtins (e.g. objc_msgSendSuper), but in all other cases the builtin is a library builtin and the issue goes away if you include the library that defines the types it uses, unlike for these constant string builtins. rdar://problem/24425801 llvm-svn: 259624
* assert(false) -> llvm_unreachable().Davide Italiano2016-01-301-1/+1
| | | | llvm-svn: 259302
* Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren2016-01-293-3/+3
| | | | | | r259192 post commit comment. llvm-svn: 259232
* Remove autoconf supportChris Bieneman2016-01-261-19/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* [OpenMP] Parsing + sema for target parallel directive.Arpith Chacko Jacob2016-01-262-0/+20
| | | | | | | | | | | | | Summary: This patch adds parsing + sema for the target parallel directive and its clauses along with testcases. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16553 Rebased to current trunk and updated test cases. llvm-svn: 258832
* [OpenMP] Parsing + sema for defaultmap clause.Arpith Chacko Jacob2016-01-262-0/+21
| | | | | | | | | | | Summary: This patch adds parsing + sema for the defaultmap clause associated with the target directive (among others). Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16527 llvm-svn: 258817
* Module Debugging: Canonicalize the file names used as PCH module namesAdrian Prantl2016-01-221-2/+3
| | | | | | | | | | | by stripping the path. Follow-up to r258555. This is safe because only one PCH per CU is currently supported for module debugging. rdar://problem/24301262 llvm-svn: 258582
* Merge templated static member variables, fixes http://llvm.org/pr26179.Yaron Keren2016-01-221-2/+18
| | | | | | | Patch by Vassil Vassilev! Reviewed by Richard Smith. llvm-svn: 258524
* [OpenMP] Parsing + sema for "target exit data" directive.Samuel Antao2016-01-192-0/+20
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258177
* [OpenMP] Parsing + sema for "target enter data" directive.Samuel Antao2016-01-192-0/+20
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258165
* Add OpenMP dist_schedule clause to distribute directive and related ↵Carlo Bertolli2016-01-152-0/+22
| | | | | | regression tests. llvm-svn: 257917
* [OpenCL] Pipe type supportXiuli Pan2016-01-092-0/+23
| | | | | | | | | | | | | | | Summary: Support for OpenCL 2.0 pipe type. This is a bug-fix version for bader's patch reviews.llvm.org/D14441 Reviewers: pekka.jaaskelainen, Anastasia Subscribers: bader, Anastasia, cfe-commits Differential Revision: http://reviews.llvm.org/D15603 llvm-svn: 257254
* Properly track that a character literal is UTF-8, and pretty print the ↵Aaron Ballman2016-01-071-1/+1
| | | | | | prefix properly. llvm-svn: 257097
* Only instantiate a default argument once.John McCall2016-01-065-20/+33
| | | | | | | | | | | | | | | | | | | By storing the instantiated expression back in the ParmVarDecl, we remove the last need for separately storing the sub-expression of a CXXDefaultArgExpr. This makes PCH/Modules merging quite simple: CXXDefaultArgExpr records are serialized as references to the ParmVarDecl, and we ignore redundant attempts to overwrite the instantiated expression. This has some extremely marginal impact on user-facing semantics. However, the major effect is that it avoids IRGen errors about conflicting definitions due to lambdas in the argument being instantiated multiple times while sharing the same mangling. It should also slightly improve memory usage and module file size. rdar://23810407 llvm-svn: 256983
* [OpenMP] Reapply rL256842: [OpenMP] Offloading descriptor registration and ↵Samuel Antao2016-01-062-0/+14
| | | | | | | | | | | | device codegen. This patch attempts to fix the regressions identified when the patch was committed initially. Thanks to Michael Liao for identifying the fix in the offloading metadata generation related with side effects in evaluation of function arguments. llvm-svn: 256933
* [OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and ↵Samuel Antao2016-01-052-14/+0
| | | | | | | | device codegen. It was causing two regression, so I'm reverting until the cause is found. llvm-svn: 256858
* [OpenMP] Offloading descriptor registration and device codegen.Samuel Antao2016-01-052-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In order to offloading work properly two things need to be in place: - a descriptor with all the offloading information (device entry functions, and global variable) has to be created by the host and registered in the OpenMP offloading runtime library. - all the device functions need to be emitted for the device and a convention has to be in place so that the runtime library can easily map the host ID of an entry point with the actual function in the device. This patch adds support for these two things. However, only entry functions are being registered given that 'declare target' directive is not yet implemented. About offloading descriptor: The details of the descriptor are explained with more detail in http://goo.gl/L1rnKJ. Basically the descriptor will have fields that specify the number of devices, the pointers to where the device images begin and end (that will be defined by the linker), and also pointers to a the begin and end of table whose entries contain information about a specific entry point. Each entry has the type: ``` struct __tgt_offload_entry{ void *addr; char *name; int64_t size; }; ``` and will be implemented in a pre determined (ELF) section `.omp_offloading.entries` with 1-byte alignment, so that when all the objects are linked, the table is in that section with no padding in between entries (will be like a C array). The code generation ensures that all `__tgt_offload_entry` entries are emitted in the same order for both host and device so that the runtime can have the corresponding entries in both host and device in same index of the table, and efficiently implement the mapping. The resulting descriptor is registered/unregistered with the runtime library using the calls `__tgt_register_lib` and `__tgt_unregister_lib`. The registration is implemented in a high priority global initializer so that the registration happens always before any initializer (that can potentially include target regions) is run. The driver flag -omptargets= was created to specify a comma separated list of devices the user wants to support so that the new functionality can be exercised. Each device is specified with its triple. About target codegen: The target codegen is pretty much straightforward as it reuses completely the logic of the host version for the same target region. The tricky part is to identify the meaningful target regions in the device side. Unlike other programming models, like CUDA, there are no already outlined functions with attributes that mark what should be emitted or not. So, the information on what to emit is passed in the form of metadata in host bc file. This requires a new option to pass the host bc to the device frontend. Then everything is similar to what happens in CUDA: the global declarations emission is intercepted to check to see if it is an "interesting" declaration. The difference is that instead of checking an attribute, the metadata information in checked. Right now, there is only a form of metadata to pass information about the device entry points (target regions). A class `OffloadEntriesInfoManagerTy` was created to manage all the information and queries related with the metadata. The metadata looks like this: ``` !omp_offload.info = !{!0, !1, !2, !3, !4, !5, !6} !0 = !{i32 0, i32 52, i32 77426347, !"_ZN2S12r1Ei", i32 479, i32 13, i32 4} !1 = !{i32 0, i32 52, i32 77426347, !"_ZL7fstatici", i32 461, i32 11, i32 5} !2 = !{i32 0, i32 52, i32 77426347, !"_Z9ftemplateIiET_i", i32 444, i32 11, i32 6} !3 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 99, i32 11, i32 0} !4 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 272, i32 11, i32 3} !5 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 127, i32 11, i32 1} !6 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 159, i32 11, i32 2} ``` The fields in each metadata entry are (in sequence): Entry 1) an ID of the type of metadata - right now only zero is used meaning "OpenMP target region". Entry 2) a unique ID of the device where the input source file that contain the target region lives. Entry 3) a unique ID of the file where the input source file that contain the target region lives. Entry 4) a mangled name of the function that encloses the target region. Entries 5) and 6) line and column number where the target region was found. Entry 7) is the order the entry was emitted. Entry 2) and 3) are required to distinguish files that have the same function name. Entry 4) is required to distinguish different instances of the same declaration (usually templated ones) Entries 5) and 6) are required to distinguish the particular target region in body of the function (it is possible that a given target region is not an entry point - if clause can evaluate always to zero - and therefore we need to identify the "interesting" target regions. ) This patch replaces http://reviews.llvm.org/D12306. Reviewers: ABataev, hfinkel, tra, rjmccall, sfantao Subscribers: FBrygidyn, piotr.rak, Hahnfeld, cfe-commits Differential Revision: http://reviews.llvm.org/D12614 llvm-svn: 256842
* [TrailingObjects] Convert classes in ExprObjC.hJames Y Knight2015-12-311-2/+4
| | | | llvm-svn: 256659
* [TrailingObjects] Convert remaining classes in Expr.h and ExprCXX.hJames Y Knight2015-12-311-4/+5
| | | | llvm-svn: 256658
* [TrailingObjects] Convert OffsetOfExpr.James Y Knight2015-12-292-23/+22
| | | | | | That necessitated moving the OffsetOfNode class out of OffsetOfExpr. llvm-svn: 256590
* [TrailingObjects] Convert Decl* classes.James Y Knight2015-12-291-6/+9
| | | | | | | | Also remove now-redundant explicit alignment specification on some of the classes converted prior to TrailingObjects automatically ensuring proper alignment. llvm-svn: 256585
* [TrailingObjects] Convert AST classes that had a ASTTemplateKWAndArgsInfo.James Y Knight2015-12-292-32/+47
| | | | | | | | | | | | | | | | | | | | So, also: - Moved the TemplateArgumentLoc array out of the ASTTemplateKWAndArgsInfo class (making it a simple fixed-size object), to avoid needing to have a variable-length object as part of a variable-length object. Now the objects that have a ASTTemplateKWAndArgsInfo also have some TemplateArgumentLoc objects appended directly. - Removed some internal-use accessors which became simply a wrapper on getTrailingObjects. - Moved MemberNameQualifier out of the MemberExpr class, renamed it MemberExprNameQualifier, because the template can't refer to a class nested within the class it's defining. llvm-svn: 256570
* [OPENMP 4.5] Sema/parsing support for extended format of 'schedule' clause.Alexey Bataev2015-12-282-0/+10
| | | | | | | | | OpenMP 4.0-3.1 supports the next format of ‘schedule’ clause: schedule(kind[, chunk_size]) Where kind can be one of ‘static’, ‘dynamic’, ‘guided’, ‘auto’ or ‘runtime’. OpenMP 4.5 defines the format: schedule([modifier [, modifier]:]kind[, chunk_size]) Modifier can be one of ‘monotonic’, ‘nonmonotonic’ or ‘simd’. llvm-svn: 256487
* ArrayRef-ize TemplateParameterList. NFCDavid Majnemer2015-12-271-1/+1
| | | | llvm-svn: 256463
* [TrailingObjects] Convert ASTTemplateKWAndArgsInfo and ↵James Y Knight2015-12-241-1/+1
| | | | | | | | | | | | | | | | | | | ASTTemplateArgumentListInfo. Doing so required separating them so that the former doesn't inherit from the latter anymore. Investigating that, it became clear that the inheritance wasn't actually providing real value in any case. So also: - Remove a bunch of redundant functions (getExplicitTemplateArgs, getOptionalExplicitTemplateArgs) on various Expr subclasses which depended on the inheritance relationship. - Switched external callers to use pre-existing accessors that return the data they're actually interested in (getTemplateArgs, getNumTemplateArgs, etc). - Switched internal callers to use pre-existing getTemplateKWAndArgsInfo. llvm-svn: 256359
* [OPENMP 4.5] Parsing/sema for 'hint' clause of 'critical' directive.Alexey Bataev2015-12-152-1/+18
| | | | | | OpenMP 4.5 adds 'hint' clause to critical directive. Patch adds parsing/semantic analysis for this clause. llvm-svn: 255625
* Add parse and sema of OpenMP distribute directive with all clauses except ↵Carlo Bertolli2015-12-142-0/+17
| | | | | | dist_schedule llvm-svn: 255498
* [modules] If the semantic and lexical DC of a decl are the same, write out theRichard Smith2015-12-112-17/+32
| | | | | | | second one as 0 instead of writing the same bits to the module file twice. This typically reduces PCM file size by about 1%. llvm-svn: 255384
* Revert r255001, "Add parse and sema for OpenMP distribute directive and all ↵NAKAMURA Takumi2015-12-092-17/+0
| | | | | | | | its clauses excluding dist_schedule." It causes memory leak. Some tests in test/OpenMP would fail. llvm-svn: 255094
* Module file extensions: pass a Sema through to the extension writer.Douglas Gregor2015-12-081-3/+4
| | | | | | | | Module file extensions are likely to need access to Sema/Preprocessor/ASTContext, and cannot get it through other sources. llvm-svn: 255065
* Use range loops and autos in lib/Serialization/ASTWriter.cpp.Eugene Zelenko2015-12-081-127/+103
| | | | | | Differential revision: http://reviews.llvm.org/D15311 llvm-svn: 255033
* [OPENMP 4.5] Parsing/sema for 'num_tasks' clause.Alexey Bataev2015-12-082-0/+13
| | | | | | OpenMP 4.5 adds directives 'taskloop' and 'taskloop simd'. These directives support clause 'num_tasks'. Patch adds parsing/semantic analysis for this clause. llvm-svn: 255008
OpenPOWER on IntegriCloud