Commit Graph

4061 Commits

Author SHA1 Message Date
Emmett Neyman 673269edd7 Changed how LLVM IR was generated to increase vectorization
Summary: Changed the structure of the generated IR to make it easier to vectorize

Reviewers: morehouse, kcc

Reviewed By: morehouse

Subscribers: cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D50342

llvm-svn: 339080
2018-08-06 23:11:38 +00:00
Jonas Toth 1188e5d55d [clang-rename] make clang-rename.py vim integration python3 compatible
Summary:
This patch makes the clang-rename.py script useable for vim with only python3
support. It uses the print-function and adjust the doc slightly to mention
the correct python3 command for the letter mapping in vim.

Reviewers: arphaman, klimek, aaron.ballman, hokein

Reviewed By: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D50307

llvm-svn: 338996
2018-08-06 09:08:06 +00:00
Matt Morehouse b1218ec8ea [clang-fuzzer] Remove unused typedef.
llvm-svn: 338946
2018-08-04 01:42:47 +00:00
Emmett Neyman 2655b0383c LLVM Proto Fuzzer - Run Functions on Suite of Inputs
Summary:
Added corpus of arrays to use as inputs for the functions. Check that the two
functions modify the inputted arrays in the same way.

Reviewers: kcc, morehouse

Reviewed By: morehouse

Subscribers: mgorny, cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D50194

llvm-svn: 338943
2018-08-04 01:18:37 +00:00
Krasimir Georgiev cb4dfaef47 clang-format-diff: Make it work with python3 too
Summary: It is not necessary, but would be nice if the script run on python3 as well (as opposed to only python2, which is going to be deprecated https://pythonclock.org/)

Contributed by MarcoFalke!

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: lebedev.ri, sammccall, cfe-commits

Differential Revision: https://reviews.llvm.org/D48098

llvm-svn: 338839
2018-08-03 10:04:58 +00:00
Michael Wu 58d837d347 [libclang 8/8] Add support for the flag_enum attribute
Summary:
This adds support to libclang for reading the flag_enum attribute.

This also bumps CINDEX_VERSION_MINOR for this patch series.

Reviewers: yvvan, jbcoe

Reviewed By: yvvan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D49635

llvm-svn: 338820
2018-08-03 05:55:40 +00:00
Michael Wu 6e88f5334c [libclang 7/8] Add support for getting property setter and getter names
Summary: This allows libclang to access the actual names of property setters and getters without needing to go through the indexer API. Usually default names are used, but the property can specify a different name.

Reviewers: yvvan, jbcoe

Reviewed By: yvvan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D49634

llvm-svn: 338816
2018-08-03 05:38:29 +00:00
Michael Wu 40ff105663 [libclang 6/8] Add support for reading implicit attributes
Summary:
Having access to implicit attributes is sometimes useful so users of libclang don't have to duplicate some of the logic in sema.

This depends on D49081 since it also adds a CXTranslationUnit flag.

Reviewers: yvvan, jbcoe

Reviewed By: yvvan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D49631

llvm-svn: 338815
2018-08-03 05:20:23 +00:00
Michael Wu d092d0b179 [libclang 5/8] Add support for ObjC attributes without args
Summary:
This adds support to libclang for identifying ObjC related attributes that don't take arguments.

All attributes but NSObject and NSConsumed are tested.

Reviewers: yvvan, jbcoe

Reviewed By: yvvan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D49127

llvm-svn: 338813
2018-08-03 05:03:22 +00:00
Michael Wu 7649e62906 [libclang 4/8] Add the clang_Type_getNullability() API
Summary:
This patch adds a clang-c API for querying the nullability of an AttributedType.

The test here also tests D49081

Reviewers: yvvan, jbcoe

Reviewed By: yvvan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D49082

llvm-svn: 338809
2018-08-03 04:38:04 +00:00
Michael Wu 153085d6bc [libclang 3/8] Add support for AttributedType
Summary:
This patch adds support to the libclang API for identifying AttributedTypes in CXTypes and reading the modified type that the type points to. Currently AttributedTypes are skipped. This patch continues to skip AttributedTypes by default, but adds a parsing option to CXTranslationUnit to include AttributedTypes.

This patch depends on D49066 since it also adds a CXType.

Testing will be added in another patch which depends on this one.

Reviewers: yvvan, jbcoe

Reviewed By: yvvan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D49081

llvm-svn: 338808
2018-08-03 04:21:25 +00:00
Michael Wu ced99b99d1 [libclang 2/8] Add support for ObjCTypeParam
Summary:
This patch adds support to the libclang API for identifying ObjCTypeParams in CXTypes.

This patch depends on D49063 since both patches add new values to CXTypeKind.

Reviewers: yvvan, jbcoe

Reviewed By: yvvan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D49066

llvm-svn: 338807
2018-08-03 04:02:40 +00:00
Michael Wu 9c85261559 [libclang 1/8] Add support for ObjCObjectType
Summary: This patch adds support to the clang-c API for identifying ObjCObjects in CXTypes, enumerating type args and protocols on ObjCObjectTypes, and retrieving the base type of ObjCObjectTypes. Currently only ObjCInterfaceTypes are exposed, which do not have type args or protocols.

Reviewers: yvvan, jbcoe

Reviewed By: yvvan

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D49063

llvm-svn: 338804
2018-08-03 03:03:20 +00:00
Volodymyr Sapsai 7b16e8ad32 [c-index-test] Use correct executable path to discover resource directory.
Driver builds resource directory path based on provided executable path.
Instead of string "clang" use actual executable path.

rdar://problem/42699514

Reviewers: nathawes, akyrtzi, bob.wilson

Reviewed By: akyrtzi

Subscribers: dexonsmith, cfe-commits

Differential Revision: https://reviews.llvm.org/D50160

llvm-svn: 338741
2018-08-02 17:29:53 +00:00
Andrei Elovikov ad56ebaf06 [NFC] Silence warning about ptr-to-func to ptr-to-obj cast in clang-fuzzer/handle-llvm/handle_llvm.cpp.
Summary:
I don't have the whole list of GCC binaries available so I determined the exact
version where the warning disappeared via:

https://github.com/gcc-mirror/gcc/blob/gcc-4_9_0-release/gcc/cp/typeck.c#L6863
https://github.com/gcc-mirror/gcc/blob/gcc-4_8_5-release/gcc/cp/typeck.c#L6652

Reviewers: emmettneyman, erichkeane

Reviewed By: emmettneyman, erichkeane

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D50056

llvm-svn: 338551
2018-08-01 13:34:18 +00:00
Emmett Neyman be97297545 added shared library to fix buildbot
Summary: added shared library to fix buildbot

Subscribers: mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D49895

llvm-svn: 338091
2018-07-27 00:43:26 +00:00
Emmett Neyman e5581242a0 Updated llvm-proto-fuzzer to execute the compiled code
Summary:
Made changes to the llvm-proto-fuzzer
- Added loop vectorizer optimization pass in order to have two IR versions
- Updated old fuzz target to handle two different IR versions
- Wrote code to execute both versions in memory

Reviewers: morehouse, kcc, alexshap

Reviewed By: morehouse

Subscribers: pcc, mgorny, cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D49526

llvm-svn: 338077
2018-07-26 22:23:25 +00:00
Fangrui Song 4eab1ba619 cc1_main: fix -Wsign-compare on FreeBSD
Its __rlim_t is intentionally signed (__int64_t) because of legacy code
that uses -1 for RLIM_INFINITY.

llvm-svn: 337892
2018-07-25 06:57:31 +00:00
Zachary Turner 83226b913d Rewrite the VS integration scripts.
This is a new modernized VS integration installer.  It adds a
Visual Studio .sln file which, when built, outputs a VSIX that can
be used to install ourselves as a "real" Visual Studio Extension.
We can even upload this extension to the visual studio marketplace.

This fixes a longstanding problem where we didn't support installing
into VS 2017 and higher.  In addition to supporting VS 2017, due
to the way this is written we now longer need to do anything special
to support future versions of VS as well.  Everything should
"just work".  This also fixes several bugs with our old integration,
such as MSBuild triggering full rebuilds when /Zi was used.

Finally, we add a new UI page called "LLVM" which becomes visible
when the LLVM toolchain is selected.  For now this only contains
one option which is the path to clang-cl.exe, but in the future
we can add more things here.

Differential Revision: https://reviews.llvm.org/D42762

llvm-svn: 337572
2018-07-20 16:30:02 +00:00
Eric Liu 3e0051bb51 [Index] Set OrigD before D is changed.
Reviewers: akyrtzi, arphaman

Reviewed By: akyrtzi

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D49476

llvm-svn: 337529
2018-07-20 08:08:56 +00:00
Erich Keane f702b029f4 PR15730/PR16986 Allow dependently typed vector_size types.
As listed in the above PRs, vector_size doesn't allow
dependent types/values. This patch introduces a new
DependentVectorType to handle a VectorType that has a dependent
size or type.

In the future, ALL the vector-types should be able to create one
of these to handle dependent types/sizes as well. For example,
DependentSizedExtVectorType could likely be switched to just use
this instead, though that is left as an exercise for the future.


Differential Revision: https://reviews.llvm.org/D49045

llvm-svn: 337036
2018-07-13 19:46:04 +00:00
Erich Keane 9960b8f13a Revert -r336726, which included more files than intended.
llvm-svn: 336727
2018-07-10 20:51:41 +00:00
Erich Keane 7b8c12e7cc [NFC] Switch CodeGenFunction to use value init instead of member init lists
The member init list for the sole constructor for CodeGenFunction
has gotten out of hand, so this patch moves the non-parameter-dependent
initializations into the member value inits.

llvm-svn: 336726
2018-07-10 20:46:46 +00:00
Evgeniy Stepanov 6df47ceb24 Revert r336590 "[libclang] evalute compound statement cursors before trying to evaluate"
New memory leaks in
LibclangParseTest_EvaluateChildExpression_Test::TestBody()

llvm-svn: 336716
2018-07-10 19:49:07 +00:00
Evgeniy Stepanov 9b8714961d Revert r336591 "[libclang] NFC, simplify clang_Cursor_Evaluate"
This change is blocking r336590 which is being reverted due to memory leaks.

llvm-svn: 336715
2018-07-10 19:48:53 +00:00
Paul Robinson 9b292b4585 Support -fdebug-prefix-map for assembler source (pass to cc1as). This
is useful to omit the debug compilation dir when compiling assembly
files with -g.  Part of PR38050.

Patch by Siddhartha Bagaria!

Differential Revision: https://reviews.llvm.org/D48989

llvm-svn: 336685
2018-07-10 15:15:24 +00:00
Alex Lorenz c4cf96e3c9 [libclang] NFC, simplify clang_Cursor_Evaluate
Take advantage of early returns as suggested by Duncan in
https://reviews.llvm.org/D49051

llvm-svn: 336591
2018-07-09 19:56:45 +00:00
Alex Lorenz 81f157b40f [libclang] evalute compound statement cursors before trying to evaluate
the cursor like a declaration

This change fixes a bug in libclang in which it tries to evaluate a statement
cursor as a declaration cursor, because that statement still has a pointer to
the declaration parent.

rdar://38888477

Differential Revision: https://reviews.llvm.org/D49051

llvm-svn: 336590
2018-07-09 19:41:28 +00:00
Eric Liu 8c97195cc8 [Index] Add indexing support for MACROs.
Reviewers: akyrtzi, arphaman, sammccall

Reviewed By: sammccall

Subscribers: malaperle, sammccall, cfe-commits

Differential Revision: https://reviews.llvm.org/D48961

llvm-svn: 336524
2018-07-09 08:44:05 +00:00
Richard Smith 0a7b297d01 Factor out Clang's desired 8MB stack size constant from the various
places we hardcode it.

llvm-svn: 336231
2018-07-03 21:34:13 +00:00
Eric Liu b4adc9110d [clang-format] Add a default format style that can be used by users of `getStyle`
Summary:
Tools that reformat code often call `getStyle` to decide the format style
to use on a certain source file. In practice, "file" style is widely used. As a
result, many tools hardcode "file" when calling `getStyle`, which makes it hard
to control the default style in tools across a codebase when needed. This change
introduces a `DefaultFormatStyle` constant (default to "file" in upstream), which
can be modified downstream if wanted, so that all users/tools built from the same
source tree can have a consistent default format style.

This also adds an DefaultFallbackStyle that is recommended to be used by tools and can be modified downstream.

Reviewers: sammccall, djasper

Reviewed By: sammccall

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D48492

llvm-svn: 335492
2018-06-25 16:29:19 +00:00
Reid Kleckner e7a7a5057b Attempt to fix latent tablegen dependency issue
llvm-svn: 335419
2018-06-23 17:32:51 +00:00
Sam Clegg 5421b37893 Fix BUILD_SHARED_LIBS=1 build of libclangHandleLLVM
Differential Revision: https://reviews.llvm.org/D48503

llvm-svn: 335380
2018-06-22 19:44:48 +00:00
Emmett Neyman e5f4a9ff76 Implemented proto to LLVM conversion and LLVM fuzz target
Differential Revision: https://reviews.llvm.org/D48106

llvm-svn: 335374
2018-06-22 18:05:00 +00:00
Emmett Neyman 07605cb6ea Test commit, made a minor change to a comment
llvm-svn: 335299
2018-06-21 22:08:20 +00:00
Rainer Orth 4bd5c47601 [liblang] Remove DOS line endings in libclang.exports
Undefined                       first referenced
 symbol                             in file
clang_getCompletionFixIt           /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTokenLocation             /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getToken                     /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTemplateCursorKind        /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTUResourceUsageName       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionChunkKind       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionChunkText       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getSpellingLocation          /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionParent          /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionChunkCompletionString /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionPriority        /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionNumFixIts       /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTokenExtent               /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getCompletionNumAnnotations  /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
clang_getTokenKind                 /var/gcc/llvm/obj/local/tools/clang/tools/libclang/libclang.exports
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
make[2]: *** [tools/clang/tools/libclang/CMakeFiles/libclang.dir/build.make:651: lib/libclang.so.7] Error 1

It turns out that this is caused by https://reviews.llvm.org/D46862: it added a
couple of CRs (^M) to some lines.  Solaris ld takes them to be part of the symbol
names, which of course are missing from the input objects.  GNU ld handles this
just fine.  Fixed by removing the CRs.

Bootstrapped on i386-pc-solaris2.11.  I guess this is obvious.

Differential Revision: https://reviews.llvm.org/D48423

llvm-svn: 335234
2018-06-21 13:40:50 +00:00
Leonard Chan db01c3adc6 [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals
This diff includes the logic for setting the precision bits for each primary fixed point type in the target info and logic for initializing a fixed point literal.

Fixed point literals are declared using the suffixes

```
hr: short _Fract
uhr: unsigned short _Fract
r: _Fract
ur: unsigned _Fract
lr: long _Fract
ulr: unsigned long _Fract
hk: short _Accum
uhk: unsigned short _Accum
k: _Accum
uk: unsigned _Accum
```
Errors are also thrown for illegal literal values

```
unsigned short _Accum u_short_accum = 256.0uhk;   // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}}
```

Differential Revision: https://reviews.llvm.org/D46915

llvm-svn: 335148
2018-06-20 17:19:40 +00:00
Paul Robinson 7555c589af Update copyright year to 2018.
llvm-svn: 334936
2018-06-18 12:22:17 +00:00
Shoaib Meenai fce4616189 [cmake] Add linker detection for Apple platforms
LLVM currently assumes that Apple platforms will always use ld64. In the
future, LLD Mach-O might also be supported, so add the beginnings of
linker detection support. ld64 is currently the only detected linker,
since `ld64.lld -v` doesn't yield any useful version output, but we can
add that detection later, and in the meantime it's still useful to have
the ld64 identification.

Switch clang's order file check to use this new detection rather than
just checking for the presence of an ld64 executable.

Differential Revision: https://reviews.llvm.org/D48201

llvm-svn: 334780
2018-06-14 23:26:33 +00:00
Bruno Cardoso Lopes f56ef90e26 [CMAKE][c-index-test] Honor CMAKE_OSX_SYSROOT to compute include dir for libxml2
On MacOS, if CMAKE_OSX_SYSROOT is used and the user has command line tools
installed, we currently get the include path for libxml2 as
/usr/include/libxml2, instead of ${CMAKE_OSX_SYSROOT}/usr/include/libxml2.

Make it consistent on MacOS by prefixing ${CMAKE_OSX_SYSROOT} when
possible.

rdar://problem/41103601

llvm-svn: 334747
2018-06-14 18:20:04 +00:00
Matt Morehouse cffb235afe [libclang] Make c-index-test.c ISO C90 compliant.
Fixes a build bot breakage caused by r334593.

llvm-svn: 334612
2018-06-13 16:00:39 +00:00
Ivan Donchevskii 3957e48a68 [libclang] Optionally add code completion results for arrow instead of dot
Follow up for D41537 - libclang part.

Differential Revision: https://reviews.llvm.org/D46862

llvm-svn: 334593
2018-06-13 12:37:08 +00:00
Zachary Turner 08426e1f9f Refactor ExecuteAndWait to take StringRefs.
This simplifies some code which had StringRefs to begin with, and
makes other code more complicated which had const char* to begin
with.

In the end, I think this makes for a more idiomatic and platform
agnostic API.  Not all platforms launch process with null terminated
c-string arrays for the environment pointer and argv, but the api
was designed that way because it allowed easy pass-through for
posix-based platforms.  There's a little additional overhead now
since on posix based platforms we'll be takign StringRefs which
were constructed from null terminated strings and then copying
them to null terminate them again, but from a readability and
usability standpoint of the API user, I think this API signature
is strictly better.

llvm-svn: 334518
2018-06-12 17:43:52 +00:00
Matt Morehouse 3416773cb1 [clang-fuzzer] Modified protobuf and converter to add new signature, remove conditionals.
Changed the function signature and removed conditionals from loop body.

Patch By:  emmettneyman

Differential Revision: https://reviews.llvm.org/D47964

llvm-svn: 334421
2018-06-11 17:05:45 +00:00
Matt Morehouse 1dc1ff85d7 [clang-fuzzer] Made loop_proto more "vectorizable".
Edited loop_proto and its converter to make more "vectorizable" code
according to kcc's comment in D47666
  - Removed all while loops
  - Can only index into array with induction variable

Patch By: emmettneyman

Differential Revision: https://reviews.llvm.org/D47920

llvm-svn: 334252
2018-06-08 00:33:35 +00:00
Vitaly Buka 410a6b2c63 Introducing single for loop into clang_proto_fuzzer
Summary:
Created a new protobuf and protobuf-to-C++ "converter" that wraps the entire C++ code in a single for loop.
  - Slightly changed cxx_proto.proto -> cxx_loop_proto.proto
  - Made some changes to proto_to_cxx files to handle the new kind of protobuf
  - Created ExampleClangLoopProtoFuzzer to test new protobuf and "converter"

Patch by Emmett Neyman

Reviewers: kcc, vitalybuka, morehouse

Reviewed By: vitalybuka, morehouse

Subscribers: mgorny, llvm-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D47843

llvm-svn: 334216
2018-06-07 19:17:46 +00:00
Matt Morehouse 293c2691e5 [clang-proto-fuzzer] Refactored LLVMFuzzerInitialize into its own file.
Copied and renamed some files in preparation for new loop-proto-fuzzer.

Patch By: emmettneyman

Differential Revision: https://reviews.llvm.org/D47666

llvm-svn: 333969
2018-06-05 00:11:41 +00:00
Leonard Chan f921d85422 This diff includes changes for supporting the following types.
// Primary fixed point types
signed short _Accum s_short_accum;
signed _Accum s_accum;
signed long _Accum s_long_accum;
unsigned short _Accum u_short_accum;
unsigned _Accum u_accum;
unsigned long _Accum u_long_accum;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;
This diff only allows for declaration of the fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches. The saturated versions of these types and the equivalent _Fract types will also be added in future patches.

The tests included are for asserting that we can declare these types.

Fixed the test that was failing by not checking for dso_local on some
targets.

Differential Revision: https://reviews.llvm.org/D46084

llvm-svn: 333923
2018-06-04 16:07:52 +00:00
Leonard Chan 0d485dbb40 Revert "This diff includes changes for supporting the following types."
This reverts commit r333814, which fails for a test checking the bit
width on ubuntu.

llvm-svn: 333815
2018-06-02 03:27:13 +00:00
Leonard Chan db55d8331e This diff includes changes for supporting the following types.
```

// Primary fixed point types
signed short _Accum s_short_accum;
signed _Accum s_accum;
signed long _Accum s_long_accum;
unsigned short _Accum u_short_accum;
unsigned _Accum u_accum;
unsigned long _Accum u_long_accum;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;

```

This diff only allows for declaration of the fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches. The saturated versions of these types and the equivalent `_Fract` types will also be added in future patches.

The tests included are for asserting that we can declare these types.

Differential Revision: https://reviews.llvm.org/D46084

llvm-svn: 333814
2018-06-02 02:58:51 +00:00