summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* [modules] Change module manager visitation order to be a bit more stable whenRichard Smith2015-07-221-13/+9
| | | | | | | | | | | more modules are added: visit modules depth-first rather than breadth-first. The visitation is still (approximately) oldest-to-newest, and still guarantees that a module is visited before anything it imports, so modules that are imported by others sometimes need to jump to a later position in the visitation order when more modules are loaded, but independent module trees don't interfere with each other any more. llvm-svn: 242863
* [modules] In C++, stop serializing and deserializing a list of declarations inRichard Smith2015-07-212-25/+37
| | | | | | | | | the identifier table. This is redundant, since the TU-scope lookups are also serialized as part of the TU DeclContext, and wasteful in a number of ways. We still emit the decls for PCH / preamble builds, since for those we want identical results, not merely semantically equivalent ones. llvm-svn: 242855
* Commit for http://reviews.llvm.org/D10765Michael Wong2015-07-212-0/+18
| | | | | | | for OpenMP 4 target data directive parsing and sema. This commit is on behalf of Kelvin Li. llvm-svn: 242785
* [modules] Don't save uninteresting identifiers, and don't consider identifiersRichard Smith2015-07-192-12/+27
| | | | | | | to be interesting just because they are the name of a builtin. Reduces the size of an empty module by over 80% (~100KB). llvm-svn: 242650
* Stop treating extension keywords as 'interesting'; we don't allow the extensionRichard Smith2015-07-172-4/+2
| | | | | | | flag to change between serialization and deserialization, so it does not require the identifier to be serialized. llvm-svn: 242567
* Refactor to remove repetition, no functionality change.Richard Smith2015-07-171-40/+27
| | | | llvm-svn: 242564
* Remove redundant bouncing between StringRef and a pair of 'const char *'.Richard Smith2015-07-171-2/+1
| | | | llvm-svn: 242562
* Make the clang module container format selectable from the command line.Adrian Prantl2015-07-173-19/+19
| | | | | | | | | | | | | - introduces a new cc1 option -fmodule-format=[raw,obj] with 'raw' being the default - supports arbitrary module container formats that libclang is agnostic to - adds the format to the module hash to avoid collisions - splits the old PCHContainerOperations into PCHContainerWriter and a PCHContainerReader. Thanks to Richard Smith for reviewing this patch! llvm-svn: 242499
* [modules] Switch to the normal reverse postorder visitation algorithm when ↵Richard Smith2015-07-152-80/+82
| | | | | | computing redeclaration chains. llvm-svn: 242253
* [modules] Avoid repeatedly hashing the same name when looking it up in ↵Richard Smith2015-07-142-47/+57
| | | | | | multiple module files. llvm-svn: 242180
* Extend -ftime-report to give more information about time spent reading ↵Richard Smith2015-07-141-1/+11
| | | | | | module files. llvm-svn: 242094
* Minor simplification, no functionality change.Richard Smith2015-07-122-17/+3
| | | | llvm-svn: 242001
* [modules] Improve performance when there is a local declaration of an entityRichard Smith2015-07-124-131/+169
| | | | | | | | before the first imported declaration. We don't need to track all formerly-canonical declarations of an entity; it's sufficient to track those ones for which no other formerly-canonical declaration was imported into the same module. We call those ones "key declarations", and use them as our starting points for collecting redeclarations and performing namespace lookups. llvm-svn: 241999
* [modules] Fix crash when writing an update record for a redeclaration of an ↵Richard Smith2015-07-081-4/+6
| | | | | | empty namespace. llvm-svn: 241732
* Revert "Revert r241620 and follow-up commits" and move the initializationAdrian Prantl2015-07-081-2/+1
| | | | | | of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp. llvm-svn: 241653
* Revert r241620 and follow-up commits while investigating linux buildbot ↵Adrian Prantl2015-07-071-1/+2
| | | | | | failures. llvm-svn: 241642
* Wrap clang modules and pch files in an object file container.Adrian Prantl2015-07-071-2/+1
| | | | | | | | | | | | | This patch adds ObjectFilePCHContainerOperations uses the LLVM backend to put the contents of a PCH into a __clangast section inside a COFF, ELF, or Mach-O object file container. This is done to facilitate module debugging by makeing it possible to store the debug info for the types defined by a module alongside the AST. rdar://problem/20091852 llvm-svn: 241620
* Implement variance for Objective-C type parameters.Douglas Gregor2015-07-072-0/+4
| | | | | | | | | | | | | | | Introduce co- and contra-variance for Objective-C type parameters, which allows us to express that (for example) an NSArray is covariant in its type parameter. This means that NSArray<NSMutableString *> * is a subtype of NSArray<NSString *> *, which is expected of the immutable Foundation collections. Type parameters can be annotated with __covariant or __contravariant to make them co- or contra-variant, respectively. This feature can be detected by __has_feature(objc_generics_variance). Implements rdar://problem/20217490. llvm-svn: 241549
* Implement the Objective-C __kindof type qualifier.Douglas Gregor2015-07-072-1/+3
| | | | | | | | | | The __kindof type qualifier can be applied to Objective-C object (pointer) types to indicate id-like behavior, which includes implicit "downcasting" of __kindof types to subclasses and id-like message-send behavior. __kindof types provide better type bounds for substitutions into unspecified generic types, which preserves more type information. llvm-svn: 241548
* Substitute type arguments into uses of Objective-C interface members.Douglas Gregor2015-07-073-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When messaging a method that was defined in an Objective-C class (or category or extension thereof) that has type parameters, substitute the type arguments for those type parameters. Similarly, substitute into property accesses, instance variables, and other references. This includes general infrastructure for substituting the type arguments associated with an ObjCObject(Pointer)Type into a type referenced within a particular context, handling all of the substitutions required to deal with (e.g.) inheritance involving parameterized classes. In cases where no type arguments are available (e.g., because we're messaging via some unspecialized type, id, etc.), we substitute in the type bounds for the type parameters instead. Example: @interface NSSet<T : id<NSCopying>> : NSObject <NSCopying> - (T)firstObject; @end void f(NSSet<NSString *> *stringSet, NSSet *anySet) { [stringSet firstObject]; // produces NSString* [anySet firstObject]; // produces id<NSCopying> (the bound) } When substituting for the type parameters given an unspecialized context (i.e., no specific type arguments were given), substituting the type bounds unconditionally produces type signatures that are too strong compared to the pre-generics signatures. Instead, use the following rule: - In covariant positions, such as method return types, replace type parameters with “id” or “Class” (the latter only when the type parameter bound is “Class” or qualified class, e.g, “Class<NSCopying>”) - In other positions (e.g., parameter types), replace type parameters with their type bounds. - When a specialized Objective-C object or object pointer type contains a type parameter in its type arguments (e.g., NSArray<T>*, but not NSArray<NSString *> *), replace the entire object/object pointer type with its unspecialized version (e.g., NSArray *). llvm-svn: 241543
* Handle Objective-C type arguments.Douglas Gregor2015-07-074-9/+22
| | | | | | | | | | | | | | | | | | | | | Objective-C type arguments can be provided in angle brackets following an Objective-C interface type. Syntactically, this is the same position as one would provide protocol qualifiers (e.g., id<NSCopying>), so parse both together and let Sema sort out the ambiguous cases. This applies both when parsing types and when parsing the superclass of an Objective-C class, which can now be a specialized type (e.g., NSMutableArray<T> inherits from NSArray<T>). Check Objective-C type arguments against the type parameters of the corresponding class. Verify the length of the type argument list and that each type argument satisfies the corresponding bound. Specializations of parameterized Objective-C classes are represented in the type system as distinct types. Both specialized types (e.g., NSArray<NSString *> *) and unspecialized types (NSArray *) are represented, separately. llvm-svn: 241542
* Parsing, semantic analysis, and AST for Objective-C type parameters.Douglas Gregor2015-07-073-1/+63
| | | | | | | | | | | | | | | | | | | | Produce type parameter declarations for Objective-C type parameters, and attach lists of type parameters to Objective-C classes, categories, forward declarations, and extensions as appropriate. Perform semantic analysis of type bounds for type parameters, both in isolation and across classes/categories/extensions to ensure consistency. Also handle (de-)serialization of Objective-C type parameter lists, along with sundry other things one must do to add a new declaration to Clang. Note that Objective-C type parameters are typedef name declarations, like typedefs and C++11 type aliases, in support of type erasure. Part of rdar://problem/6294649. llvm-svn: 241541
* [OPENMP 4.0] Initial support for 'omp cancel' construct.Alexey Bataev2015-07-022-0/+17
| | | | | | Implemented parsing/sema analysis + (de)serialization. llvm-svn: 241253
* [modules] Merging support for specializations of a function template. This veryRichard Smith2015-07-011-5/+5
| | | | | | | rarely matters, but can affect whether two dependent types are canonically equivalent. llvm-svn: 241207
* [modules] Remove some out-of-date (fixed) FIXMEs.Richard Smith2015-07-011-9/+0
| | | | llvm-svn: 241205
* [OPENMP 4.0] Initial support for 'omp cancellation point' construct.Alexey Bataev2015-07-012-0/+19
| | | | | | Add parsing and sema analysis for 'omp cancellation point' directive. llvm-svn: 241145
* Add a function to ExternalASTSource that returns a descriptor thatAdrian Prantl2015-06-301-0/+32
| | | | | | | abstracts the commonalities between modules and PCH files that are needed to emit debug info for a module or precompiled header. llvm-svn: 241083
* Remove unnecessary include.Adrian Prantl2015-06-291-1/+0
| | | | llvm-svn: 240963
* [ObjC] Add NSValue support for objc_boxed_expressionsAlex Denisov2015-06-263-2/+23
| | | | | | | | | | | | | Patch extends ObjCBoxedExpr to accept records (structs and unions): typedef struct __attribute__((objc_boxable)) _Color { int r, g, b; } Color; Color color; NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)]; llvm-svn: 240761
* [modules] Properly merge visibility of class definitions that got merged whileRichard Smith2015-06-251-5/+7
| | | | | | parsing then merged again when the module was loaded. llvm-svn: 240700
* Use AddString/ReadString instead of doing it manually NFCBen Langmuir2015-06-232-8/+3
| | | | llvm-svn: 240434
* [Modules] Consider -fmodule-feature in module hash and when loadingBen Langmuir2015-06-232-0/+13
| | | | | | | Any extra features from -fmodule-feature are part of the module hash and need to get validated on load. Also print them with -module-file-info. llvm-svn: 240433
* [OPENMP] Initial support for 'depend' clause (4.0).Alexey Bataev2015-06-232-0/+26
| | | | | | Parsing and sema analysis (without support for array sections in arguments) for 'depend' clause (used in 'task' directive, OpenMP 4.0). llvm-svn: 240409
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-229-32/+31
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-229-31/+32
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* ASTReader: Treat InputFileOffsets as unaligned to avoid UBJustin Bogner2015-06-211-1/+2
| | | | | | | | | | This is a better approach to fixing the undefined behaviour I tried to fix in r240228. This data doesn't necessarily have suitable alignment for uint64_t, so use unaligned_uint64_t instead. This fixes 225 test failures when clang is built with ubsan. llvm-svn: 240247
* Revert "ASTReader: Copy input file offset data to avoid unaligned accesses"Justin Bogner2015-06-211-10/+2
| | | | | | | | | We can do this better by changing the type to unaligned_uint64_t and paying the cost on use instead of up front. This reverts r240228 llvm-svn: 240246
* ASTReader: Copy input file offset data to avoid unaligned accessesJustin Bogner2015-06-201-2/+10
| | | | | | | | | | We interpret Blob as an array of uint64_t here, but there's no reason to think that it has suitable alignment. Instead, read the data in in an alignment-safe way and store it in a std::vector. This fixes 225 test failures when clang is built with ubsan. llvm-svn: 240228
* Introduce a PCHContainerOperations interface (NFC).Adrian Prantl2015-06-204-60/+59
| | | | | | | | | | | | | | | | A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
* [modules] When determining whether a definition of a class is visible, check ↵Richard Smith2015-06-201-0/+3
| | | | | | all modules even if we've already found a definition that's not visible. llvm-svn: 240204
* [modules] Refactor and slightly simplify class definition merging.Richard Smith2015-06-201-48/+26
| | | | llvm-svn: 240200
* Extend type nullability qualifiers for Objective-C.Douglas Gregor2015-06-192-2/+5
| | | | | | | | | | | | | | | Introduce context-sensitive, non-underscored nullability specifiers (nonnull, nullable, null_unspecified) for Objective-C method return types, method parameter types, and properties. Introduce Objective-C-specific semantics, including computation of the nullability of the result of a message send, merging of nullability information from the @interface of a class into its @implementation, etc . This is the Objective-C part of rdar://problem/18868820. llvm-svn: 240154
* [modules] Merging support for enums with a local definition prior to the firstRichard Smith2015-06-181-43/+54
| | | | | | imported definition. llvm-svn: 240068
* [OPENMP] Support for '#pragma omp taskgroup' directive.Alexey Bataev2015-06-182-0/+15
| | | | | | | | | | | | | Added parsing, sema analysis and codegen for '#pragma omp taskgroup' directive (OpenMP 4.0). The code for directive is generated the following way: #pragma omp taskgroup <body> void __kmpc_taskgroup(<loc>, thread_id); <body> void __kmpc_end_taskgroup(<loc>, thread_id); llvm-svn: 240011
* [modules] Ensure that if we merge the definitions of two enumerations, thatRichard Smith2015-06-171-17/+23
| | | | | | making either of them visible makes the merged definition visible. llvm-svn: 239969
* [modules] Fix typo in default argument merging.Richard Smith2015-06-171-3/+3
| | | | llvm-svn: 239954
* [OPENMP] Remove last iteration separation for loop-based constructs.Alexey Bataev2015-06-162-5/+2
| | | | | | Previously the last iteration for simd loop-based OpenMP constructs were generated as a separate code. This feature is not required and codegen is simplified. llvm-svn: 239810
* [modules] Better support for redefinitions of an entity from the same module.Richard Smith2015-06-151-3/+0
| | | | | | | Support this across module save/reload and extend the 'missing import' diagnostics with a list of providing modules. llvm-svn: 239750
* push_back() loop -> append() for random access iterators.Benjamin Kramer2015-06-121-2/+1
| | | | | | | append will resize the vector to the optimal size. No functional change intended. llvm-svn: 239607
* [modules] Track all default template arguments for a given parameter acrossRichard Smith2015-06-101-2/+1
| | | | | | | modules, and allow use of a default template argument if any of the parameters providing it is visible. llvm-svn: 239485
OpenPOWER on IntegriCloud