Commit Graph

62394 Commits

Author SHA1 Message Date
Alexey Bataev 74caaf27d8 [OPENMP 4.5] Initial support for data members in 'lastprivate' clause.
OpenMP 4.5 allows to privatize non-static data members of current class
in non-static member functions. Patch adds initial support for data
members.

llvm-svn: 261412
2016-02-20 04:09:36 +00:00
David Majnemer 7a0d7d6be9 Remove a duplicate declaration specifier from _ReadBarrier
This fixes PR26675.

llvm-svn: 261388
2016-02-20 00:57:00 +00:00
Richard Smith e5b5350d98 [modules] Do less scanning of macro definition chains when computing the set of
exported module macros outside local submodule visibility mode. Related to
PR24667.

llvm-svn: 261373
2016-02-19 22:43:58 +00:00
Richard Smith 7e82e019c6 [modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a single
option. Previously these options could both be used to specify that you were
compiling the implementation file of a module, with a different set of minor
bugs in each case.

This change removes -fmodule-implementation-of, and instead tracks a flag to
determine whether we're currently building a module. -fmodule-name now behaves
the same way that -fmodule-implementation-of previously did.

llvm-svn: 261372
2016-02-19 22:25:36 +00:00
Anastasia Stulova 6bdbcbb3d9 [OpenCL] Generate metadata for opencl_unroll_hint attribute
Add support for opencl_unroll_hint attribute from OpenCL v2.0 s6.11.5.

Reusing most of metadata generation from CGLoopInfo helper class.

The code is based on Khronos OpenCL compiler:
https://github.com/KhronosGroup/SPIR/tree/spirv-1.0

Patch by Liu Yaxun (Sam)!

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

llvm-svn: 261350
2016-02-19 18:30:11 +00:00
Serge Pavlov 7ca8a826f4 Removed unused local variable
llvm-svn: 261323
2016-02-19 12:06:23 +00:00
Alexey Bataev 455bdd9234 pr26544: Bitfield layout with pragma pack and attributes "packed" and
"aligned", by Vladimir Yakovlev

Fix clang/gcc incompatibility of bitfields layout in the presence of
pragma packed and attributes aligned and packed.
Differential Revision: http://reviews.llvm.org/D17023

llvm-svn: 261321
2016-02-19 11:23:28 +00:00
Alexey Bataev 50b3c95992 [OPENMP] Improved layout of CGOpenMPRuntime class, NFC.
llvm-svn: 261315
2016-02-19 10:38:26 +00:00
David Majnemer c919f5f964 Correct typos after acting on invalid subscript expressions
llvm-svn: 261312
2016-02-19 07:15:33 +00:00
JF Bastien ddb4369ead Add test.
llvm-svn: 261310
2016-02-19 06:54:47 +00:00
JF Bastien 750caef39c ARM: fix VFP asm constraints
Summary:
Rich Felker was sad that clang used 'w' and 'P' for VFP constraints when GCC documents them as 't' and 'w':
  https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html

This was added way back in 2008:
  http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20080421/005393.html

Subscribers: aemerson, rengolin, cfe-commits

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

llvm-svn: 261309
2016-02-19 06:54:45 +00:00
Nico Weber 344abaa026 Fix SemaTemplate/instantiate-field.cpp after r261297.
For templates, fields can have incomplete types:

  template <class T>
  struct A2 {
    struct B;
    B b;
  };

Don't try to touch the DefinitionData of those fields.

llvm-svn: 261301
2016-02-19 02:51:07 +00:00
Nico Weber 6a6376b17c Implement the likely resolution of core issue 253.
C++11 requires const objects to have a user-provided constructor, even for
classes without any fields. DR 253 relaxes this to say "If the implicit default
constructor initializes all subobjects, no initializer should be required."

clang is currently the only compiler that implements this C++11 rule, and e.g.
libstdc++ relies on something like DR 253 to compile in newer versions.  This
change  makes it possible to build code that says `const vector<int> v;' again
when using libstdc++5.2 and _GLIBCXX_DEBUG
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60284).

Fixes PR23381.

http://reviews.llvm.org/D16552

llvm-svn: 261297
2016-02-19 01:52:46 +00:00
Nico Weber 5f1c2851cc Update cxx_dr_status.html with today's cwg_index.html.
Created by:
cd www
curl -O http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html
./make_cxx_dr_status

llvm-svn: 261295
2016-02-19 01:49:39 +00:00
Devin Coughlin 8d922aa746 [analyzer] Add checker callback for beginning of function.
Add a checker callback that is called when the analyzer starts analyzing a
function either at the top level or when inlined. This will be used by a
follow-on patch making the DeallocChecker path sensitive.

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

llvm-svn: 261293
2016-02-19 01:35:10 +00:00
Reid Kleckner bde5ede526 [Sema] PR25181 Fix crash when method declaration with throw spec fails to parse correctly
Fixes crash referenced in PR25181 where dyn_cast is called on a null
instance of LM.Method.

Reviewers: majnemer, rnk

Patch by Don Hinton

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

llvm-svn: 261292
2016-02-19 01:15:08 +00:00
Reid Kleckner a2550e68a5 Add call to find_package to load LLVM dependencies
ClangConfig requires LLVMConfig, so add find_package call in
ClangConfig so find_package(clang REQUIRED CONFIG) will just work.  This
makes it easier for cmake based projects to use clang, e.g., tools using
ClangTooling.

Patch by Don Hinton

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

llvm-svn: 261290
2016-02-19 00:56:56 +00:00
Richard Trieu 54f82bfb80 Fix my typo from r261278
llvm-svn: 261285
2016-02-19 00:15:50 +00:00
Richard Trieu faca2d83b1 Add -Wcomma warning to Clang.
-Wcomma will detect and warn on most uses of the builtin comma operator.  It
currently whitelists the first and third statements of the for-loop.  For other
cases, the warning can be silenced by casting the first operand of the comma
operator to void.

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

llvm-svn: 261278
2016-02-18 23:58:40 +00:00
Argyrios Kyrtzidis 544ea71cd7 [ASTImporter] Implement missing VisitAccessSpecDecl function in ASTImporter class.
Patch by Elisavet Sakellari!

llvm-svn: 261274
2016-02-18 23:08:36 +00:00
Richard Trieu cc3949d99a Remove use of builtin comma operator.
Cleanup for upcoming Clang warning -Wcomma.  No functionality change intended.

llvm-svn: 261271
2016-02-18 22:34:54 +00:00
Akira Hatanaka cb4525443c [Sema] Fix bug in TypeLocBuilder::pushImpl
The code in TypeLocBuilder::pushImpl wasn't correctly handling the case
where an element that has an 8-byte alignment was being pushed.

I plan to follow up with a patch to remove redundancies and simplify the
function.

rdar://problem/23838912

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

llvm-svn: 261260
2016-02-18 21:05:09 +00:00
Krzysztof Parzyszek da3f20e88e Missed a spot in r261251, also ignore attributes on all pointer parameters
llvm-svn: 261253
2016-02-18 20:30:40 +00:00
David L. Jones cd58bd6200 Use Backend_EmitMCNull for null codegen unit tests.
Using Backend_EmitLL attemps to create a file with an empty filename.
This is problematic in certain environments: an empty filename may be
illegal, or the default output path may not be writable (in the case
where an empty filename would otherwise have some non-failing
semantics). This patch switches to use Backend_EmitMCNull, which
allows CodeGen to run, but does not attempt to create or write an
output file.

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

llvm-svn: 261252
2016-02-18 20:27:16 +00:00
Krzysztof Parzyszek 6b2608f2e0 Make test less prone to attribute changes
llvm-svn: 261251
2016-02-18 20:02:03 +00:00
Devin Coughlin ef3697e093 [analyzer] Include comment mistakenly left out of r261243. NFC.
It explains why we can't just synthesize bodies of setters in BodyFarm.

llvm-svn: 261248
2016-02-18 19:37:39 +00:00
Nico Weber 4152f522aa Make deprecation message for -fsanitize-coverage= with numeric argument friendlier.
http://reviews.llvm.org/D17397

llvm-svn: 261247
2016-02-18 19:32:54 +00:00
Devin Coughlin 069a1073dd [analyzer] Improve modeling of ObjC synthesized property setters.
When modeling a call to a setter for a property that is synthesized to be
backed by an instance variable, don't invalidate the entire instance
but rather only the storage for the updated instance variable itself.

This still doesn't model the effect of the setter completely. It doesn't
bind the set value to the ivar storage location because doing so would cause
the set value to escape, removing valuable diagnostics about potential
leaks of the value from the retain count checker.

llvm-svn: 261243
2016-02-18 19:13:30 +00:00
Serge Pavlov 7a545536f5 File missed from r261222
llvm-svn: 261223
2016-02-18 16:43:24 +00:00
Serge Pavlov 41c1f79dfe Avoid double deletion in Clang driver.
Llvm module object is shared between CodeGenerator and BackendConsumer,
in both classes it is stored as std::unique_ptr, which is not a good
design solution and can cause double deletion error. Usually it does
not occur because in BackendConsumer::HandleTranslationUnit the
ownership of CodeGenerator over the module is taken away. If however
this method is not called, the module is deleted twice and compiler crashes.

As the module owned by BackendConsumer is always the same as CodeGenerator
has, pointer to llvm module can be removed from BackendGenerator.

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

llvm-svn: 261222
2016-02-18 16:42:09 +00:00
Aaron Ballman eb7e5d9074 Add an AST matcher for real floating-point types. e.g., float, double, long double, but not complex.
llvm-svn: 261221
2016-02-18 16:36:01 +00:00
Yury Gribov 75118f5d3d [analyzer] dump_ast_matchers.py: fix replacement regexps
Patch by Alex Sidorin!

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

llvm-svn: 261219
2016-02-18 15:43:56 +00:00
Benjamin Kramer 72dae62b8a [Parse] Code complete expressions in bracket declarators.
Currently we return no results when completing inside of the brackets in
a 'char foo[]' declaration. Let the generic expression completion code
handle it instead. We could get fancier here (e.g. filter non-constant
expressions in contexts where VLAs are not allowed), but it's a strict
improvement over the existing version.

llvm-svn: 261217
2016-02-18 15:30:24 +00:00
Alexey Bataev 8ffcc949b1 [OPENMP] Fix codegen for lastprivate loop counters.
Patch fixes bug with codegen for lastprivate loop counters. Also it may
improve performance for lastprivates calculations in some cases.

llvm-svn: 261209
2016-02-18 13:48:15 +00:00
Yury Gribov a6560ebe4c [analyzer] Add --force-analyze-debug-code option to scan-build
to force debug build and hopefully enable more precise warnings.

Static Analyzer is much more efficient when built in debug mode
(-UNDEBUG) so we advice users to enable it manually. This may be
inconvenient in case of large complex projects (think about Linux
distros e.g. Android or Tizen). This patch adds a flag to scan-build
which inserts -UNDEBUG automatically.

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

llvm-svn: 261204
2016-02-18 11:08:46 +00:00
Michael Zuckerman 7cdb72f7ea [CLANG] [AVX512] [BUILTIN] Adding pmovsx{b|d|w}{w|d|q}{128|256|512} builtin to clang
Differential Revision: http://reviews.llvm.org/D16955

llvm-svn: 261196
2016-02-18 09:09:34 +00:00
David Majnemer 597293981d [MSVC] Turn C++ EH on my default
Our support for C++ EH is sufficiently good that it makes sense to
enable support for it out of the box.

While we are here, update the MSVCCompatibility doc.

llvm-svn: 261195
2016-02-18 08:15:05 +00:00
Saleem Abdulrasool 046ba5b66f Sema: provide an extension warning for enable_if
Clang implements an enable_if attribute as an extension.  Hook up `-Wpedantic`
to issue an extension usage warning when __enable_if__ is used.

llvm-svn: 261192
2016-02-18 06:49:31 +00:00
David Majnemer bc24cb5fb5 [Parse] Make sure we don't forget to diagnose typos in exprs
If ActOn*Op fails, we will forget to diagnose typos in the LHS of
expressions.

llvm-svn: 261191
2016-02-18 06:37:44 +00:00
Kostya Serebryany 52e86493e3 [sanitizer-coverage] allow -fsanitize-coverage=trace-pc w/o any other sanitizer and w/o ...=[func,bb,edge]. This makes this syntax a superset of the GCC's syntax
llvm-svn: 261182
2016-02-18 00:49:23 +00:00
Kostya Serebryany 8e3061b865 [sanitizer-coverage] add a deprecation warning for -fsanitize-coverage=[1234]
llvm-svn: 261178
2016-02-17 23:57:17 +00:00
David Majnemer 38a3dbdcbf Don't crash w/ a diagnostic range containing a null byte
We prematurely ended the line at the null byte which caused us to crash
down stream because we tried to reason about columns beyond the end of
the line.

llvm-svn: 261171
2016-02-17 22:37:45 +00:00
Manman Ren b636b904c2 Add 'nopartial' qualifier for availability attributes.
An optional nopartial can be placed after the platform name.
int bar() __attribute__((availability(macosx,nopartial,introduced=10.12))

When deploying back to a platform version prior to when the declaration was
introduced, with 'nopartial', Clang emits an error specifying that the function
is not introduced yet; without 'nopartial', the behavior stays the same: the
declaration is `weakly linked`.

A member is added to the end of AttributeList to save the location of the
'nopartial' keyword. A bool member is added to AvailabilityAttr.

The diagnostics for 'nopartial' not-yet-introduced is handled in the same way as
we handle unavailable cases.

Reviewed by Doug Gregor and Jordan Rose.

rdar://23791325

llvm-svn: 261163
2016-02-17 22:05:48 +00:00
Richard Smith 4083e038e9 [modules] Cache 'acceptable decl' lookups for namespaces. In projects with
thousands of modules, each of which declares the same namespace, linearly
scanning the redecl chain looking for a visible declaration (once for each leaf
module, for each use) performs very poorly. Namespace visibility can only
decrease when we leave a module during a module build step, and we never care
*which* visible declaration of a namespace we find, so we can cache this very
effectively.

This results in a 35x speedup on one of our internal build steps (2m -> 3.5s),
but is hard to unit test because it requires a very large number of modules.
Ideas for a test appreciated! No functionality change intended other than the
speedup.

llvm-svn: 261161
2016-02-17 21:52:44 +00:00
Kostya Serebryany d4590c7304 [sanitizer-coverage] implement -fsanitize-coverage=trace-pc. This is similar to trace-bb, but has a different API. We already use the equivalent flag in GCC for Linux kernel fuzzing. We may be able to use this flag with AFL too
llvm-svn: 261159
2016-02-17 21:34:43 +00:00
Akira Hatanaka 9d8ac61fec [CodeGen] Fix an assert in CodeGenFunction::EmitFunctionEpilog
The assert is triggered because isObjCRetainableType() is called on the
canonicalized return type that has been stripped of the typedefs and
attributes attached to it. To fix this assert, this commit gets the
original return type from CurCodeDecl or BlockInfo and uses it instead
of the canoicalized type.

rdar://problem/24470031

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

llvm-svn: 261151
2016-02-17 21:09:50 +00:00
Ed Schouten 51bfbe7f2c Enable SafeStack for CloudABI.
Summary:
I've got a patchset in my home directory to integrate support for
SafeStack into CloudABI's C library. All of the CloudABI unit tests
still seem to pass. Pretty sweet!

This change adds the necessary changes to Clang to make
-fsanitize=safe-stack work on CloudABI. Without it, passing this command
line flag throws an error.

Reviewers: eugenis, samsonov

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

llvm-svn: 261135
2016-02-17 18:56:20 +00:00
David Majnemer 2eb74e278d Correct more typos in conditional expressions
We didn't correctly handle some edge cases, causing us to bail out
before correcting all the typos.

llvm-svn: 261109
2016-02-17 17:19:00 +00:00
Alexey Bataev a462b4502f [OPENMP] Fix tests incompatibility with ARM buildbots.
llvm-svn: 261098
2016-02-17 15:36:39 +00:00
Alexey Bataev 417089fc7e [OPENMP 4.5] Codegen support for data members in 'firstprivate' clause.
Added codegen for captured data members in non-static member functions.

llvm-svn: 261089
2016-02-17 13:19:37 +00:00