Commit Graph

59665 Commits

Author SHA1 Message Date
Richard Smith 6dc8ae10aa [modules] When parsing the base specifiers of a parse-merged class, the current
context is the class itself but lookups should be performed starting with the
lookup parent of the class (class and base members don't shadow types from the
surrounding context because they have not been declared yet).

llvm-svn: 245236
2015-08-17 20:24:17 +00:00
Sean Silva 8b7c0398b6 [modules] PR20507: Avoid silent textual inclusion.
Summary:
If a module was unavailable (either a missing requirement on the module
being imported, or a missing file anywhere in the top-level module (and
not dominated by an unsatisfied `requires`)), we would silently treat
inclusions as textual. This would cause all manner of crazy and
confusing errors (and would also silently "work" sometimes, making the
problem difficult to track down).

I'm really not a fan of the `M->isAvailable(getLangOpts(), getTargetInfo(),
Requirement, MissingHeader)` function; it seems to do too many things at
once, but for now I've done things in a sort of awkward way.

The changes to test/Modules/Inputs/declare-use/module.map
were necessitated because the thing that was meant to be tested there
(introduced in r197805) was predicated on silently falling back to textual
inclusion, which we no longer do.

The changes to test/Modules/Inputs/macro-reexport/module.modulemap
are just an overlooked missing header that seems to have been missing since
this code was committed (r213922), which is now caught.

Reviewers: rsmith, benlangmuir, djasper

Subscribers: cfe-commits

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

llvm-svn: 245228
2015-08-17 16:39:30 +00:00
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
Yaron Keren e0e6e5e11e Enable passing test on Windows + MSYS.
llvm-svn: 245184
2015-08-16 19:02:49 +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
James Y Knight 2db38f33f3 Tiny cleanup: move some Triple variables up to the top of the
function, and remove a duplicate var.

llvm-svn: 245154
2015-08-15 03:45:25 +00:00
David Majnemer e888a2f655 [MS ABI] Switch catchpad/cleanuppad to use tokens
llvm-svn: 245153
2015-08-15 03:21:08 +00:00
NAKAMURA Takumi a0d39dd80a clangStaticAnalyzerCheckers: Update libdesp.
llvm-svn: 245145
2015-08-15 01:56:49 +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
Richard Smith 3938f0c728 [modules] Stop dropping 'module.timestamp' files into the current directory
when building with implicit modules disabled.

llvm-svn: 245136
2015-08-15 00:34:15 +00:00
Naomi Musgrave b9b46f5a58 clarified test comment
llvm-svn: 245124
2015-08-14 23:22:03 +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
Anna Zaks e5d74caf2a [analyzer] Add checkers for OS X / iOS localizability issues
Add checkers that detect code-level localizability issues for OS X / iOS:
  - A path sensitive checker that warns about uses of non-localized
    NSStrings passed to UI methods expecting localized strings.
  - A syntax checker that warns against not including a comment in
    NSLocalizedString macros.

A patch by Kulpreet Chilana!

(This is the second attempt with the compilation issue on Windows and
the random test failures resolved.)

llvm-svn: 245093
2015-08-14 20:22:22 +00:00
Martell Malone b8a3fe7a53 WindowsX86: long double is x87DoubleExtended on mingw
Summary:
    long double on x86 mingw is 80bits and is aligned to 16bytes

	Fixes:
    https://llvm.org/bugs/show_bug.cgi?id=24398

    Reviewers: rnk

    Subscribers: cfe-commits

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

llvm-svn: 245084
2015-08-14 19:05:56 +00:00
Reid Kleckner 397a17bfeb Don't run explicit-modules-missing-files.cpp on Windows
It is flaky due to inability to remove files with open handles.  We
could paper over it with rm -f, but then the file would still be
present.

This is more evidence to me that we should roll our own 'rm'
implementation in LLVM.

llvm-svn: 245083
2015-08-14 19:03:02 +00:00
Martell Malone 7ccda3c38b Windows ARM: ignore calling conventions as described on MSDN
Summary:
MSDN says that fastcall, stdcall, thiscall, and vectorcall are all
accepted but ignored on ARM and X64.
https://msdn.microsoft.com/en-us/library/984x0h58.aspx

MSDN also says cdecl is also accepted and typically ignored
This patch brings ARM in line with how we ignore them for X64

Reviewers: rnk

Subscribers: compnerd, cfe-commits

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

llvm-svn: 245076
2015-08-14 18:00:09 +00:00
Douglas Katzman cb07d15b4c Represent 2 parallel string arrays as one string[][2] array.
Differential Revision: http://reviews.llvm.org/D11991

llvm-svn: 245063
2015-08-14 15:52:12 +00:00
David Majnemer e694f3e847 [ASTContext] Call APValue destructors for MaterializedTemporaryValues
Hopefully this makes the sanitizer build bot happy.

llvm-svn: 245054
2015-08-14 14:43:50 +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
Daniel Jasper d788457da5 clang-format: Don't remove space between #elif and parentheses.
Before:
  #elif(AAAA && BBBB)

After:
  #elif (AAAA && BBBB)

llvm-svn: 245043
2015-08-14 12:44:06 +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
Richard Smith 34fa813d9b This test was still failing for me after r244925, fix it harder.
llvm-svn: 244991
2015-08-14 00:16:05 +00:00
David Blaikie 9255161665 Wdeprecated: ByrefHelpers are copy constructed by the ::buildByrefHelpers helper, make sure they're safely copyable
Make the copy/move ctors protected and defaulted in the base, make the
derived classes final to avoid exposing any slicing-prone APIs.

Also, while I'm here, simplify the use of buildByrefHelpers by taking
the parameter by value instead of non-const ref. None of the callers
care aobut observing the state after the call.

llvm-svn: 244990
2015-08-13 23:53:09 +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
Richard Smith f7b41371d9 [modules] When writing a module file built with -fmodule-map-file-home-is-cwd,
via a module map found by -fmodule-map-file=, the home directory of the module
is the current working directory, even if that's a different directory on
reload.

llvm-svn: 244988
2015-08-13 23:47:44 +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
Ivan Krasin 9cc0420211 Remove test cases, which rely on the default sanitizer blacklists.
Summary:
The default blacklists may vary across different architectures and
configurations. It was not wise to include into http://reviews.llvm.org/D11968

Reviewers: chapuni, pcc

Subscribers: cfe-commits, pcc

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

llvm-svn: 244985
2015-08-13 23:37:28 +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 2038b54eae Wdeprecated: Make the SecKeychainBugVisitor copyable (for the clone support in the CRTP base) my removing the user-declared dtor
The implicit dtor is just as good, and avoid suppressing implicit
copy/move ops.

llvm-svn: 244981
2015-08-13 23:09:18 +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 01cd46abae Wdeprecated: RegionBindingsRef are copy constructed, make sure that's safe by removing the unnecessary user-declared copy assignment operator
The user-defined copy assignment looks like it was working around the
presence of a reference member (that probably doesn't change in the copy
assignment cases present in the program). Rather than continuing this - just
change the reference to a pointer and let all the special members be
defined implicitly.

llvm-svn: 244974
2015-08-13 22:33:24 +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
NAKAMURA Takumi a137bf9386 clang/test/Frontend/dependency-gen.c: Add explicit -target x86_64-linux-gnu for -fsanitize.
llvm-svn: 244970
2015-08-13 22:17:34 +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
Brad Smith 56495d5b1f Removed one too many braces.
llvm-svn: 244962
2015-08-13 22:00:53 +00:00
Brad Smith 738591194f [SPARC] Fix types of size_t, intptr_t, and ptrdiff_t on OpenBSD.
llvm-svn: 244961
2015-08-13 21:45:57 +00:00
Eric Christopher b64963ecbc Fix some coding standard issues and delete a dead conditional.
llvm-svn: 244959
2015-08-13 21:34:35 +00:00
David Blaikie e438127b91 Wdeprecated: CommentVerifiers are returned by value, make sure they're correctly copy/moveable
llvm-svn: 244958
2015-08-13 21:24:08 +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
Naomi Musgrave e50cb9b9c8 Fix previous commit: poison only class members, simpler tests
Summary: Poisoning applied to only class members, and before dtors for base class invoked

Implement poisoning of only class members in dtor, as opposed to also
poisoning fields inherited from base classes. Members are poisoned
only once, by the last dtor for a class. Skip poisoning if class has
no fields.
Verify emitted code for derived class with virtual destructor sanitizes
its members only once.
Removed patch file containing extraneous changes.

Reviewers: eugenis, kcc

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


Simplified test cases for use-after-dtor

Summary: Simplified test cases to focus on one feature at time.
Tests updated to align with new emission order for sanitizing
callback.

Reviewers: eugenis, kcc

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

llvm-svn: 244933
2015-08-13 18:35:11 +00:00