Tom Stellard [Wed, 3 Sep 2014 15:24:29 +0000 (15:24 +0000)]
CGBuiltin: Use @llvm.fabs rather than fabs libcall when emitting builtins
Using the intrinsic allows the SelectionDAGBuilder to turn this call
into the FABS Node and also the intrinsic is something the vectorizer knows
how to vectorize.
This patch also sets the readnone attribute on this call, which should
enable additional optmizations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217042
91177308-0d34-0410-b5e6-
96231b3b80d8
Iain Sandoe [Wed, 3 Sep 2014 13:13:50 +0000 (13:13 +0000)]
Fix configure and make build of clang-interpreter.
Replaced 'jit' link component with 'mcjit'.
Updated the required libraries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217033
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Wed, 3 Sep 2014 12:08:14 +0000 (12:08 +0000)]
ASTMatchers: Add a matcher to detect whether a decl or stmt is inside a template instantiation.
This is hoisted from clang-tidy where it's used everywhere. The implementation
is not particularly efficient right now, but there is no easy fix for that.
Differential Revision: http://reviews.llvm.org/D5085
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217029
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Wed, 3 Sep 2014 11:06:10 +0000 (11:06 +0000)]
Parse: Replace polymorphic functor objects with lambdas and llvm::function_ref.
No change in functionality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217025
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Jasper [Wed, 3 Sep 2014 07:37:29 +0000 (07:37 +0000)]
clang-format: Add an option 'SpaceAfterCStyleCast'.
This permits to add a space after closing parenthesis of a C-style cast.
Defaults to false to preserve old behavior.
Fixes llvm.org/PR19982.
Before:
(int)i;
After:
(int) i;
Patch by Marek Kurdej.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217022
91177308-0d34-0410-b5e6-
96231b3b80d8
Ed Schouten [Wed, 3 Sep 2014 06:00:11 +0000 (06:00 +0000)]
Allow a scoped lockable object to acquire/release multiple locks.
Scoped lockable objects (mutex guards) are implemented as if it is a
lock itself that is acquired upon construction and unlocked upon
destruction. As it if course needs to be used to actually lock down
something else (a mutex), it keeps track of this knowledge through its
underlying mutex field in its FactEntry.
The problem with this approach is that this only allows us to lock down
a single mutex, so extend the code to use a vector of underlying
mutexes. This, however, makes the code a bit more complex than
necessary, so subclass FactEntry into LockableFactEntry and
ScopedLockableFactEntry and move all the logic that differs between
regular locks and scoped lockables into member functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217016
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Wed, 3 Sep 2014 02:33:22 +0000 (02:33 +0000)]
[modules] Use DeclContext::equals rather than == on DeclContext* when
determining whether a declaration is out of line, instead of assuming
that the semantic and lexical DeclContext will be the same declaration
whenever they're the same entity.
This fixes behavior of declarations within merged classes and enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217008
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 2 Sep 2014 22:35:49 +0000 (22:35 +0000)]
Reinstate "Update for llvm API change.""
This reinstates r215113.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216986
91177308-0d34-0410-b5e6-
96231b3b80d8
Eli Bendersky [Tue, 2 Sep 2014 22:00:06 +0000 (22:00 +0000)]
Fix up formatting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216976
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Tue, 2 Sep 2014 21:39:21 +0000 (21:39 +0000)]
Avoid test failure on platforms where size_t is long long (and thus can't be
directly written in strictly-conforming source code).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216969
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Tue, 2 Sep 2014 21:35:28 +0000 (21:35 +0000)]
Add --analyze to clang-cl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216964
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Tue, 2 Sep 2014 21:29:16 +0000 (21:29 +0000)]
Tests for DR550-572.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216953
91177308-0d34-0410-b5e6-
96231b3b80d8
Ed Schouten [Tue, 2 Sep 2014 20:59:13 +0000 (20:59 +0000)]
Use /usr/bin/env python instead of /usr/bin/python.
On operating systems like the BSDs, it is typically the case that
/usr/bin/python does not exist. We should therefore use /usr/bin/env
instead. This is also done in various other scripts in tools/.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216945
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Tue, 2 Sep 2014 19:37:08 +0000 (19:37 +0000)]
Don't indent inside a namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216937
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Trieu [Tue, 2 Sep 2014 19:32:44 +0000 (19:32 +0000)]
Don't allow lambdas to capture invalid decls during template instantiations.
Fixes PR20731.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216936
91177308-0d34-0410-b5e6-
96231b3b80d8
Yunzhong Gao [Tue, 2 Sep 2014 19:24:14 +0000 (19:24 +0000)]
Fixing a typo in the documented __builtin_convertvector example.
"vf[0]" ==> "vs[0]"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216935
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Tue, 2 Sep 2014 18:13:58 +0000 (18:13 +0000)]
Fix for LLVM API change to SpecialCaseList::create
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216926
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 1 Sep 2014 22:29:32 +0000 (22:29 +0000)]
Test cleanup: move CHECK close to code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216892
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 1 Sep 2014 18:50:05 +0000 (18:50 +0000)]
Frontend: Reindent Opts.CoverageFile
No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216888
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 1 Sep 2014 18:50:02 +0000 (18:50 +0000)]
MS ABI: Reindent MicrosoftCXXABI::GetVirtualBaseClassOffset
No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216887
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexander Potapenko [Mon, 1 Sep 2014 12:35:57 +0000 (12:35 +0000)]
Typo fix, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216876
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Sun, 31 Aug 2014 12:21:50 +0000 (12:21 +0000)]
clang/test/CXX/drs/dr5xx.cpp: Suppress dr547 for targeting MSVC x86 for now, due to incompatibility of attribute(thiscall).
With targeting i686-win32,
error: 'error' diagnostics seen but not expected:
File clang/test/CXX/drs/dr5xx.cpp Line 521: implicit instantiation of undefined template 'dr547::X<void () __attribute__((thiscall)) const>'
File clang/test/CXX/drs/dr5xx.cpp Line 518: implicit instantiation of undefined template 'dr547::X<void () __attribute__((thiscall)) const>'
File clang/test/CXX/drs/dr5xx.cpp Line 518: implicit instantiation of undefined template 'dr547::X<void () __attribute__((thiscall)) const>'
error: 'note' diagnostics seen but not expected:
File clang/test/CXX/drs/dr5xx.cpp Line 516: template is declared here
File clang/test/CXX/drs/dr5xx.cpp Line 521: in instantiation of function template specialization 'dr547::f<void () __attribute__((thiscall)) const, dr547::S>' requested here
File clang/test/CXX/drs/dr5xx.cpp Line 516: template is declared here
File clang/test/CXX/drs/dr5xx.cpp Line 516: template is declared here
7 errors generated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216841
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Sun, 31 Aug 2014 04:18:54 +0000 (04:18 +0000)]
cxx_status: we did support some of C++14 in Clang 3.3.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216837
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Sun, 31 Aug 2014 04:17:48 +0000 (04:17 +0000)]
cxx_status: the name C++14 isn't provisional any more.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216836
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Sun, 31 Aug 2014 03:06:20 +0000 (03:06 +0000)]
Tests for DR525-550.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216834
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Sun, 31 Aug 2014 00:27:00 +0000 (00:27 +0000)]
clang/test/CodeGenCXX/debug-info-access.cpp: Use %itanium_abi_triple to appease msvc. "[def] [free]" can be seen in different order.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216829
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 30 Aug 2014 16:55:52 +0000 (16:55 +0000)]
Fix some cases where StringRef was being passed by const reference. Remove const from some other StringRefs since its implicitly const already.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216825
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 30 Aug 2014 16:55:39 +0000 (16:55 +0000)]
Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216824
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Sat, 30 Aug 2014 00:15:37 +0000 (00:15 +0000)]
Cleanup test.
This should make it easier to add more tests to this file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216807
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Sat, 30 Aug 2014 00:04:23 +0000 (00:04 +0000)]
[modules] Fix deserialization cycle when loading a tag declaration with a typedef name for linkage purposes. When loading the type, delay loading its typedef until we've finished loading and merging the type. In its place, save out the name of the typedef, which we need for merging purposes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216806
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 29 Aug 2014 23:45:52 +0000 (23:45 +0000)]
Cleanup the test a bit. It was too dependent on the output order.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216802
91177308-0d34-0410-b5e6-
96231b3b80d8
Adrian Prantl [Fri, 29 Aug 2014 22:44:27 +0000 (22:44 +0000)]
Debug info: Only emit C++ accessibility specifiers when they are diverging
from the default for the containing type.
rdar://problem/
18154959
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216800
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Fri, 29 Aug 2014 22:33:38 +0000 (22:33 +0000)]
Add some missing test coverage for merging 'extern "C"' functions with modules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216796
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 29 Aug 2014 22:06:20 +0000 (22:06 +0000)]
Fix my broken test cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216791
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 22:04:45 +0000 (22:04 +0000)]
unique_ptrify PTHManager's PerIDCache using the newly added llvm::FreeDeleter
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216786
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 22:04:40 +0000 (22:04 +0000)]
unique_ptrify some parameters to PTHManager::PTHManager
A couple of these arguments were passed by void* as a rather extreme
example of pimpling. Adjusting this to a more classic form of the idiom
(involving forward declarations) makes this more legible and allows
explicit passing of ownership via std::unique_ptr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216785
91177308-0d34-0410-b5e6-
96231b3b80d8
Anna Zaks [Fri, 29 Aug 2014 21:51:22 +0000 (21:51 +0000)]
Fixup for r216763. Add a driver test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216783
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 29 Aug 2014 21:43:29 +0000 (21:43 +0000)]
Make all virtual member pointers use variadic musttail calls
This avoids encoding information about the function prototype into the
thunk at the cost of some function prototype bitcast gymnastics.
Fixes PR20653.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216782
91177308-0d34-0410-b5e6-
96231b3b80d8
Larisse Voufo [Fri, 29 Aug 2014 21:08:16 +0000 (21:08 +0000)]
Fix for PR20660, where unexpanded parameter pack in function parameter clause causes clang to crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216778
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Fri, 29 Aug 2014 21:05:44 +0000 (21:05 +0000)]
Add a comment, no functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216777
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Fri, 29 Aug 2014 20:29:31 +0000 (20:29 +0000)]
Objective-C [qoi]. If property is going to be implemented
in the super class, do not issue the warning about property
in current class's protocol will not be auto synthesized.
// rdar://
18179833
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216769
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 20:17:13 +0000 (20:17 +0000)]
unique_ptrify the raw_ostream argument to clang::serialized_diags::create
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216767
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 20:11:03 +0000 (20:11 +0000)]
unique_ptrify clang::ento::createCheckerManager
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216765
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 20:06:10 +0000 (20:06 +0000)]
unique_ptrify PathDiagnosticConsumer::HandlePathDiagnostic
FoldingSet, another intrusive data structure that could use some
unique_ptr love on its interfaces. Eventually.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216764
91177308-0d34-0410-b5e6-
96231b3b80d8
Anna Zaks [Fri, 29 Aug 2014 20:01:38 +0000 (20:01 +0000)]
Add an option to silence all analyzer warnings.
People have been incorrectly using "-analyzer-disable-checker" to
silence analyzer warnings on a file, when analyzing a project. Add
the "-analyzer-disable-all-checks" option, which would allow the
suppression and suggest it as part of the error message for
"-analyzer-disable-checker". The idea here is to compose this with
"--analyze" so that users can selectively opt out specific files from
static analysis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216763
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 19:57:52 +0000 (19:57 +0000)]
unique_ptrify thep passing of BugReports to BugReportEquivClass
I suspect llvm::ilist should take elements by unique_ptr, since it does
take ownership of the element (by stitching it into the linked list) -
one day.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216761
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 19:51:32 +0000 (19:51 +0000)]
unique_ptrify HeaderMap::FileBuffer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216758
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 19:36:52 +0000 (19:36 +0000)]
unique_ptrify Preprocessor's TokenLexerCache
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216756
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 18:53:26 +0000 (18:53 +0000)]
unique_ptrify the result of CFG::buildCFG/CFGBuilder::buildCFG
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216755
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 18:43:24 +0000 (18:43 +0000)]
unique_ptrify the diagnostics in CXDiagnosticSetImpl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216754
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Fri, 29 Aug 2014 18:31:16 +0000 (18:31 +0000)]
Objective-C. Tweak diagnosing properties that are not auto-synthesized.
Do not warn when property declared in class's protocol will be auto-synthesized
by its uper class implementation because super class has also declared this
property while this class has not. Continue to warn if current class
has declared the property also (because this declaration will not result
in a 2nd synthesis).
rdar://
18152478
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216753
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 18:18:47 +0000 (18:18 +0000)]
unique_ptrify PathDiagnostic::setEndOfPath's argument
Again, if shared ownership is the right model here (I assume it is,
given graph algorithms & such) this could be tidied up (the 'release'
call removed in favor of something safer) by having
IntrunsiveRefCntPointer constructible from a unique_ptr.
(& honestly I'd probably favor taking a page out of shared_ptr's book,
allowing implicit construction from a unique_ptr rvalue, and only allow
explicit from a raw pointer - currently IntrusiveRefCntPointer can
implicitly own from a raw pointer, which seems unsafe)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216752
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 18:18:43 +0000 (18:18 +0000)]
unique_ptr-ify PathDiagnosticPiece ownership
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216751
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Fri, 29 Aug 2014 17:36:11 +0000 (17:36 +0000)]
Check in a test case for the problem with late-dropped dllimport (PR20803)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216749
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 17:02:26 +0000 (17:02 +0000)]
One other BuryPointer of a unique_ptr cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216743
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 16:53:14 +0000 (16:53 +0000)]
Provide a BuryPointer for unique_ptrs.
In theory, it'd be nice if we could move to a case where all buried
pointers were buried via unique_ptr to demonstrate that the program had
finished with the value (that we could really have cleanly deallocated
it) but instead chose to bury it.
I think the main reason that's not possible right now is the various
IntrusiveRefCntPtrs in the Frontend, sharing ownership for a variety of
compiler bits (see the various similar
"CompilerInstance::releaseAndLeak*" functions). I have yet to figure out
their correct ownership semantics - but perhaps, even if the
intrusiveness can be removed, the shared ownership may yet remain and
that would lead to a non-unique burying as is there today. (though we
could model that a little better - by passing in a shared_ptr, etc -
rather than needing the two step that's currently used in those other
releaseAndLeak* functions)
This might be a bit more robust if BuryPointer took the boolean:
BuryPointer(bool, unique_ptr<T>)
and the choice to bury was made internally - that way, even when
DisableFree was not set, the unique_ptr would still be null in the
caller and there'd be no chance of accidentally having a different
codepath where the value is used after burial in !DisableFree, but it
becomes null only in DisableFree, etc...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216742
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 16:30:23 +0000 (16:30 +0000)]
unique_ptrify Directives in VerifyDiagnosticConsumer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216740
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Jasper [Fri, 29 Aug 2014 12:54:38 +0000 (12:54 +0000)]
clang-format: Fix unary operator detection in corner case.
Before:
decltype(* ::std::declval<const T &>()) void F();
After:
decltype(*::std::declval<const T &>()) void F();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216724
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 29 Aug 2014 11:22:47 +0000 (11:22 +0000)]
ASTMatchers: Replace some copies of the bound nodes tree builder with moves.
But don't move if all we do is clearing the thing. The move method is too large
to be inlined and performs a ton of unnecessary checking when the RHS is empty.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216723
91177308-0d34-0410-b5e6-
96231b3b80d8
James Molloy [Fri, 29 Aug 2014 10:17:52 +0000 (10:17 +0000)]
Use store size instead of alloc size when coercing.
Previously, EnterStructPointerForCoercedAccess used Alloc size when determining how to convert. This was problematic, because there were situations were the alloc size was larger than the store size. For example, if the first element of a structure were i24 and the destination type were i32, the old code would generate a GEP and a load i24. The code should compare store sizes to ensure the whole object is loaded. I have attached a test case.
This patch modifies the output of arm64-be-bitfield.c test case, but the new IR seems to be equivalent, and after -O3, the compiler generates identical ARM assembly. (asr x0, x0, #54)
Patch by Thomas Jablin!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216722
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 07:59:55 +0000 (07:59 +0000)]
unique_ptrify SourceManager::createFileID
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216715
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Fri, 29 Aug 2014 07:27:49 +0000 (07:27 +0000)]
CodeGen: Don't completely mess-up optimized atomic libcalls
Summary:
We did a great job getting this wrong:
- We messed up which LLVM IR types to use for arguments and return values.
The optimized libcalls use integer types for values.
Clang attempted to use the IR type which corresponds to the value
passed in instead of using an appropriately sized integer type. This
would result in violations of the ABI for, as an example, floating
point types.
- We didn't bother recording the result of the atomic libcall in the
destination memory.
Instead, call the functions with arguments matching the type of the
libcall prototype's parameters.
This fixes PR20780.
Differential Revision: http://reviews.llvm.org/D5098
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216714
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 07:25:23 +0000 (07:25 +0000)]
unique_ptrify Driver Action handling
It hits a limit when we reach ActionList, which is used for dynamic
conditional ownership, so we lose type safety there.
This did expose at least one caller "lying" about ownership (passing
ownership to an Action, then updating the Action to specify that it
doesn't actually own the thing that was passed) - changing this to
unique_ptr just makes that oddity more obvious.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216713
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 06:34:53 +0000 (06:34 +0000)]
Improve unique_ptr-y ownership in ASTUnit::ComputePreamble
Rather than having a pair of pairs and a reference out parameter, build
a structure with everything together and named. A raw pointer and a
unique_ptr, rather than a raw pointer and a boolean, are used to
communicate ownership transfer.
It's possible one day we'll end up with a conditional pointer (probably
represented by a raw pointer and a boolean) abstraction to use in places
like this. Conditional ownership seems to be coming up more often than
I'd hoped...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216712
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 29 Aug 2014 06:05:01 +0000 (06:05 +0000)]
Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216710
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 29 Aug 2014 05:08:19 +0000 (05:08 +0000)]
unique_ptrify clang::BackendConsumer::takeModule
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216707
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Fri, 29 Aug 2014 01:01:32 +0000 (01:01 +0000)]
call __asan_load_cxx_array_cookie when loading array cookie in asan mode.
Summary:
The current implementation of asan cookie is incorrect:
we add nosanitize metadata to the cookie load, but the metadata may be lost
and we will instrument the load from poisoned memory.
This change replaces the load with a call to __asan_load_cxx_array_cookie (r216692)
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5111
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216702
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Fri, 29 Aug 2014 00:50:36 +0000 (00:50 +0000)]
Introduce -DLLVM_USE_SANITIZER=Undefined CMake option to build UBSan-ified version of LLVM/Clang.
I've fixed most of the simple bugs and currently "check-llvm" test suite
has 26 failures, and "check-clang" suite has 5 failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216701
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Fri, 29 Aug 2014 00:16:06 +0000 (00:16 +0000)]
Better codegen support for DLL attributes being dropped after the first declaration (PR20792)
For the following code:
__declspec(dllimport) int f(int x);
int user(int x) {
return f(x);
}
int f(int x) { return 1; }
Clang will drop the dllimport attribute in the AST, but CodeGen would have
already put it on the LLVM::Function, and that would never get updated.
(The same thing happens for global variables.)
This makes Clang check dropped DLL attribute case each time the LLVM object
is referenced.
This isn't perfect, because we will still get it wrong if the function is
never referenced by codegen after the attribute is dropped, but this handles
the common cases and makes us not fail in the verifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216699
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 28 Aug 2014 23:51:01 +0000 (23:51 +0000)]
Don't create a null reference in ASTUnit::LoadFromCommandLine.
This change is the last in the pack of five commits
(also see r216691, r216694, r216695, and r216696) that reduces the number
of test failures in "check-clang" invocation in UBSan bootstrap
from 2443 down to 5.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216697
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 28 Aug 2014 23:34:32 +0000 (23:34 +0000)]
Don't load invalid enum value in Sema::LazilyCreateBuiltin.
This bug was reported by UBSan.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216696
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 28 Aug 2014 23:17:55 +0000 (23:17 +0000)]
Don't load ill-formed AmbiguityKind in Sema::Lookup.
This bug was reported by UBSan.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216695
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 28 Aug 2014 22:59:39 +0000 (22:59 +0000)]
Properly align inline space for ImplicitConversionSequences in OverloadSet.
This bug was reported by UBSan.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216694
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 28 Aug 2014 22:18:42 +0000 (22:18 +0000)]
Don't create a null reference to NestedNameSpecifier.
This bug was reported by UBSan.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216691
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 28 Aug 2014 21:23:05 +0000 (21:23 +0000)]
Call powerpc-darwin external tools with -arch ppc.
With this patch we call external tools for powerpc-darwin with "-arch ppc"
instead of "-arch powerpc", so as to be compatible with the cctools assembler
and ld64 linker.
Patch by Stephen Drake!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216687
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 28 Aug 2014 21:09:23 +0000 (21:09 +0000)]
Oops, use correct RUN: line for test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216685
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 28 Aug 2014 20:14:15 +0000 (20:14 +0000)]
[modules] PR20786: add (already passing) regression test from the bug report.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216683
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Thu, 28 Aug 2014 17:24:14 +0000 (17:24 +0000)]
Reverting r216675. This breaks some bots. Before this can be committed again, I have to explore runtime ABI requirements with libc++abi.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216677
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Thu, 28 Aug 2014 17:05:17 +0000 (17:05 +0000)]
Objective-C IRGen. Fixes an assertion crash caused by inconsistent
linkage related to generation of OBJC_SELECTOR_REFERENCES symbol
needed in generation of call to 'super' in a class method.
// rdar://
18150301
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216676
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Thu, 28 Aug 2014 16:48:44 +0000 (16:48 +0000)]
Throw a std::bad_array_new_length exception when the expression (or constant-expression) passed to operator new[] results in overflow in conformance with [expr.new]p7. Fixes PR11644.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216675
91177308-0d34-0410-b5e6-
96231b3b80d8
Samuel Benzaquen [Thu, 28 Aug 2014 15:49:06 +0000 (15:49 +0000)]
Cache the memoization data for DynTypedNodes.
Summary:
Cache the memoization data for DynTypedNodes.
It is free to do so on create(), but expensive to determine dynamically.
Reviewers: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5101
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216671
91177308-0d34-0410-b5e6-
96231b3b80d8
Yi Kong [Thu, 28 Aug 2014 15:25:52 +0000 (15:25 +0000)]
arm_acle: Fix error in ROR implementation
The logic in calculating the rotate amount was flawed.
Thanks Pasi Parviainen for pointing out!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216669
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Thu, 28 Aug 2014 12:42:28 +0000 (12:42 +0000)]
[CMake] clangStaticAnalyzerFrontend: Add clangLex, corresponding to r216550.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216664
91177308-0d34-0410-b5e6-
96231b3b80d8
Oliver Stannard [Thu, 28 Aug 2014 12:15:49 +0000 (12:15 +0000)]
[ARM] Change default ABI for AArch32 to be "aapcs" (was "apcs-gnu")
The current default abi when no environment is given is "apcs-gnu",
which is obsolete. This patch changes the default to "aapcs". "aapcs" has both
hard- and soft-float variants, so the -mhard-float, -msoft-float and
-mfloat-abi= options now all behave as expected when no environment is
specified in the triple.
While writing this I also noticed that a preprocessor test claims to be
checking darwin, but is actually checking the defaults, which are
different for darwin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216662
91177308-0d34-0410-b5e6-
96231b3b80d8
Yi Kong [Thu, 28 Aug 2014 09:44:07 +0000 (09:44 +0000)]
arm_acle: Implement data processing intrinsics
Summary:
ACLE 2.0 section 9.2 defines the following "miscellaneous data processing intrinsics": `__clz`, `__cls`, `__ror`, `__rev`, `__rev16`, `__revsh` and `__rbit`.
`__clz` has already been implemented in the arm_acle.h header file. The rest are not supported yet. This patch completes ACLE data processing intrinsics.
Reviewers: t.p.northover, rengolin
Reviewed By: rengolin
Subscribers: aemerson, mroth, llvm-commits
Differential Revision: http://reviews.llvm.org/D4983
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216658
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Thu, 28 Aug 2014 06:37:56 +0000 (06:37 +0000)]
Fixed test compatibility with MSVC codegen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216655
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 28 Aug 2014 05:44:07 +0000 (05:44 +0000)]
[modules] When completing the redecl chain for an anonymous declaration in a
merged context, pull in the lexical decls in that context, since one of them
may complete the redecl chain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216652
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Thu, 28 Aug 2014 04:28:19 +0000 (04:28 +0000)]
[C++11] Support for capturing of variable length arrays in lambda expression.
Differential Revision: http://reviews.llvm.org/D4368
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216649
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Trieu [Thu, 28 Aug 2014 03:23:47 +0000 (03:23 +0000)]
During cross field uninitialized checking, when processing an assignment,
don't mark the field as initialized until the next initializer instead of
instantly. Since this checker is AST based, statements are processed in tree
order instead of following code flow. This can result in different warnings
from just reordering the code. Also changed to use one checker per constructor
instead of creating a new checker per field.
class T {
int x, y;
// Already warns
T(bool b) : x(!b ? (1 + y) : (y = 5)) {}
// New warning added here, previously (1 + y) comes after (y = 5) in the AST
// preventing the warning.
T(bool b) : x(b ? (y = 5) : (1 + y)) {}
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216641
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 28 Aug 2014 01:33:39 +0000 (01:33 +0000)]
[modules] Number anonymous declarations that are lexically within mergeable
contexts, so that we can merge them when we merge the surrounding context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216639
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 28 Aug 2014 00:53:20 +0000 (00:53 +0000)]
Properly handle multiple nonnull attributes in CodeGen
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216638
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 28 Aug 2014 00:22:11 +0000 (00:22 +0000)]
Kill one of EmitCallArgs overloads. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216635
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Wed, 27 Aug 2014 23:11:59 +0000 (23:11 +0000)]
[modules] Add an assert that we properly manage the IsCompleteDefinition flag
on CXXRecordDecls when merging definitions, and make it pass by not trying to
save and restore this flag across AST serialization/deserialization. For
CXXRecordDecls, we have a separate mechanism to manage this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216633
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Wed, 27 Aug 2014 22:31:34 +0000 (22:31 +0000)]
PR20769: Fix confusion when checking whether a prior default argument was in
scope when checking for conflicts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216628
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Trieu [Wed, 27 Aug 2014 22:15:10 +0000 (22:15 +0000)]
More -Wuninitialized updates
Fix r216438 to catch more complicated self-initialized in std::move. For
instance, "Foo f = std::move(cond ? OtherFoo : (UNUSED_VALUE, f));"
Make sure that BinaryConditionalOperator, ConditionalOperator, BinaryOperator
with comma operator, and OpaqueValueExpr perform the correct usage forwarding
across the three uninitialized value checkers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216627
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexander Kornienko [Wed, 27 Aug 2014 21:36:39 +0000 (21:36 +0000)]
Query CompilationDatabase right before running each compilation.
Summary:
Query CompilationDatabase right before running each compilation. This allows
supporting compilation databases that change external state required for
successful compilation.
Reviewers: klimek, djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D5086
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216620
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Wed, 27 Aug 2014 21:27:40 +0000 (21:27 +0000)]
Allow adding dll attributes on certain redecls with a warning if the decl hasn't been used yet (PR20746)
This shouldn't really be allowed, but it comes up in real code (see PR). As
long as the decl hasn't been used there's no technical difficulty in supporting
it, so downgrade the error to a warning.
Differential Revision: http://reviews.llvm.org/D5087
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216619
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Wed, 27 Aug 2014 20:54:45 +0000 (20:54 +0000)]
Overload SourceManager::overrideFileContents so that unconditionally passing ownership is explicitly done using unique_ptr.
Only those callers who are dynamically passing ownership should need the
3 argument form. Those accepting the default ("do pass ownership")
should do so explicitly with a unique_ptr now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216614
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Wed, 27 Aug 2014 20:34:29 +0000 (20:34 +0000)]
Objective-C. Change to method lookup rules to look
into primary class's named categories before looking
into their protocols. This is because categories are
part of the public interface and , just as primary class,
preference should be given to them before class
(and category) protocols. // rdar://
18013929
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216610
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Wed, 27 Aug 2014 20:03:29 +0000 (20:03 +0000)]
Update for LLVM api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216585
91177308-0d34-0410-b5e6-
96231b3b80d8