Commit Graph

18840 Commits

Author SHA1 Message Date
Alexander Kornienko
3474b55858 [clang-tidy] Make NumOccurrenceFlag for SourcePaths configurable.
Added an additional ctor that takes a NumOccurrenceFlag parameter for the
SourcePaths option. This frees applications from always having to pass at least
one source file, e.g., -list-checks.

http://reviews.llvm.org/D12069

Patch by Don Hinton!

llvm-svn: 245204
2015-08-17 10:01:42 +00:00
Richard Smith
e75ee0f0c8 [modules] When explicitly building a module file, don't include timestamps in
the produced pcm file for stable file creation across distributed build
systems.

llvm-svn: 245199
2015-08-17 07:13:32 +00:00
Davide Italiano
32cbff7809 [Sema] Be consistent about diagnostic wording: always use "cannot".
Discussed with Richard Smith.

llvm-svn: 245162
2015-08-15 15:23:14 +00:00
Hans Wennborg
99000c24c9 Delay emitting members of dllexport classes until the class is fully parsed (PR23542)
This enables Clang to correctly handle code such as:

  struct __declspec(dllexport) S {
    int x = 42;
  };

where it would otherwise error due to trying to generate the default
constructor before the in-class initializer for x has been parsed.

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

llvm-svn: 245139
2015-08-15 01:18:16 +00:00
Nathan Wilson
b20ab9245a [CONCEPTS] Add diagnostic; invalid tag when concept specified
Summary: Adding check to emit diagnostic for invalid tag when concept is specified and associated tests.

Reviewers: rsmith, hubert.reinterpretcast, fraggamuffin, faisalv, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 245123
2015-08-14 23:19:32 +00:00
Davide Italiano
da8a3b903b [Sema] main can't be declared as global variable, in C++.
So, we now reject that. We also warn for any external-linkage global
variable named main in C, because it results in undefined behavior.

PR:	  24309
Differential Revision:	http://reviews.llvm.org/D11658
Reviewed by:	rsmith

llvm-svn: 245051
2015-08-14 14:13:29 +00:00
Alexey Bataev
b08f89ffc1 [OPENMP] Fix for http://llvm.org/PR24371: Assert failure compiling blender 2.75.
blender uses statements expression in condition of the loop under control of the '#pragma omp parallel for'. This condition is used several times in different expressions required for codegen of the loop directive. If there are some variables defined in statement expression, it fires an assert during codegen because of redefinition of the same variables.
We have to rebuild several expression to be sure that all variables are unique.

llvm-svn: 245041
2015-08-14 12:25:37 +00:00
Manuel Klimek
5d093286f0 Fix AST matcher documentation.
Fix a bug in the matcher docs where callExpr(on(...)) was in the examples,
but didn't work (on() only works for memberCallExpr).

Fix a bug in the doc dump script that was introduced in r231575 when
removing a regexp capture without adapting the code that uses the
captures.

llvm-svn: 245040
2015-08-14 11:47:51 +00:00
Manuel Klimek
54042e743c Add structed way to express command line options in the compilation database.
Currently, arguments are passed via the string attribute 'command',
assuming a shell-escaped / quoted command line to extract the original
arguments. This works well enough on Unix systems, but turns out to be
problematic for Windows tools to generate.

This CL adds a new attribute 'arguments', an array of strings, which
specifies the exact command line arguments. If 'arguments' is available
in the compilation database, it is preferred to 'commands'.

Currently there is no plan to retire 'commands': there are enough
different use cases where users want to create their own mechanism for
creating compilation databases, that it doesn't make sense to force them
all to implement shell command line parsing.

Patch by Daniel Dilts.

llvm-svn: 245036
2015-08-14 09:55:36 +00:00
Richard Smith
fb1e7f7d1a [modules] Add an experimental -cc1 feature to embed the contents of an input
file in the .pcm files. This allows a smaller set of files to be sent to a
remote build worker when building with explicit modules (for instance, module
map files need not be sent along with the corresponding precompiled modules).

This doesn't actually make the embedded files visible to header search, so
it's not useful as a packaging format for public header files.

llvm-svn: 245028
2015-08-14 05:02:58 +00:00
David Blaikie
86d8cf3502 unique_ptrify ConsumedBlockInfo analysis to make it move assignable
ConsumedBlockInfo objects were move assigned, but only in a state where
the dtor was a no-op anyway. Subtle and easily could've happened in ways
that wouldn't've been safe - so this change makes it safe no matter what
state the ConsumedBlockInfo object is in.

llvm-svn: 244998
2015-08-14 01:26:19 +00:00
David Majnemer
2dcef9e0a4 Avoid iteration invalidation issues around MaterializedTemporaryExpr
We risk iterator invalidation issues if we use a DenseMap to hold the
backing storage for an APValue.  Instead, BumpPtrAllocate them and
use APValue * as our DenseMap value.

Also, don't assume that MaterializedGlobalTemporaryMap won't regrow
between when we initially perform a lookup and later on when we actually
try to insert into it.

This fixes PR24289.

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

llvm-svn: 244989
2015-08-13 23:50:15 +00:00
David Blaikie
8b0e915144 Wdeprecated: Ensure CheckNames are copy assignable (used in setCurrentCheckName) by removing the unnecessary copy ctor
llvm-svn: 244986
2015-08-13 23:38:46 +00:00
David Blaikie
aa0d51f062 Wdeprecated: Make Filter safely move constructible.
makeFilter returns Filters by value which seems to be only safe when the
copy doesn't occur and RVO kicks in. Make the object safely movable to
support this more reliably.

llvm-svn: 244983
2015-08-13 23:15:20 +00:00
David Blaikie
78f7fc7e57 Fix the MSVC build which cannot manifest default move ops
llvm-svn: 244980
2015-08-13 23:05:58 +00:00
David Blaikie
6951e3e406 Wdeprecated: BugReporterVisitors are copied for cloning (BugReporterVisitorImpl), make sure such copies are safe
Make the copy/move ctors defaulted in the base class and make the
derived classes final to avoid any intermediate hierarchy slicing if
these types were further derived.

llvm-svn: 244979
2015-08-13 22:58:37 +00:00
David Blaikie
048f975e2b Follow up r244975: The ctors of an abstract class don't need to be protected - the object isn't directly constructible/doesn't present a slicing risk
llvm-svn: 244978
2015-08-13 22:58:35 +00:00
David Blaikie
903c29347a Wdeprecated: CollectReachableSymbolsCallback are move constructed/returned by value, so make sure they're copy/moveable
(return by value is in ExprEngine::processPointerEscapedOnBind and any
other call to the scanReachableSymbols function template used there)

Protect the special members in the base class to avoid slicing, and make
derived classes final so these special members don't accidentally become
public on an intermediate base which would open up the possibility of
slicing again.

llvm-svn: 244975
2015-08-13 22:50:09 +00:00
David Blaikie
55477463d6 Wdeprecated: PathPieces are copied, make them safely implicitly copyable by removing the unnecessary user declared dtor.
llvm-svn: 244973
2015-08-13 22:23:53 +00:00
David Blaikie
210ea0b31a Wdeprecated: StoredDiagnostics are stored in a SmallVector, so make sure they're copy/movable
Removing the no-op dtor makes these objects safely implicitly
copyable/movable/etc.

(& tidy up the ctor, while I'm here)

llvm-svn: 244971
2015-08-13 22:20:14 +00:00
David Blaikie
c1334cc17d Wdeprecated: Make BumpVectorContext movable
Turns out the one place that relied on the implicit copy ctor was safe
because it created an object in a state where the dtor was a no-op, but
that's more luck that good management.

Sure up the API by defining move construction and using it, which
implicitly disallows the unreliable copy operations.

llvm-svn: 244968
2015-08-13 22:12:21 +00:00
David Blaikie
9ae479c521 Wdeprecated: LambdaScopeInfos are copied in TreeTransform, so make sure they're copyable.
Partly addressed by r244843, but the explicit dtor in LambdaScopeInfo
was still thwarting the implicit copy ctor. This does remove the key
function from LambdaScopeInfo unfortunately, but it seems neater than
having to explicitly default any special members LambdaScopeInfo needs.

llvm-svn: 244957
2015-08-13 21:23:08 +00:00
David Blaikie
6646e4c193 Wdeprecated: Replace deprecated throw() with LLVM_NOEXCEPT which expands to 'noexcept' where available (and throw() otherwise)
llvm-svn: 244956
2015-08-13 21:15:23 +00:00
Richard Smith
216a3bd70d [modules] Change the way we deal with .d output for explicitly-specified module
files: include the .pcm file itself in the .d output, rather than including its
own input files. Other forms of module file continue to be transparent for .d
output.

Arguably, the input files for the .pcm file are still inputs to the
compilation, but that's unnecessary for make-like build systems (where the
mtime of the .pcm file is sufficient) and harmful for smarter build systems
that know about module files and want to track only the local dependencies.

llvm-svn: 244923
2015-08-13 17:57:10 +00:00
Ben Langmuir
7ff29148ac [Modules] Add Darwin-specific compatibility module map parsing hacks
This preserves backwards compatibility for two hacks in the Darwin
system module map files:

1. The use of 'requires excluded' to make headers non-modular, which
should really be mapped to 'textual' now that we have this feature.

2. Silently removes a bogus cplusplus requirement from IOKit.avc.

Once we start diagnosing missing requirements and headers on
auto-imports these would have broken compatibility with existing Darwin
SDKs.

llvm-svn: 244912
2015-08-13 17:13:33 +00:00
Ivan Krasin
1193f2cbc0 Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.
Summary:
Clang sanitizers, such as AddressSanitizer, ThreadSanitizer, MemorySanitizer,
Control Flow Integrity and others, use blacklists to specify which types / functions
should not be instrumented to avoid false positives or suppress known failures.

This change adds the blacklist filenames to the list of dependencies of the rules,
generated with -M/-MM/-MD/-MMD. This lets CMake/Ninja recognize that certain
C/C++/ObjC files need to be recompiled (if a blacklist is updated).

Reviewers: pcc

Subscribers: rsmith, honggyu.kim, pcc, cfe-commits

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

llvm-svn: 244867
2015-08-13 04:04:37 +00:00
Richard Smith
03a06dd13c Add SourceManager::dump() to dump the current set of SLocEntries.
llvm-svn: 244852
2015-08-13 00:45:11 +00:00
David Blaikie
7cb12c7489 Wdeprecated: LambdaScopeInfos need to be copied, so make the ScopeInfo hierarchy safely copyable
Making the base class's copy ctor protected and the derived classes
final to avoid any slicing-prone APIs.

llvm-svn: 244843
2015-08-12 23:59:02 +00:00
Hans Wennborg
259b71a4d2 Options.td: Drop trailing space in -fsanitize= help text
llvm-svn: 244795
2015-08-12 19:35:05 +00:00
Saleem Abdulrasool
993b2864da libclang: Add period to typedef kind docblock
All of the other docblocks for the CXCursor_* cursor kind enum values
include documentation that ends with a period. Add a period to the end
of the CXCursor_TypedefDecl documentation to follow this convention.

Patch by Brian Gesiak!

llvm-svn: 244715
2015-08-12 03:21:44 +00:00
Piotr Padlewski
592b2cc246 Deleted old fixme ( ͡° ͜ʖ ͡°)
http://reviews.llvm.org/D11928

llvm-svn: 244706
2015-08-12 00:47:19 +00:00
Richard Smith
9c9173dcc8 [modules] When instantiating the contents of an imported CXXRecordDecl, we can
emit lexical contents for a declaration for another module. Track which module
those contents came from, and ensure that we only grab the lexical contents
from a single such instantiation.

llvm-svn: 244682
2015-08-11 22:00:24 +00:00
Aaron Ballman
2e1f109c95 Fixing a few C++0x comments to be C++11; NFC.
llvm-svn: 244670
2015-08-11 21:17:53 +00:00
Aaron Ballman
6f6d0b6c5a Add a polymorphic AST matcher for testing whether a constructor or a conversion declaration is marked as explicit or not.
llvm-svn: 244666
2015-08-11 21:09:52 +00:00
Aaron Ballman
ed455d4062 Add an AST matcher to match member intializers of a CXXCtorInitializer.
llvm-svn: 244662
2015-08-11 20:42:00 +00:00
David Majnemer
f6ae8ae025 [MSVC Compatibility] Classify ext_ms_cast_fn_obj as DefaultError
This non-conforming extension was introduced to make it possible for us
to correctly compile <atomic> in VS 2013 and 2015.  Let's limit its
impact to system headers to encourage portable code.

llvm-svn: 244650
2015-08-11 19:25:13 +00:00
Richard Smith
6d47d16ed6 Remove some dead code.
llvm-svn: 244530
2015-08-10 23:26:54 +00:00
Tyler Nowicki
034baf6154 Append options for vectorization when pointer checking threshold is exceeded.
Following one of the appended options will allow the loop to be vectorized. We do not include a command line option for modifying the pointer checking threshold because there is no clang-level interface for this currently.

llvm-svn: 244526
2015-08-10 23:05:16 +00:00
Tyler Nowicki
40e5d08a74 Remove non-ascii characters.
llvm-svn: 244506
2015-08-10 21:18:01 +00:00
Artem Belevich
194ba60fe2 [CUDA] Added stubs for new attributes used by CUDA headers.
The main purpose is to avoid errors and warnings while parsing CUDA
header files. The attributes are currently unused otherwise.

Differential version: http://reviews.llvm.org/D11690

llvm-svn: 244497
2015-08-10 20:33:56 +00:00
Tyler Nowicki
8a0925cb62 Append options for floating-point commutivity when related diagnostics are produced.
With this patch clang appends the command line options that would allow vectorization when floating-point commutativity is required. Specifically those are enabling fast-math or specifying a loop hint. 

llvm-svn: 244492
2015-08-10 19:56:40 +00:00
Mark Heffernan
397a98d86d Add new llvm.loop.unroll.enable metadata for use with "#pragma unroll".
This change adds the new unroll metadata "llvm.loop.unroll.enable" which directs
the optimizer to unroll a loop fully if the trip count is known at compile time, and
unroll partially if the trip count is not known at compile time. This differs from
"llvm.loop.unroll.full" which explicitly does not unroll a loop if the trip count is not
known at compile time

With this change "#pragma unroll" generates "llvm.loop.unroll.enable" rather than
"llvm.loop.unroll.full" metadata. This changes the semantics of "#pragma unroll" slightly
to mean "unroll aggressively (fully or partially)" rather than "unroll fully or not at all".

The motivating example for this change was some internal code with a loop marked
with "#pragma unroll" which only sometimes had a compile-time trip count depending
on template magic. When the trip count was a compile-time constant, everything works
as expected and the loop is fully unrolled. However, when the trip count was not a
compile-time constant the "#pragma unroll" explicitly disabled unrolling of the loop(!).
Removing "#pragma unroll" caused the loop to be unrolled partially which was desirable
from a performance perspective.

llvm-svn: 244467
2015-08-10 17:29:39 +00:00
Roman Kashitsyn
291f64fd03 Add WebKit brace style configuration option.
Summary:
Add brace style `BS_WebKit` as described on https://www.webkit.org/coding/coding-style.html:

* Function definitions: place each brace on its own line.
* Other braces: place the open brace on the line preceding the code block; place the close brace on its own line.

Set brace style used in `getWebKitStyle()` to the newly added `BS_WebKit`.

Reviewers: djasper, klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 244446
2015-08-10 13:43:19 +00:00
Richard Smith
86cc82906f [modules] Remove now-dead code for lazy loading of files specified by -fmodule-file=.
llvm-svn: 244417
2015-08-09 08:58:36 +00:00
Richard Smith
0f99d6a441 [modules] PR22534: Load files specified by -fmodule-file= eagerly. In particular, this avoids the need to re-parse module map files when using such a module.
llvm-svn: 244416
2015-08-09 08:48:41 +00:00
Richard Smith
2a6edb30d9 [modules] When building a dependency file, include module maps parsed in the
current compilation, not just those from imported modules.

llvm-svn: 244413
2015-08-09 04:46:57 +00:00
Richard Smith
2bb3c34ed4 [modules] When loading a template specialization, re-canonicalize its template
arguments because the reloaded form might have become non-canonical across the
serialization/deserialization step (this particularly happens when the
canonical form of the type involves an expression).

llvm-svn: 244409
2015-08-09 01:05:31 +00:00
Eric Christopher
e173314d39 Move the cpu validating virtual method down to the feature routines
where it belongs.

llvm-svn: 244342
2015-08-07 18:31:25 +00:00
Michael Wong
e710d5459e This patch commits OpenMP 4 target device clauses
This is committed on behalf of Kelvin Li
http://reviews.llvm.org/D11469?id=31227

llvm-svn: 244325
2015-08-07 16:16:36 +00:00
Richard Smith
ca3156ac77 [modules] Remove unused ModuleManager::visitDepthFirst function.
llvm-svn: 244289
2015-08-06 22:14:35 +00:00