summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* Replace getPointeeType()->isFunctionType with isMemberDataPointerTypeDavid Majnemer2015-04-245-7/+6
| | | | llvm-svn: 235682
* [MS ABI] Fix the preferred alignment of member pointersDavid Majnemer2015-04-244-39/+43
| | | | | | | Member pointers in the MS ABI have different alignment depending on whether they were created on the stack or live in a record. llvm-svn: 235681
* Cleanup some MS-ABI specific codeDavid Majnemer2015-04-242-11/+12
| | | | | | No functional change intended. llvm-svn: 235680
* [modules] Partial revert of r235669: don't create ModuleMacros for imported ↵Richard Smith2015-04-241-6/+0
| | | | | | | | local macros. The surrounding infrastructure isn't quite ready for this yet. llvm-svn: 235677
* [modules] Refactor creation of ModuleMacros and create them when importing ↵Richard Smith2015-04-234-30/+44
| | | | | | from local submodules. llvm-svn: 235669
* InstrProf: Stop using RegionCounter outside of CodeGenPGO (NFC)Justin Bogner2015-04-2314-169/+145
| | | | | | | | | The RegionCounter type does a lot of legwork, but most of it is only meaningful within the implementation of CodeGenPGO. The uses elsewhere in CodeGen generally just want to increment or read counters, so do that directly. llvm-svn: 235664
* [modules] Properly attribute macros to modules if they're in a file ↵Richard Smith2015-04-237-9/+25
| | | | | | textually included into a file in the module. llvm-svn: 235661
* Fix clang docs build.Sergey Matveev2015-04-231-2/+2
| | | | llvm-svn: 235650
* [modules] Remove the now-redundant import of all pending macros at the end ↵Richard Smith2015-04-233-31/+10
| | | | | | | | | 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-239-175/+142
| | | | | | duplicating the info within it. llvm-svn: 235644
* Add clang/docs/SanitizerCoverage.rstSergey Matveev2015-04-232-0/+349
| | | | | | Moved from https://code.google.com/p/address-sanitizer/wiki/AsanCoverage llvm-svn: 235643
* [modules] Determine the set of macros exported by a submodule at the end of ↵Richard Smith2015-04-2312-148/+263
| | | | | | | | | | | 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
* Don't emit lifetime markers when msan is enabledReid Kleckner2015-04-232-3/+12
| | | | | | | | | | In r235553, Clang started emitting lifetime markers more often. This caused false negative in MSan, because MSan only poisons all allocas once at function entry. Eventually, MSan should poison allocas at lifetime start and probably also lifetime end, but until then, let's not emit markers that aren't going to be useful. llvm-svn: 235613
* Extend format specifier checking to include field function pointers in ↵Aaron Ballman2015-04-232-3/+21
| | | | | | addition to variable function pointers. Addresses PR21082. llvm-svn: 235606
* Diagnose variadic main() as an extension; addresses PR17905.Aaron Ballman2015-04-233-0/+10
| | | | llvm-svn: 235605
* clang-format: Properly detect variable declarations with ObjC.Daniel Jasper2015-04-232-1/+4
| | | | | | | | | | | | Before: LoooooooooooooooooooooooooooooooooooooooongType LoooooooooooooooooooooooooooooooooooooongVariable([A a]); After: LoooooooooooooooooooooooooooooooooooooooongType LoooooooooooooooooooooooooooooooooooooongVariable([A a]); llvm-svn: 235599
* clang-format: Allow splitting "= default" and "= delete".Daniel Jasper2015-04-232-1/+10
| | | | | | Otherwise, this can violate the column limit. llvm-svn: 235592
* clang-format: Don't add unwanted space when creating new arrays.Daniel Jasper2015-04-232-5/+6
| | | | | | | | | | Before: char** newargv = new char* [argc]; After: char** newargv = new char*[argc]; llvm-svn: 235583
* clang-format: [Proto] Don't linewrap top-level options.Daniel Jasper2015-04-232-2/+18
| | | | | | They are very similar to import statements. llvm-svn: 235582
* clang-format: Support nested block formatting with ColumnLimit=0.Daniel Jasper2015-04-234-31/+118
| | | | llvm-svn: 235580
* [OPENMP] Fix for failed tests for 'omp atomic write' construct.Alexey Bataev2015-04-232-6/+6
| | | | llvm-svn: 235576
* [MS ABI] Add support for mangling VLA typesDavid Majnemer2015-04-232-13/+16
| | | | | | Treat a VLA type like an incomplete array type. llvm-svn: 235575
* [OPENMP] Codegen for 'atomic capture'.Alexey Bataev2015-04-236-52/+1350
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds codegen for 'atomic capture' constructs with the following forms of expressions/statements: v = x binop= expr; v = x++; v = ++x; v = x--; v = --x; v = x = x binop expr; v = x = expr binop x; {v = x; x = binop= expr;} {v = x; x++;} {v = x; ++x;} {v = x; x--;} {v = x; --x;} {x = x binop expr; v = x;} {x binop= expr; v = x;} {x++; v = x;} {++x; v = x;} {x--; v = x;} {--x; v = x;} {x = x binop expr; v = x;} {x = expr binop x; v = x;} {v = x; x = expr;} 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. Update of 'v' is not required to be be atomic with respect to the read or write of the 'x'. 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: atomic store <old/new x>, <v> ... Differential Revision: http://reviews.llvm.org/D9049 llvm-svn: 235573
* [MS ABI] Treat ConstantArrayType like IncompleteArrayType in argsDavid Majnemer2015-04-232-4/+19
| | | | | | | | | | | | | Type backreferences for arguments use the DecayedType's original type. Because of this, arguments with the same canonical type with the same mangling would not backreference each other if one was a ConstantArrayType while the other was an IncompleteArrayType. Solve this by canonicalizing the ConstantArrayType to a suitable IncompleteArrayType. This fixes PR23325. llvm-svn: 235572
* [modules] Actually allocate the extra space we use for the tail-allocated arrayRichard Smith2015-04-231-3/+5
| | | | | | in this class. llvm-svn: 235570
* Unify the way we report overflow in increment/decrement operator.Alexey Samsonov2015-04-232-33/+31
| | | | | | | | | | | | | | | | | | | | Summary: Make sure signed overflow in "x--" is checked with llvm.ssub.with.overflow intrinsic and is reported as: "-2147483648 - 1 cannot be represented in type 'int'" instead of: "-2147483648 + -1 cannot be represented in type 'int'" , like we do for unsigned overflow. Test Plan: clang + compiler-rt regression test suite Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8236 llvm-svn: 235568
* InstrProf: Fix a shadowing error that would break length of profile namesJustin Bogner2015-04-232-5/+5
| | | | | | | | We try to use the member variable "FuncName" here, but we've also used that name as a parameter. This ends with us getting the length of the function name wrong when we generate the coverage data. llvm-svn: 235565
* [WinEH] Don't emit an exceptional cleanup for llvm.eh.endcatchReid Kleckner2015-04-222-3/+38
| | | | | | | | | These extra endcatch markers aren't helping identify regions to outline, so let's get rid of them. LLVM outlines (more or less) from begincatch to endcatch. Any unwind edge from an enclosed invoke is a transition to a new exception handler, which has it's own outlining markers. llvm-svn: 235562
* Fix another test broken by r235537Reid Kleckner2015-04-221-6/+3
| | | | llvm-svn: 235555
* Revert "Revert r234581, it might have caused a few miscompiles in Chromium."David Majnemer2015-04-2223-50/+419
| | | | | | | | This reverts commit r234700. It turns out that the lifetime markers were not the cause of Chromium failing but a bug which was uncovered by optimizations exposed by the markers. llvm-svn: 235553
* Fix test failure caused by r235537. It does not run on Windows due to ↵Reid Kleckner2015-04-221-17/+12
| | | | | | REQUIRES: shell llvm-svn: 235551
* Set normal LLVM function attributes on global initializer functionsReid Kleckner2015-04-223-3/+12
| | | | | | | | | | | Otherwise -fno-omit-frame-pointer and other flags like it aren't applied. Basic idea taken from Gao's patch, thanks! Differential Revision: http://reviews.llvm.org/D9203 llvm-svn: 235537
* Silencing a -Wunused-variable warning; NFC.Aaron Ballman2015-04-221-2/+1
| | | | llvm-svn: 235512
* [OPENMP] Codegen for 'if' clause in 'task' directive.Alexey Bataev2015-04-224-128/+324
| | | | | | | | | | | | | If condition evaluates to true, the code executes task by calling @__kmpc_omp_task() runtime function. If condition evaluates to false, the code executes serial version of the code by executing the following code: call void @__kmpc_omp_task_begin_if0(<loc>, <threadid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>); proxy_task_entry(<gtid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>); call void @__kmpc_omp_task_complete_if0(<loc>, <threadid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>); Also it checks if the condition is constant and if it is constant it evaluates its value and then generates either parallel version of the code (if the condition evaluates to true), or the serial version of the code (if the condition evaluates to false). Differential Revision: http://reviews.llvm.org/D9143 llvm-svn: 235507
* [OPENMP] Codegen for 'reduction' clause in 'for' directive.Alexey Bataev2015-04-222-0/+706
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>]) { *(Type0*)lhs[0] = ReductionOperation0(*(Type0*)lhs[0], *(Type0*)rhs[0]); ... *(Type<n>-1*)lhs[<n>-1] = ReductionOperation<n>-1(*(Type<n>-1*)lhs[<n>-1], *(Type<n>-1*)rhs[<n>-1]); } ... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n>-1]}; switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) { case 1: <LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]); ... <LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]); __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>); break; case 2: Atomic(<LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0])); ... Atomic(<LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1])); 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/D9139 llvm-svn: 235506
* [OPENMP] Codegen for 'private' clause in 'for' directive.Alexey Bataev2015-04-223-15/+202
| | | | | | | This patch generates helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'for' directive. These generated variables are initialized by default (with the default constructor, if any). In OpenMP region references to original variables are replaced by the references to these private helper variables. Differential Revision: http://reviews.llvm.org/D9106 llvm-svn: 235503
* [OPENMP] Fixed test incompatibility for simd codegen.Alexey Bataev2015-04-221-1/+1
| | | | llvm-svn: 235501
* [OPENMP] Fix use of unsigned counters in loops with zero trip count.Alexey Bataev2015-04-227-118/+159
| | | | | | | | Patch fixes bugs in codegen for loops with unsigned counters and zero trip count. Previously preconditions for all loops were built using logic (Upper - Lower) > 0. But if the loop is a loop with zero trip count, then Upper - Lower is < 0 only for signed integer, for unsigned we're running into an underflow situation. In this patch we're using original Lower<Upper condition to check that loop body can be executed at least once. Also this allows to skip code generation for loops, if it is known that preconditions for the loop are always false. Differential Revision: http://reviews.llvm.org/D9103 llvm-svn: 235500
* [OPENMP] Codegen for 'ordered' directive.Alexey Bataev2015-04-225-32/+359
| | | | | | | | | | | | | | | | | | | Add codegen for 'ordered' directive: __kmpc_ordered(ident_t *, gtid); <associated statement>; __kmpc_end_ordered(ident_t *, gtid); Also for 'for' directives with the dynamic scheduling and an 'ordered' clause added a call to '__kmpc_dispatch_fini_(4|8)[u]()' function after increment expression for loop control variable: while(__kmpc_dispatch_next(&LB, &UB)) { idx = LB; while (idx <= UB) { BODY; ++idx; __kmpc_dispatch_fini_(4|8)[u](); // For ordered loops only. } // inner loop } Differential Revision: http://reviews.llvm.org/D9070 llvm-svn: 235496
* clang-format: Fix for #pragma option formatting.Daniel Jasper2015-04-223-2/+16
| | | | | | Adapted patch from Sergey Razmetov. Thank you. llvm-svn: 235492
* Don't dllimport/export class members with internal linkage (PR23308)Hans Wennborg2015-04-223-0/+18
| | | | | | | | | | For example, a function taking a parameter with internal linkage will itself have internal linkage since it cannot be called outside the translation unit. Differential Revision: http://reviews.llvm.org/D9182 llvm-svn: 235471
* Wrap to 80 columns, fix typo in comment. No behavior change.Nico Weber2015-04-222-9/+10
| | | | llvm-svn: 235470
* [modules] Cope with partial module macro information, fix memory leak found ↵Richard Smith2015-04-223-6/+14
| | | | | | by buildbot. llvm-svn: 235464
* [modules] Build a DAG of module macros for each identifier.Richard Smith2015-04-226-31/+167
| | | | | | | | 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
* Expose -fdiagnostics-parseable-fixits to clang-clHans Wennborg2015-04-212-1/+2
| | | | | | | | Patch by Daniel Cheng! Differential Revision: http://reviews.llvm.org/D9175 llvm-svn: 235456
* [cuda] Allow using integral non-type template parameters as launch_bounds ↵Artem Belevich2015-04-218-28/+204
| | | | | | | | | | | | | | | | attribute arguments. - Changed CUDALaunchBounds arguments from integers to Expr* so they can be saved in AST for instantiation. - Added support for template instantiation of launch_bounds attrubute. - Moved evaluation of launch_bounds arguments to NVPTXTargetCodeGenInfo:: SetTargetAttributes() where it can be done after template instantiation. - Added a warning on negative launch_bounds arguments. - Amended test cases. Differential Revision: http://reviews.llvm.org/D8985 llvm-svn: 235452
* [cuda] Added support for CUDA built-in variables.Artem Belevich2015-04-214-0/+196
| | | | | | | | | | | | | | | | | Added cuda_builtin_vars.h which implements built-in CUDA variables using __declattr(property). Fields of built-in variables (except for warpSize) are implemented using __declattr(property) which replaces read/write of a member field with a call to a getter/setter member function, in this case with appropriate NVPTX builtin. Added a test case to check diagnostics on attempt to construct or improperly access a built-in variable. Differential Revision: http://reviews.llvm.org/D9064 llvm-svn: 235448
* [modules] Move list of exported module macros from IdentifierInfo lookup ↵Richard Smith2015-04-214-441/+227
| | | | | | | | | 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
* DebugInfo: Prepare for removal of DIArray and DITypeArray typedefsDuncan P. N. Exon Smith2015-04-212-38/+44
| | | | | | | | An upcoming LLVM commit will remove the `DIArray` and `DITypeArray` typedefs that shadow `DebugNodeArray` and `MDTypeRefArray`, respectively. Use those types directly. llvm-svn: 235412
* DebugInfo: Prepare for deletion of DIDescriptor subclassesDuncan P. N. Exon Smith2015-04-212-59/+47
| | | | | | | An upcoming LLVM commit will delete all the remaining subclasses of (the already deleted) `DIDescriptor`. Stop using them. llvm-svn: 235403
OpenPOWER on IntegriCloud