Commit Graph

3261 Commits

Author SHA1 Message Date
Yaron Keren 129dfbff4a Revert r237339 as sanitizer-ppc64-linux1 does not like it.
Complains:

/home/buildbots/sanitizerslave1/sanitizer-ppc64-1/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:829:30: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat]
                     I, TAK, clang_Cursor_getTemplateArgumentValue(Cursor, I));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm not sure now how this should be fixed. %lld is non-standard
and not accepted by mingw on Windows while PRId64 is bad for this bot.

Is long long longer than 64 bits here? if not, why is PRId64
incompatible with it? something seems wrong.

Probably all the datatypes should be replaced to unsigned or uint64_t
depending upin requirements instead of the non standard long long.

llvm-svn: 237346
2015-05-14 06:53:31 +00:00
Yaron Keren e7aad46665 Replace non-standard %lld printf usage with PRId64.
See also r180024.

llvm-svn: 237339
2015-05-14 05:40:50 +00:00
Manuel Klimek 328263e4d8 Fix clang-format build from the solution; the underlying path has changed to include the VS directory structure.
llvm-svn: 237136
2015-05-12 14:41:39 +00:00
Alexey Bataev 040d540940 [OPENMP] Fixed support for 'schedule' clause with non-constant chunk size.
'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
2015-05-12 08:35:28 +00:00
Kostya Serebryany 123e3eb0be revert r237081 -- bad idea (-lcrypt may not be present)
llvm-svn: 237086
2015-05-12 03:10:42 +00:00
Kostya Serebryany 5c79fda912 add -lcrypto to clang and clang-format fuzzers (lib/Fuzzer will soon require it)
llvm-svn: 237081
2015-05-12 01:29:04 +00:00
Daniel Jasper 622c72ded5 Reapply r236854 and fixed r236867.
Makes emacs show a different message when clang-format encountered a
syntax error.

llvm-svn: 236943
2015-05-10 07:47:19 +00:00
Tobias Grosser a704600295 Revert "Make emacs show when clang-format encountered a syntax error."
This reverts commit 236854, which caused clang-format to always print
'{ "IncompleteFormat": false }' at the top of an incompletely formatted file.
This output causes problems e.g. in Polly's automatic formatting checks. Daniel
tried to fix this in 236867, but this fix had to be reverted due to buildbot
failures. I revert this change as well for now as it is Friday night and
unlikely to be fixed immediately.

llvm-svn: 236908
2015-05-08 21:34:09 +00:00
Renato Golin 82fbfe684e Revert "clang-format: Only output IncompleteFormat if -cursor is given."
This reverts commit r236867, as it was breaking multiple buildbots. Daniel
will look into it later.

llvm-svn: 236882
2015-05-08 17:05:24 +00:00
Daniel Jasper e44e5665d4 clang-format: Only output IncompleteFormat if -cursor is given.
This is only for editor integrations.

llvm-svn: 236867
2015-05-08 15:36:30 +00:00
Manuel Klimek 3dfe4a87c8 Make emacs show when clang-format encountered a syntax error.
Propagate the 'incomplete-format' state back through clang-format's command
line interace and adapt the emacs integration to show a better result.

llvm-svn: 236854
2015-05-08 13:59:15 +00:00
Kostya Serebryany 9ba68b3566 fix clang-fuzzer and clang-format-fuzzer
llvm-svn: 236691
2015-05-07 04:01:39 +00:00
Daniel Jasper fc510b67fe clang-format: Don't allow -i when reading from stdin.
llvm-svn: 236592
2015-05-06 11:56:54 +00:00
Ahmed Bougacha 5191911a57 Revert "[analyzer] scan-build: support spaces in compiler path and arguments."
This reverts commit r236423 and its followup r236533, as indiscriminate
quoting makes for too much quoting (and clang doesn't like both '"-c"'
and -D"FOO=bar").

llvm-svn: 236562
2015-05-06 02:08:27 +00:00
Anton Yartsev 22f6189fb0 [analyzer] This eliminates regression caused by r236423.
Wrap an argument with quotes only if it has spaces.

llvm-svn: 236533
2015-05-05 19:43:37 +00:00
Kostya Serebryany 7862b01a63 [clang-fuzzer] make clang-fuzzer slightly faster by removing one redundant directory scan
llvm-svn: 236459
2015-05-04 21:14:45 +00:00
Anton Yartsev c312ef1d17 [analyzer] scan-build: support spaces in compiler path and arguments.
This fixes errors that occur if a path to the default compiler has spaces or if an argument with spaces is given to compiler (e.g. via -I). (http://reviews.llvm.org/D9357)

llvm-svn: 236423
2015-05-04 13:37:36 +00:00
Richard Smith 36bd40df72 Switch PPCallbacks to take the new MacroDefinition instead of MacroDirective*, in order to preserve full information on module macro expansion.
llvm-svn: 236404
2015-05-04 03:15:40 +00:00
Richard Smith 66a8186ed4 Rename MacroDefinition -> MacroDefinitionRecord, 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
2015-05-04 02:25:31 +00:00
Richard Smith 20e883e59b [modules] Stop trying to fake up a linear MacroDirective history.
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
2015-04-29 23:20:19 +00:00
Lang Hames 51ad8f1e4d Revert r235749 - Accidentally commited cruft from the wrong path.
llvm-svn: 235750
2015-04-24 19:08:30 +00:00
Lang Hames ef789b6a90 [CodeGen] Make AsmPrinter's OutStreamer member a unique_ptr.
AsmPrinter owns the OutStreamer, so an owning pointer makes sense here. Using a
reference for this is crufty.

llvm-svn: 235749
2015-04-24 19:04:55 +00:00
Daniel Jasper 0fe44465c3 clang-format: Add default fallback style.
Thanks to Michael Schlottke.

llvm-svn: 235162
2015-04-17 07:59:19 +00:00
Daniel Jasper 23341446e8 clang-format: add an option for fallback style in vimrc
With this patch, clang-format.py will search and use existing .clang-format
file if there is one and fallback to the specific format style if
not. It should cover the projects which don't have .clang-format
files in their source. As the option fallback-style is available in
clang 3.5 or later, it is safe to use.

Patch by "Chilledheart" (http://reviews.llvm.org/D8489).

llvm-svn: 235080
2015-04-16 08:26:37 +00:00
Alexey Bataev f56f98c925 [OPENMP] Codegen for 'copyin' clause in 'parallel' directive.
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
2015-04-16 05:39:01 +00:00
Alexey Bataev 38e8953352 [OPENMP] Codegen for 'lastprivate' clause in 'for' directive.
#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
2015-04-16 04:54:05 +00:00
Rafael Espindola 2f16bc1095 Use raw_pwrite_stream in clang.
This is a small improvement to -emit-pth and allows llvm to start requiring it.

llvm-svn: 234897
2015-04-14 15:15:49 +00:00
Argyrios Kyrtzidis 2bff5161c4 [libclang] Add functions to get information about fields.
Patch by Loïc Jaquemet!

llvm-svn: 234762
2015-04-13 16:55:04 +00:00
Alexander Kornienko 34eb20725d Use 'override/final' instead of 'virtual' for overridden methods
Summary:
The patch is generated using clang-tidy misc-use-override check.

This command was used:

  tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
    -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D8926

llvm-svn: 234678
2015-04-11 02:00:23 +00:00
Alexey Bataev 794ba0dcb7 [OPENMP] Codegen for 'reduction' clause in 'parallel' directive.
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
2015-04-10 10:43:45 +00:00
Rafael Espindola 7e556adddd Propagate usage of std:unique_ptr a bit. NFC.
llvm-svn: 234538
2015-04-09 21:50:11 +00:00
Rafael Espindola 4dedcd7eab Update for LLVM api changes.
llvm-svn: 234536
2015-04-09 21:06:11 +00:00
Aaron Ballman 82a2202ae6 Gating clang-fuzzer on the same conditions required to build the LLVMFuzzer library. Otherwise, we can run into a situation where clang-fuzzer attempts to build, but its dependency was never built.
llvm-svn: 234170
2015-04-06 16:10:32 +00:00
Eric Christopher 7e0fadf837 Update for llvm commit r233648.
llvm-svn: 233649
2015-03-31 00:10:23 +00:00
Anna Zaks 50b0956754 [scan-build] Be friendly to "" in the argument list.
Do not fail when "" is one of the compilation arguments.

llvm-svn: 233465
2015-03-28 02:17:21 +00:00
Manuel Klimek bea7dfbc5e Make the clang-fuzzer use the CompilerInstance directly.
Going through the driver is too slow.

llvm-svn: 233459
2015-03-28 00:42:36 +00:00
Manuel Klimek 667c152bce Add initial version of a clang-fuzzer.
llvm-svn: 233455
2015-03-28 00:07:39 +00:00
Dmitri Gribenko e5423a766b Refactor: Simplify boolean expressions in libclang
Simplify boolean expresions using true and false with clang-tidy.

Patch by Richard.

llvm-svn: 232996
2015-03-23 19:23:50 +00:00
Alexey Bataev a63048e4fd [OPENMP] Codegen for 'copyprivate' clause ('single' directive).
If there is at least one 'copyprivate' clause is associated with the single directive, the following code is generated:

```
i32 did_it = 0;                                  \\ for 'copyprivate' clause
if(__kmpc_single(ident_t *, gtid)) {
  SingleOpGen();
  __kmpc_end_single(ident_t *, gtid);
  did_it = 1;                                    \\ for 'copyprivate' clause
}
<copyprivate_list>[0] = &var0;
...
<copyprivate_list>[n] = &varn;
call __kmpc_copyprivate(ident_t *, gtid, <copyprivate_list_size>,
                        <copyprivate_list>, <copy_func>, did_it);

...

void<copy_func>(void *LHSArg, void *RHSArg) {
  Dst = (void * [n])(LHSArg);
  Src = (void * [n])(RHSArg);
  Dst[0] = Src[0];
  ... Dst[n] = Src[n];
}
```
All list items from all 'copyprivate' clauses are gathered into single <copyprivate list> (<copyprivate_list_size> is a size in bytes of this list) and <copy_func> is used to propagate values of private or threadprivate variables from the 'single' region to other implicit threads from outer 'parallel' region.
Differential Revision: http://reviews.llvm.org/D8410

llvm-svn: 232932
2015-03-23 06:18:07 +00:00
Alexander Musman 3276a27b5c [OPENMP] CodeGen of the 'linear' clause for the 'omp simd' directive.
The linear variable is privatized (similar to 'private') and its
value on current iteration is calculated, similar to the loop
counter variables.
Differential revision: http://reviews.llvm.org/D8375

llvm-svn: 232890
2015-03-21 10:12:56 +00:00
Rafael Espindola e9ad54b3ee Update for llvm api change.
llvm-svn: 232843
2015-03-20 20:00:30 +00:00
Reid Kleckner e4f77deaeb Fix incremental linking with ninja and CMake 3.2+, see LLVM r232662 for details
llvm-svn: 232739
2015-03-19 17:45:12 +00:00
Rafael Espindola 55cfaa2552 Update for llvm API change.
llvm-svn: 232430
2015-03-16 22:30:13 +00:00
Argyrios Kyrtzidis 58d0e7ab79 [libclang] During member ref expression visitation, ignore base anonymous struct/union fields.
Otherwise they will shadow the real field that that we are interested in.

rdar://19783938

llvm-svn: 232141
2015-03-13 04:40:07 +00:00
Daniel Jasper 8c68a64ec8 clang-format: Recognize the .ts (TypeScript) extension as JavaScript.
Patch by Martin Probst. Thank you.

llvm-svn: 231926
2015-03-11 14:58:38 +00:00
Eric Christopher e0646e6a0a Update clang for llvm r231861.
llvm-svn: 231862
2015-03-10 22:03:27 +00:00
Benjamin Kramer d910d16c89 Make helper functions static. NFC.
llvm-svn: 231811
2015-03-10 18:24:01 +00:00
Yaron Keren 09fb7c6e7a Teach raw_ostream to accept SmallString.
Saves adding .str() call to any raw_ostream << SmallString usage
and a small step towards making .str() consistent in the ADTs by
removing one of the SmallString::str() use cases, discussion at

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141013/240026.html

I'll update the Phabricator patch http://reviews.llvm.org/D6372
for review of the Twine SmallString support, it's more complex
than this one.

llvm-svn: 231763
2015-03-10 07:33:23 +00:00
Richard Smith f19e12794d Replace Sema's map of locally-scoped extern "C" declarations with a DeclContext
of extern "C" declarations. This is simpler and vastly more efficient for
modules builds (we no longer need to load *all* extern "C" declarations to
determine if we have a redeclaration).

No functionality change intended.

llvm-svn: 231538
2015-03-07 00:04:49 +00:00
Zachary Turner 1fe2a8d8f5 Clang side change following r231392.
Changes call to PrintStackTrace(FILE*) to call
PrintStackTrace(raw_ostream&)

llvm-svn: 231393
2015-03-05 19:15:09 +00:00