Commit Graph

67951 Commits

Author SHA1 Message Date
Peter Collingbourne dc205b3db2 IRGen: Do not set dllexport on declarations.
Setting dllexport on a declaration has no effect, as we do not emit export
directives for declarations.

Part of the fix for PR32334.

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

llvm-svn: 298330
2017-03-21 02:02:41 +00:00
Zachary Turner 82a0c97b32 Add a function to MD5 a file's contents.
In doing so, clean up the MD5 interface a little.  Most
existing users only care about the lower 8 bytes of an MD5,
but for some users that care about the upper and lower,
there wasn't a good interface.  Furthermore, consumers
of the MD5 checksum were required to handle endianness
details on their own, so it seems reasonable to abstract
this into a nicer interface that just gives you the right
value.

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

llvm-svn: 298322
2017-03-20 23:33:18 +00:00
Eric Christopher 5ba576ffe6 Fix parsing of htmxlintrin.h in C++ mode
- Fix a variable naming mismatch
 - Fix gcc extension pointer arithmetic on void to cast to char *.
 - Test that the header (and htmintrin.h) parse.

llvm-svn: 298318
2017-03-20 22:31:33 +00:00
Vedant Kumar 3cbce5d278 [docs] Clarify sanitizer flag behavior
PR32346 suggests that UBSan's docs about the -fsanitize,
-fno-sanitize-recover, and -fsanitize-trap options are not explicit
enough. Try to improve the wording.

llvm-svn: 298310
2017-03-20 21:40:58 +00:00
Eric Christopher 74fa24ff27 Turn on HTM on power8 and later (including powerpc64le) since it's
available by default on those cpus and configurations.

llvm-svn: 298307
2017-03-20 21:12:53 +00:00
Kostya Serebryany 6abb1d6bd8 Proposal: Backward-edge CFI for return statements (RCFI)
Summary: Proposal: Backward-edge CFI for return statements (RCFI)

Reviewers: pcc, eugenis, krasin

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 298303
2017-03-20 20:42:00 +00:00
Richard Smith 6043e0f738 Avoid these headers looking like the same file on a content-addressed file system.
llvm-svn: 298300
2017-03-20 20:14:03 +00:00
Richard Smith 4b0cad0bb8 Bump __cplusplus for C++17 to 201703L per the C++17 DIS.
llvm-svn: 298299
2017-03-20 20:12:48 +00:00
Duncan P. N. Exon Smith 030d7d6daa Reapply "Modules: Cache PCMs in memory and avoid a use-after-free"
This reverts commit r298185, effectively reapplying r298165, after fixing the
new unit tests (PR32338).  The memory buffer generator doesn't null-terminate
the MemoryBuffer it creates; this version of the commit informs getMemBuffer
about that to avoid the assert.

Original commit message follows:

----

Clang's internal build system for implicit modules uses lock files to
ensure that after a process writes a PCM it will read the same one back
in (without contention from other -cc1 commands).  Since PCMs are read
from disk repeatedly while invalidating, building, and importing, the
lock is not released quickly.  Furthermore, the LockFileManager is not
robust in every environment.  Other -cc1 commands can stall until
timeout (after about eight minutes).

This commit changes the lock file from being necessary for correctness
to a (possibly dubious) performance hack.  The remaining benefit is to
reduce duplicate work in competing -cc1 commands which depend on the
same module.  Follow-up commits will change the internal build system to
continue after a timeout, and reduce the timeout.  Perhaps we should
reconsider blocking at all.

This also fixes a use-after-free, when one part of a compilation
validates a PCM and starts using it, and another tries to swap out the
PCM for something new.

The PCMCache is a new type called MemoryBufferCache, which saves memory
buffers based on their filename.  Its ownership is shared by the
CompilerInstance and ModuleManager.

- The ModuleManager stores PCMs there that it loads from disk, never
touching the disk if the cache is hot.

- When modules fail to validate, they're removed from the cache.

- When a CompilerInstance is spawned to build a new module, each
already-loaded PCM is assumed to be valid, and is frozen to avoid
the use-after-free.

- Any newly-built module is written directly to the cache to avoid the
round-trip to the filesystem, making lock files unnecessary for
correctness.

Original patch by Manman Ren; most testcases by Adrian Prantl!

llvm-svn: 298278
2017-03-20 17:58:26 +00:00
Jonathan Roelofs 335777b79b Fix some sphinx -Werror's
... mostly having to do with code blocks which the syntax highlighter chokes on

llvm-svn: 298275
2017-03-20 17:07:49 +00:00
Anastasia Stulova bb27dfe049 [OpenCL] Fix extension guards for atomic functions
Review: D30830

Patch by James Price!

llvm-svn: 298256
2017-03-20 15:02:54 +00:00
Sylvestre Ledru 35b392d069 Add more examples to clang-format configuration
Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 298245
2017-03-20 12:56:40 +00:00
Laszlo Nagy 0d9be63001 [scan-build-py] use python tempfile for tempdir
Differential Revision: https://reviews.llvm.org/D30862

llvm-svn: 298238
2017-03-20 09:03:24 +00:00
Aaron Ballman a31ea644ce Cleaning up the IdentifierResolver::iterator class a bit; NFC.
The comment about there being three different forms that Ptr represents was stale. Also, the opaque value does not need to be exposed (these functions are unused).

llvm-svn: 298215
2017-03-19 15:15:28 +00:00
Igor Breger f050b797ac [X86][AVX512][Clang][Intrinsics] Adding missing intrinsics to Clang .
Summary:
Adding missing intrinsics :
    _mm512_set_epi16,
    _mm512_set_epi8,
    _mm512_permutevar_epi32
    _mm512_mask_permutevar_epi32

Reviewers: zvi, guyblank, eladcohen, craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, cfe-commits

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

llvm-svn: 298208
2017-03-19 08:27:16 +00:00
Renato Golin f1966cf646 Revert "Modules: Cache PCMs in memory and avoid a use-after-free"
This reverts commit r298165, as it broke the ARM builds.

llvm-svn: 298185
2017-03-18 12:31:32 +00:00
Nirav Dave 8497ef4086 [X86] Add NumRegisterParameters Module Flag.
Reviewers: rnk, mkuper

Subscribers: llvm-commits

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

llvm-svn: 298177
2017-03-18 00:43:39 +00:00
Bruno Cardoso Lopes 5a0af1fcd1 [Modules] In case of lock timeout, fallback and build module
Duncan's r298165 introduced the PCMCache mechanism, which guarantees
that locks aren't necessary anymore for correctness but only for
performance, by avoiding building it twice when possible.

Change the logic to avoid an error but actually build the module in case
the timeout happens. Instead of an error, still emit a remark for
debugging purposes.

rdar://problem/30297862

llvm-svn: 298175
2017-03-18 00:26:18 +00:00
Argyrios Kyrtzidis 573624a9c2 [index] For C++ constructors/destructors, add references to the parent type where its name appears in definitions and declarations
Patch by Nathan Hawes!
https://reviews.llvm.org/D30730

llvm-svn: 298170
2017-03-17 23:41:59 +00:00
Duncan P. N. Exon Smith 079c40e886 Modules: Cache PCMs in memory and avoid a use-after-free
Clang's internal build system for implicit modules uses lock files to
ensure that after a process writes a PCM it will read the same one back
in (without contention from other -cc1 commands).  Since PCMs are read
from disk repeatedly while invalidating, building, and importing, the
lock is not released quickly.  Furthermore, the LockFileManager is not
robust in every environment.  Other -cc1 commands can stall until
timeout (after about eight minutes).

This commit changes the lock file from being necessary for correctness
to a (possibly dubious) performance hack.  The remaining benefit is to
reduce duplicate work in competing -cc1 commands which depend on the
same module.  Follow-up commits will change the internal build system to
continue after a timeout, and reduce the timeout.  Perhaps we should
reconsider blocking at all.

This also fixes a use-after-free, when one part of a compilation
validates a PCM and starts using it, and another tries to swap out the
PCM for something new.

The PCMCache is a new type called MemoryBufferCache, which saves memory
buffers based on their filename.  Its ownership is shared by the
CompilerInstance and ModuleManager.

  - The ModuleManager stores PCMs there that it loads from disk, never
    touching the disk if the cache is hot.

  - When modules fail to validate, they're removed from the cache.

  - When a CompilerInstance is spawned to build a new module, each
    already-loaded PCM is assumed to be valid, and is frozen to avoid
    the use-after-free.

  - Any newly-built module is written directly to the cache to avoid the
    round-trip to the filesystem, making lock files unnecessary for
    correctness.

Original patch by Manman Ren; most testcases by Adrian Prantl!

llvm-svn: 298165
2017-03-17 22:55:13 +00:00
Davide Italiano 3c6e5ead57 [Sema] Unbreak GCC -Werror build (enum compare).
llvm-svn: 298160
2017-03-17 22:19:20 +00:00
Matthias Gehre dc01bb448f Implement DR 373 "Lookup on namespace qualified name in using-directive"
Summary:
3.4.6 [basic.lookup.udir] paragraph 1:
In a using-directive or namespace-alias-definition, during the lookup for a namespace-name or for a name in a nested-name-specifier, only namespace names are considered.

Reviewers: rsmith, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 298126
2017-03-17 21:41:20 +00:00
Zachary Turner a0f96be9b1 [clang-cl] Fix cross-compilation with MSVC 2017.
clang-cl works best when the user runs vcvarsall to set up
an environment before running, but even this is not enough
on VC 2017 when cross compiling (e.g. using an x64 toolchain
to target x86, or vice versa).

The reason is that although clang-cl itself will have a
valid environment, it will shell out to other tools (such
as link.exe) which may not.  Generally we solve this through
adding the appropriate linker flags, but this is not enough
in VC 2017.

The cross-linker and the regular linker both link against
some common DLLs, but these DLLs live in the binary directory
of the native linker.  When setting up a cross-compilation
environment through vcvarsall, it will add *both* directories
to %PATH%, so that when cl shells out to any of the associated
tools, those tools will be able to find all of the dependencies
that it links against.  If you don't do this, link.exe will
fail to run because the loader won't be able to find all of
the required DLLs that it links against.

To solve this we teach the driver how to spawn a process with
an explicitly specified environment.  Then we modify the
PATH before shelling out to subtools and run with the modified
PATH.

Patch by Hamza Sood
Differential Revision: https://reviews.llvm.org/D30991

llvm-svn: 298098
2017-03-17 16:24:34 +00:00
David Green 4734c6f808 Test commit.
llvm-svn: 298097
2017-03-17 15:38:49 +00:00
Craig Topper 6afc436a78 [AVX-512] Change the input type for some load intrinsics to take void type like the spec (and the test cases say).
llvm-svn: 298042
2017-03-17 05:59:25 +00:00
Craig Topper 208c80556c [AVX-512] Fix test cases that were using the builtins directly without typecasts instead of the intrinsic header.
llvm-svn: 298041
2017-03-17 05:59:22 +00:00
Craig Topper 2e5058c403 [AVX-512] Add missing typecasts and parentheses to _mm512_mask_i64gather_ps. My macro cleanup script I used on the others last year must have missed it.
llvm-svn: 298040
2017-03-17 05:14:37 +00:00
Argyrios Kyrtzidis c6c4ec8099 [Serialization] Follow-up to r297972, deserialize name/loc in separate statements to make sure they deserialize in defined order.
This should fix the windows bots.

llvm-svn: 298027
2017-03-17 00:49:42 +00:00
Eric Christopher 2be653f716 Remove setting LessPreciseFPMADOption on the TargetOption as it's
unused anywhere in llvm.

llvm-svn: 298022
2017-03-17 00:37:53 +00:00
Bruno Cardoso Lopes ae1249e4f2 [Headers] Reapply: Add #include_next for tgmath.h on Darwin
Reapply r289181 but rename the include guard to avoid
conflict with the one from Darwin.

Allow darwin to provide additional definitions and implementation
specifc values for tgmath.h on Apple platforms.

rdar://problem/19019845

llvm-svn: 298013
2017-03-16 23:19:00 +00:00
Bruno Cardoso Lopes 448d4289b0 [Modules] Add documentation on private frameworks
Expand a bit on private modules with some guidance on how to write
them in the context of frameworks.

rdar://problem/24758771

llvm-svn: 298012
2017-03-16 23:18:55 +00:00
Eric Christopher dec1b92ccc Add a small test for __STRUCT_PARM_ALIGN__ for ppc64 darwin.
llvm-svn: 298006
2017-03-16 22:31:07 +00:00
Reid Kleckner a902600881 Create msbuild only when using MSVC
Patch by: Mateusz Mikula

Reviewers: rnk

Reviewed By: rnk

Subscribers: asl, mgorny, cfe-commits

Tags: #clang-c

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

llvm-svn: 297998
2017-03-16 21:21:00 +00:00
Reid Kleckner e258c44002 Use arg_begin() instead of getArgumentList().begin(), the argument list is an implementation detail
llvm-svn: 297975
2017-03-16 18:55:46 +00:00
Argyrios Kyrtzidis eea3fd491d [AST] Follow-up to r297972, add default value for setGetterName/setSetterName if a source-loc is not provided.
Fixes lldb build.

llvm-svn: 297974
2017-03-16 18:40:13 +00:00
Argyrios Kyrtzidis 194b28ebb1 [index/AST] Add references for ObjC getter=/setter= property attributes and related property getter/setter role fixes
This enhances the AST to keep track of locations of the names in those ObjC property attributes, and reports them for indexing.

Patch by Nathan Hawes!
https://reviews.llvm.org/D30907

llvm-svn: 297972
2017-03-16 18:25:40 +00:00
Alex Lorenz 3e54835ad7 [ObjC][Sema] Avoid ARC performSelector error for 'self' selector
The instance method 'self' does not actually return an over-retained object,
so we shouldn't report an error when it's used with 'performSelector'.

rdar://31071620

llvm-svn: 297961
2017-03-16 16:36:11 +00:00
Ed Schouten f59d8df38d Make table cells referring to Clang 4 green, as Clang 4 has been released.
llvm-svn: 297956
2017-03-16 14:21:00 +00:00
Egor Churaev 60c30ae1f1 [OpenCL] Implement as_type operator as alias of __builtin_astype.
Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: cfe-commits, yaxunl, bader

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

llvm-svn: 297947
2017-03-16 12:15:10 +00:00
Martin Probst c9c51c4e41 [clang-format] disable adding extra space after MSVC '__super' keyword
clang-format treats MSVC `__super` keyword like all other keywords adding
a single space after. This change disables this behavior for `__super`.

Patch originally by jutocz (thanks!).

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

llvm-svn: 297936
2017-03-16 10:21:35 +00:00
Daniel Jasper 04bbda9923 clang-format: Fix bug in wrapping behavior of operators.
Before (even violating the column limit):
  auto Diag =
      diag()
      << aaaaaaaaaaaaaaaa(aaaaaaaaaaaa, aaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  auto Diag = diag() << aaaaaaaaaaaaaaaa(aaaaaaaaaaaa, aaaaaaaaaaaaa,
                                         aaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 297931
2017-03-16 07:54:11 +00:00
Eric Christopher e54a592aee Fix up testcase to:
a) avoid actually compiling anything
b) avoid depositing files in the test directory
c) use a check line to make sure that we're looking for the correct behavior

llvm-svn: 297917
2017-03-15 23:41:58 +00:00
Simon Pilgrim 1e4e7a9796 Remove repeated code (PR32250). NFCI.
llvm-svn: 297905
2017-03-15 22:43:36 +00:00
Guansong Zhang ce450a662e fix build break by removing the target on command line
llvm-svn: 297896
2017-03-15 21:46:44 +00:00
Guansong Zhang 4747cf5677 enable -save-temps with -finclude-defult-header
Currently the two flags can not work together.

To illustrate the issue, we can have an one line file a.cl contains only an empty function

cat a.cl

void test(){}

Then use

clang -v -save-temps -x cl -Xclang -cl-std=CL2.0 -Xclang -finclude-default-header -target amdgcn -S -c a.cl

we will get redefinition errors for various things.

The reason is that the -finclude-default-header flag is not meant to be on cc1 command other than the preprocessor.

The fix is modeled after the code just below the change to filter the -finclude-default-header flag out when we are not in the preprocess phase.

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

llvm-svn: 297890
2017-03-15 20:57:11 +00:00
Simon Pilgrim 6c38e71476 [X86][XOP] Add codegen tests for vector integer comparison intrinsics (PR15844)
We were testing for the generic _mm_com_* intrinsics, but not the specific comparison mode versions.

llvm-svn: 297885
2017-03-15 20:20:43 +00:00
Aaron Ballman 9fd6ee6a78 Add AST matchers for ObjCProtocolDecl, ObjCCategoryDecl, ObjCMethodDecl, ObjCIvarDecl, and ObjCPropertyDecl.
Patch by Dave Lee.

llvm-svn: 297882
2017-03-15 20:14:25 +00:00
Zachary Turner 43e3f97797 Fix uninitialized value.
llvm-svn: 297881
2017-03-15 19:54:25 +00:00
Akira Hatanaka f86ded282d [Driver] Define macro __APPLE_EMBEDDED_SIMULATOR__ when option
-m(i|tv|watch)os-simulator-version-min is on the command line.

Previously the driver would treat -m(i|tv|watch)os-simulator-version-min
as an alias of -m(i|tv|watch)os-version-min. This no longer works since
we now need to distinguish between the two options (the latter is used
for iOS running in a VM, for example).

This commit stops making the simulator options the aliases of the OS
options and defines a macro to differentiate between the two groups of
options. 

rdar://problem/28872911

llvm-svn: 297866
2017-03-15 18:04:13 +00:00
Alex Lorenz 5e895cf2c3 [ObjC][Sema] Avoid warning about a call to an instance method on an
instance of a qualified Class object when that instance method comes from
a protocol that's implemented by NSObject

Instance methods from a root class like NSObject are also class methods because
the metaclass of root class derives from that root class. Therefore, we can
avoid the warning for instances of qualified Class objects that point to classes
that derive from NSObject. Note that we actually don't know if a Class instance
points to a class that derives from NSObject at compile-time, so we have to
make a reasonable assumption that the majority of instances will do so.

rdar://22812517

llvm-svn: 297862
2017-03-15 17:16:41 +00:00