summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* [modules] Reconstruct template default argument inheritance on reload ratherRichard Smith2015-06-102-29/+57
| | | | | | than wasting storage and triggering eager deserializations by serializing it. llvm-svn: 239454
* Refactor storage of default template arguments.Richard Smith2015-06-102-18/+37
| | | | | | | This is just a preparatory step towards fixing visibility for default template arguments in modules builds. llvm-svn: 239447
* Implementing C99 partial re-initialization behavior (DR-253)Yunzhong Gao2015-06-103-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | Based on previous discussion on the mailing list, clang currently lacks support for C99 partial re-initialization behavior: Reference: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-April/029188.html Reference: http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_253.htm This patch attempts to fix this problem. Given the following code snippet, struct P1 { char x[6]; }; struct LP1 { struct P1 p1; }; struct LP1 l = { .p1 = { "foo" }, .p1.x[2] = 'x' }; // this example is adapted from the example for "struct fred x[]" in DR-253; // currently clang produces in l: { "\0\0x" }, // whereas gcc 4.8 produces { "fox" }; // with this fix, clang will also produce: { "fox" }; Differential Review: http://reviews.llvm.org/D5789 llvm-svn: 239446
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-291-4/+3
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238601
* Refactor MacroInfo so macro arguments can be iterated with range-based for ↵Daniel Marjamaki2015-05-291-3/+2
| | | | | | | | | | loops. No functional change intended. Patch by Sebastian Edman! llvm-svn: 238547
* Rename a helper template function to 'bytes' to avoid a C++17 STL conflictReid Kleckner2015-05-211-15/+15
| | | | | | | | | MSVC 2015 includes the std::data() template function added to C++17. ADL causes both cl.exe and clang-cl to prefer std::data over our static helper here, and we get errors about converting int64_t* to StringRef. Renaming it to bytes avoids the ambiguity. llvm-svn: 237863
* Allow skipping imports in the module visitor.Manuel Klimek2015-05-203-35/+99
| | | | | | | Skip imports when we know that we do not need to visit any imports because we've already deserialized the redecls from a module. llvm-svn: 237782
* [AST] Put VarDeclBitfields on a dietDavid Majnemer2015-05-192-21/+18
| | | | | | | | VarDeclBitfields contained bits which are never present in parameters. Split these out so that ParmVarDeclBitfields wouldn't grow past 32-bits if another field was added. llvm-svn: 237648
* Detect uses of mismatching forms of 'new' and 'delete'Ismail Pazarbasi2015-05-182-1/+45
| | | | | | | | | | | | | | | | | Emit warning when operand to `delete` is allocated with `new[]` or operand to `delete[]` is allocated with `new`. rev 2 update: `getNewExprFromInitListOrExpr` should return `dyn_cast_or_null` instead of `dyn_cast`, since `E` might be null. Reviewers: rtrieu, jordan_rose, rsmith Subscribers: majnemer, cfe-commits Differential Revision: http://reviews.llvm.org/D4661 llvm-svn: 237608
* [modules] Retain the name as written for umbrella headers and directories, ↵Richard Smith2015-05-162-12/+15
| | | | | | rather than converting to an absolute path. No observable change expected, but this allows us to correctly compute the module for an umbrella header, which later changes will require. llvm-svn: 237508
* [modules] Add local submodule visibility support for declarations.Richard Smith2015-05-153-17/+39
| | | | | | | | | | | | With this change, enabling -fmodules-local-submodule-visibility results in name visibility rules being applied to submodules of the current module in addition to imported modules (that is, names no longer "leak" between submodules of the same top-level module). This also makes it much safer to textually include a non-modular library into a module: each submodule that textually includes that library will get its own "copy" of that library, and so the library becomes visible no matter which including submodule you import. llvm-svn: 237473
* Refactor: when exposing a definition in some module, provide listeners with theRichard Smith2015-05-151-4/+3
| | | | | | module rather than requiring them to work it out themselves. llvm-svn: 237416
* Revert "Detect uses of mismatching forms of 'new' and 'delete'"Diego Novillo2015-05-142-45/+1
| | | | | | | | | This reverts commit 742dc9b6c9686ab52860b7da39c3a126d8a97fbc. This is generating multiple segfaults in our internal builds. Test case coming up shortly. llvm-svn: 237391
* Detect uses of mismatching forms of 'new' and 'delete'Ismail Pazarbasi2015-05-142-1/+45
| | | | | | | | | | | | | Emit warning when operand to `delete` is allocated with `new[]` or operand to `delete[]` is allocated with `new`. Reviewers: rtrieu, jordan_rose, rsmith Subscribers: majnemer, cfe-commits Differential Revision: http://reviews.llvm.org/D4661 llvm-svn: 237368
* [modules] Fix a #include cycle when building a module for our builtin headers.Richard Smith2015-05-141-5/+9
| | | | | | | | | | xmmintrin.h includes emmintrin.h and vice versa if SSE2 is enabled. We break this cycle for a modules build, and instead make the xmmintrin.h module re-export the immintrin.h module. Also included is a fix for an assert in the serialization code if a module exports another module that was declared later in the same module map. llvm-svn: 237321
* [OPENMP] Fixed support for 'schedule' clause with non-constant chunk size.Alexey Bataev2015-05-122-0/+2
| | | | | | 'schedule' clause for combined directives requires additional processing. Special helper variable is generated, that is captured in the outlined parallel region for 'parallel for' region. This captured variable is used to store chunk expression from the 'schedule' clause in this 'parallel for' region. llvm-svn: 237100
* [modules] Don't bother registering loaded macros if there are none.Richard Smith2015-05-041-1/+2
| | | | | | We don't yet have a reduced testcase for this. llvm-svn: 236454
* Rename MacroDefinition -> MacroDefinitionRecord, ↵Richard Smith2015-05-042-15/+15
| | | | | | | | | | Preprocessor::MacroDefinition -> MacroDefinition. clang::MacroDefinition now models the currently-defined value of a macro. The previous MacroDefinition type, which represented a record of a macro definition directive for a detailed preprocessing record, is now called MacroDefinitionRecord. llvm-svn: 236400
* [modules] Remove dead code from Module for tracking macro import locations.Richard Smith2015-05-022-8/+2
| | | | llvm-svn: 236376
* [modules] If a module #includes a modular header that #undef's its macro, itRichard Smith2015-05-021-1/+1
| | | | | | | | should not export the macro. ... at least, not unless we have local submodule visibility enabled. llvm-svn: 236369
* [modules] Add -fmodules-local-submodule-visibility flag.Richard Smith2015-05-011-28/+17
| | | | | | | | | | | | | | | This flag specifies that the normal visibility rules should be used even for local submodules (submodules of the currently-being-built module). Thus names will only be visible if a header / module that declares them has actually been included / imported, and not merely because a submodule that happened to be built earlier declared those names. This also removes the need to modularize bottom-up: textually-included headers will be included into every submodule that includes them, since their include guards will not leak between modules. So far, this only governs visibility of macros, not of declarations, so is not ready for real use yet. llvm-svn: 236350
* Fix a few line endings. NFC.Yunzhong Gao2015-05-012-19/+19
| | | | llvm-svn: 236301
* [modules] Start moving the module visibility information off the Module itself.Richard Smith2015-05-012-35/+7
| | | | | | | It has no place there; it's not a property of the Module, and it makes restoring the visibility set when we leave a submodule more difficult. llvm-svn: 236300
* Remove dead code: a MacroDirective can't be imported or ambiguous any more.Richard Smith2015-04-302-26/+3
| | | | llvm-svn: 236197
* [modules] Stop trying to fake up a linear MacroDirective history.Richard Smith2015-04-293-196/+7
| | | | | | | | | | | | | | Modules builds fundamentally have a non-linear macro history. In the interest of better source fidelity, represent the macro definition information faithfully: we have a linear macro directive history within each module, and at any point we have a unique "latest" local macro directive and a collection of visible imported directives. This also removes the attendent complexity of attempting to create a correct MacroDirective history (which we got wrong in the general case). No functionality change intended. llvm-svn: 236176
* [modules] Refactor creation of ModuleMacros and create them when importing ↵Richard Smith2015-04-231-7/+6
| | | | | | from local submodules. llvm-svn: 235669
* [modules] Remove the now-redundant import of all pending macros at the end ↵Richard Smith2015-04-231-27/+8
| | | | | | | | | of building a module. Since we now track module macros separately from their visibility state, this is no longer necessary. llvm-svn: 235648
* [modules] Store a ModuleMacro* on an imported macro directive rather than ↵Richard Smith2015-04-232-71/+46
| | | | | | duplicating the info within it. llvm-svn: 235644
* [modules] Determine the set of macros exported by a submodule at the end of ↵Richard Smith2015-04-232-111/+28
| | | | | | | | | | | that submodule. Previously we'd defer this determination until writing the AST, which doesn't allow us to use this information when building other submodules of the same module. This change also allows us to use a uniform mechanism for writing module macro records, independent of whether they are local or imported. llvm-svn: 235614
* Silencing a -Wunused-variable warning; NFC.Aaron Ballman2015-04-221-2/+1
| | | | llvm-svn: 235512
* [modules] Cope with partial module macro information, fix memory leak found ↵Richard Smith2015-04-221-6/+4
| | | | | | by buildbot. llvm-svn: 235464
* [modules] Build a DAG of module macros for each identifier.Richard Smith2015-04-221-28/+36
| | | | | | | | This graph will be used to determine the current set of active macros. This is foundation work for getting macro visibility correct across submodules of the current module. No functionality change for now. llvm-svn: 235461
* [modules] Move list of exported module macros from IdentifierInfo lookup ↵Richard Smith2015-04-212-398/+216
| | | | | | | | | table to separate storage, adjacent to the macro directive history. This is substantially simpler, provides better space usage accounting in bcanalyzer, and gives a more compact representation. No functionality change intended. llvm-svn: 235420
* Try to work around failure to convert this lambda to a function pointer in ↵Richard Smith2015-04-191-4/+5
| | | | | | some versions of GCC. llvm-svn: 235264
* [modules] Refactor macro emission. No functionality change.Richard Smith2015-04-191-76/+73
| | | | llvm-svn: 235263
* Revert file unintentionally changed in r235162.Daniel Jasper2015-04-171-1/+1
| | | | llvm-svn: 235163
* clang-format: Add default fallback style.Daniel Jasper2015-04-171-1/+1
| | | | | | Thanks to Michael Schlottke. llvm-svn: 235162
* [OPENMP] Codegen for 'copyin' clause in 'parallel' directive.Alexey Bataev2015-04-162-4/+22
| | | | | | | | | | | | | | | Emits the following code for the clause at the beginning of the outlined function for implicit threads: if (<not a master thread>) { ... <thread local copy of var> = <master thread local copy of var>; ... } <sync point>; Checking for a non-master thread is performed by comparing of the address of the thread local variable with the address of the master's variable. Master thread always uses original variables, so you always know the address of the variable in the master thread. Differential Revision: http://reviews.llvm.org/D9026 llvm-svn: 235075
* [OPENMP] Codegen for 'lastprivate' clause in 'for' directive.Alexey Bataev2015-04-162-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | #pragma omp for lastprivate(<var>) for (i = a; i < b; ++b) <BODY>; This construct is translated into something like: <last_iter> = alloca i32 <lastprivate_var> = alloca <type> <last_iter> = 0 ; No initializer for simple variables or a default constructor is called for objects. ; For arrays perform element by element initialization by the call of the default constructor. ... OMP_FOR_START(...,<last_iter>, ..); sets <last_iter> to 1 if this is the last iteration. <BODY> ... OMP_FOR_END if (<last_iter> != 0) { <var> = <lastprivate_var> ; Update original variable with the lastprivate value. } call __kmpc_cancel_barrier() ; an implicit barrier to avoid possible data race. Differential Revision: http://reviews.llvm.org/D8658 llvm-svn: 235074
* Workaround a performance issue with modules + PCHBen Langmuir2015-04-101-1/+4
| | | | | | | | | | | | More fallout from r228234; when looking up an identifier in a PCH that imports the Cocoa module on Darwin, it was taking 2 to 5 seconds because we were hammering the MapVector::erase() function, which is O(n). For now, just clear() the contained SmallVector to get back to 0.25 - 0.5 seconds. This is probably not the long-term fix, because without modules or without PCH the performance is more like 0.02 seconds. llvm-svn: 234655
* [OPENMP] Codegen for 'reduction' clause in 'parallel' directive.Alexey Bataev2015-04-102-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Emit a code for reduction clause. Next code should be emitted for reductions: static kmp_critical_name lock = { 0 }; void reduce_func(void *lhs[<n>], void *rhs[<n>]) { ... *(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]); ... } ... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]}; switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) { case 1: ... <LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]); ... __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>); break; case 2: ... Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i])); ... break; default: ; } Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation. Differential Revision: http://reviews.llvm.org/D8915 llvm-svn: 234583
* [modules] Remove unused MACRO_TABLE record.Richard Smith2015-04-102-41/+2
| | | | llvm-svn: 234555
* [OPENMP] Sema analysis for 'atomic capture' construct.Alexey Bataev2015-04-012-0/+2
| | | | | | Added sema checks for forms of expressions/statements allowed under control of 'atomic capture' directive + generation of helper objects for future codegen. llvm-svn: 233785
* [OPENMP] Codegen for 'atomic update' construct.Alexey Bataev2015-03-302-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds atomic update codegen for the following forms of expressions: x binop= expr; x++; ++x; x--; --x; x = x binop expr; x = expr binop x; If x and expr are integer and binop is associative or x is a LHS in a RHS of the assignment expression, and atomics are allowed for type of x on the target platform atomicrmw instruction is emitted. Otherwise compare-and-swap sequence is emitted: bb: ... atomic load <x> cont: <expected> = phi [ <x>, label %bb ], [ <new_failed>, %cont ] <desired> = <expected> binop <expr> <res> = cmpxchg atomic &<x>, desired, expected <new_failed> = <res>.field1; br <res>field2, label %exit, label %cont exit: ... Differential Revision: http://reviews.llvm.org/D8536 llvm-svn: 233513
* [Modules] Work around PR23030 again, in a different code path, whereChandler Carruth2015-03-271-6/+9
| | | | | | | | | | I again added the "reasonable" assertions and they again fired during a modules self-host. This hopefully will un-break the self-host build bot. No test case handy and adding one seems to have little or no value really. llvm-svn: 233426
* [modules] When merging class definitions, make the retained definition visibleRichard Smith2015-03-272-25/+31
| | | | | | | | if the merged definition is visible, and perform lookups into all merged copies of the definition (not just for special members) so that we can complete the redecl chains for members of the class. llvm-svn: 233420
* [Modules] When walking the lookup results in a namespace, sort them byChandler Carruth2015-03-271-9/+23
| | | | | | | | | | | | declaration name so that we mark declarations for emission in a deterministic order (and in turn give them deterministic IDs). This is the last for loop or data structure I can find by inspection of the AST writer which doesn't use a deterministic order. Found by inspection, no test case. llvm-svn: 233348
* [modules] Handle defining a tag with a typedef name for linkage purposes on ↵Richard Smith2015-03-271-6/+5
| | | | | | top of an existing imported-but-not-visible definition. llvm-svn: 233345
* [Modules] Make Sema's map of referenced selectors have a deterministicChandler Carruth2015-03-271-5/+3
| | | | | | | | | | | order based on order of insertion. This should cause both our warnings about these and the modules serialization to be deterministic as a consequence. Found by inspection. llvm-svn: 233343
* [Modules] Make our on-disk hash table of selector IDs be built inChandler Carruth2015-03-271-6/+5
| | | | | | | | | | a deterministic order. This uses a MapVector to track the insertion order of selectors. Found by inspection. llvm-svn: 233342
OpenPOWER on IntegriCloud