Commit Graph

38747 Commits

Author SHA1 Message Date
David Majnemer bda8632f9b Parse: Handle __declspec in a lambda definition
llvm-svn: 228121
2015-02-04 08:22:46 +00:00
David Majnemer 631a90b6bc Sema: Add support for __declspec(restrict)
__declspec(restrict) and __attribute(malloc) are both handled
identically by clang: they are allowed to the noalias LLVM attribute.

Seeing as how noalias models the C99 notion of 'restrict', rename the
internal clang attribute to Restrict from Malloc.

llvm-svn: 228120
2015-02-04 07:23:21 +00:00
Sameer Sahasrabuddhe e8d2aaf320 OpenCL: handle ternary operator when the condition is a vector
When the condition is a vector, OpenCL specifies additional
requirements on the operand types, and also the operations
required to determine the result type of the operator. This is a
combination of OpenCL v1.1 s6.3.i and s6.11.6, and the semantics
remain unchanged in later versions of OpenCL.

llvm-svn: 228118
2015-02-04 06:38:18 +00:00
Alexey Bataev 8f01bb983c [MSVC2012] Allow 'mutable' references
Some standard header files from MSVC2012 use 'mutable' on references, though it is directly prohibited by the standard.
Fix for http://llvm.org/PR22444
Differential Revision: http://reviews.llvm.org/D7370

llvm-svn: 228113
2015-02-04 04:45:32 +00:00
Larisse Voufo 404e142ed7 Generalize r228066 to give all implicit global allocation functions default visibility.
llvm-svn: 228107
2015-02-04 02:34:32 +00:00
Richard Smith 7483d20e77 [modules] If we already have a fake definition for one declaration of a class,
don't think we're providing a new one in an update record adding a definition
to another declaration of the same class.

llvm-svn: 228104
2015-02-04 01:23:46 +00:00
Akira Hatanaka 96a36017f7 [inlineasm] Fix an incorrect warning about register constraint and modifier.
Previously, when the following piece of code was compiled, clang would
incorrectly warn that the size of "wide_two" does not match register size
specified by the constraint and modifier":

long wide_two = two;
asm ("%w0 %1" : "+r" (one), "+r"(wide_two));

This was caused by a miscalculation of ConstraintIdx in Sema::ActOnGCCAsmStmt.

This commit fixes PR21270 and rdar://problem/18668354.

llvm-svn: 228089
2015-02-04 00:27:13 +00:00
David Majnemer 1cf22e690d Headers: Don't use attribute keywords which aren't reserved
Instead of using 'unavailable', use '__unavailable__'

llvm-svn: 228087
2015-02-04 00:26:10 +00:00
Justin Bogner fd34280b8e InstrProf: Update for LLVM API change
Update for the API change in r228075

llvm-svn: 228076
2015-02-03 23:59:48 +00:00
Larisse Voufo fce61d3fc8 PR22419: Give implicit sized deallocation functions default visibility
llvm-svn: 228066
2015-02-03 23:31:50 +00:00
Nico Weber f3e46ad485 Wrap to 80 columns. No behavior change.
llvm-svn: 228063
2015-02-03 23:10:18 +00:00
David Majnemer fd1e739a44 CodeGen: Copy-ctorm must obey the destination's alignment requirement
We would synthesize memcpy intrinsics when emitting calls to trivial C++
constructors but we wouldn't take into account the alignment of the
destination.

llvm-svn: 228061
2015-02-03 23:04:06 +00:00
Reid Kleckner 11ca834bef SEH: Track users of __try so we can pick a per-func EH personality
There are four major kinds of declarations that cause code generation:
- FunctionDecl (includes CXXMethodDecl etc)
- ObjCMethodDecl
- BlockDecl
- CapturedDecl

This patch tracks __try usage on FunctionDecls and diagnoses __try usage
in other decls. If someone wants to use __try from ObjC, they can use it
from a free function, since the ObjC code will need an ObjC-style EH
personality.

Eventually we will want to look through CapturedDecls and track SEH
usage on the parent FunctionDecl, if present.

llvm-svn: 228058
2015-02-03 22:52:35 +00:00
David Blaikie 14177b748a DebugInfo: Ensure calls to functions with default arguments which themselves have default arguments, still have locations.
To handle default arguments in C++ in the debug info, we disable code
updating the debug location during the emission of default arguments.

This code was buggy in the case of default arguments which, themselves,
have default arguments - the inner default argument would re-enable
debug info when it was finished, but before the outer default argument
was finished.

This was already a bug, but got worse (because a crasher instead of just
a quality bug) with the recent improvements to debug info line quality
because... The ApplyDebugLocation scoped device would find the debug
info disabled and not save any debug location. But then in
~ApplyDebugLocation it would find the debug info had been enabled and
would then apply the no-location. Then the outer function call would be
emitted without any location. That's bad.

Arguably we could /also/ fix the ApplyDebugLocation to assert on this
situation (where debug info was disabled in the ctor and enabled in the
dtor, or the other way around) but this is at least the necessary fix
regardless.

(also, I imagine this disabling behavior might need to be in-place for
CGExprComplex and CGExprAgg too, maybe... ?)

And I seem to recall seeing some weird default arg stepping behavior
recently which might be related to this too... I'll have to look into
it.

llvm-svn: 228053
2015-02-03 22:37:17 +00:00
Weiming Zhao 71ac240620 Diagnose CXX 'this' pointer reference in funcs with naked attr
Clang asserts for this pointer reference in asms of naked functions.
This patch diagnoses if this pointer reference is used.

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

llvm-svn: 228052
2015-02-03 22:35:58 +00:00
DeLesley Hutchins ab1dc2d54d Thread Safety Analysis: add support for before/after annotations on mutexes.
These checks detect potential deadlocks caused by inconsistent lock
ordering.  The checks are implemented under the -Wthread-safety-beta flag.

This patch also replaces calls to getAttrs() with calls to attrs() throughout
ThreadSafety.cpp, which fixes the earlier issue that cause assert failures.

llvm-svn: 228051
2015-02-03 22:11:04 +00:00
Justin Bogner 4da909b2b2 InstrProf: Remove CoverageMapping::HasCodeBefore, it isn't used
llvm-svn: 228035
2015-02-03 21:35:49 +00:00
Duncan P. N. Exon Smith f796a1ded0 CodeGen: Update for LLVM API change in r228030
The mock tags are no longer in `dwarf::LLVMConstants`; they're in
`dwarf::Tag`.

llvm-svn: 228032
2015-02-03 21:25:34 +00:00
Adrian Prantl 95b24e9b59 Address review feedback for r228003.
- use named constructors
- get rid of MarkAsPrologue

llvm-svn: 228021
2015-02-03 20:00:54 +00:00
Reid Kleckner 6c5e36ae3b Revert "Thread Safety Analysis: add support for before/after annotations on mutexes."
This reverts r227997, as well as r228009. It does not pass check-clang
for me locally on Linux.

llvm-svn: 228020
2015-02-03 19:51:16 +00:00
Ben Langmuir 3b7b540680 Make the default module cache user-specific
Appends the username to the first component (after the temp dir) of the
module cache path.  If the username contains a character that shouldn't
go into a path (for now conservatively allow [a-zA-Z0-9_]), we fallback
to the user id.

llvm-svn: 228013
2015-02-03 19:28:37 +00:00
Reid Kleckner e675575d1b thread safety: Add move ctor to BeforeInfo to fix MSVC build
MSVC cannot infer move ctors yet.

llvm-svn: 228009
2015-02-03 19:04:26 +00:00
Adrian Prantl 39428e74a0 Merge ArtificialLocation into ApplyDebugLocation and make a clear
distinction between the different use-cases. With the previous default
behavior we would occasionally emit empty debug locations in situations
where they actually were strictly required (= on invoke insns).
We now have a choice between defaulting to an empty location or an
artificial location.

Specifically, this fixes a bug caused by a missing debug location when
emitting C++ EH cleanup blocks from within an artificial function, such as
an ObjC destroy helper function.

rdar://problem/19670595

llvm-svn: 228003
2015-02-03 18:40:42 +00:00
Adrian Prantl 6693d0839a Add documentation to ApplyDebugLocation.
llvm-svn: 228002
2015-02-03 18:40:38 +00:00
DeLesley Hutchins 4980df623f Thread Safety Analysis: add support for before/after annotations on mutexes.
These checks detect potential deadlocks caused by inconsistent lock
ordering.  The checks are implemented under the -Wthread-safety-beta flag.

llvm-svn: 227997
2015-02-03 18:17:48 +00:00
Nico Weber b14f872269 Implement jump scope SEHmantic analysis.
Thou shall not jump into SEH blocks. Jumping out of SEH __try and __excepts
is A-ok. Jumping out of __finally blocks is B-ok (msvc doesn't error about it,
but warns that it has undefined behavior).

I've checked that clang's behavior with this patch matches msvc's behavior.
We don't have the warning on jumping out of a __finally yet, see the FIXME
in the test. clang also currently crashes on codegen for a jump out of a
__finally block, see PR22414 comment 7.

I also added a few tests for the interaction of indirect jumps and SEH blocks.
MSVC doesn't support indirect jumps, so there's no way to know if clang behave
the same way as msvc here.  clang's behavior with this patch does make sense
to me, but maybe it could be argued that it should be more permissive (see
FIXME in the indirect jump tests -- shout if you have an opinion on this).

llvm-svn: 227982
2015-02-03 17:06:08 +00:00
Rafael Espindola 3e34e6546e Use CLANG_LIBDIR_SUFFIX when looking for the gold plugin.
Patch by İsmail Dönmez!

llvm-svn: 227979
2015-02-03 16:33:53 +00:00
David Majnemer e1a0b2e2af MS ABI: Records with fields with required aligmnet shouldn't be common
llvm-svn: 227954
2015-02-03 08:49:32 +00:00
David Majnemer 5821ff78ef AST: Hoist RT->getDecl() into a variable
llvm-svn: 227953
2015-02-03 08:49:29 +00:00
David Majnemer 7d82131abe MS ABI: Records with required alignment can't have common linkage
This fixes PR22441.

llvm-svn: 227950
2015-02-03 07:35:55 +00:00
Richard Smith 2a9e5c57ef [modules] Be sure to load the lexical definition of a class template
specialization from an update record exactly once, even if we needed to fake up
the definition.

llvm-svn: 227939
2015-02-03 03:32:14 +00:00
Justin Bogner a432d176b5 InstrProf: Update for LLVM API change
Update for the change in r227900.

llvm-svn: 227901
2015-02-03 00:20:24 +00:00
Reid Kleckner 68eb60b8c4 PR 17421: Implemented -save-temps={obj|cwd} option
-save-temps=cwd is equivalent to -save-temps
-save-temps=obj saves temporary file in the same directory as output

This helps to avoid clobbering of temp files in case of parallel
compilation with -save-temps of the files that have the same name
but located in different directories.

Patch by Artem Belevich

Reviewed By: rnk

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

llvm-svn: 227886
2015-02-02 22:41:48 +00:00
Reid Kleckner e71759103e SEH: Diagnose use of C++ EH and SEH in the same function
This check does not apply when Borland extensions are enabled, as they
have a checked in test case indicating that mixed usage of SEH and C++
is supported.

llvm-svn: 227876
2015-02-02 22:15:31 +00:00
Ben Langmuir 532d2104ce Add cc1 option '-fmodule-feature' to add custom values for 'requires' decls
This allows clang-based tools to specify custom features that can be
tested by the 'requires' declaration in a module map file.

llvm-svn: 227868
2015-02-02 21:56:15 +00:00
Justin Holewinski f37f3d35eb When generating llvm.used, we may need an addrspacecast instead of a bitcast.
Summary:
This is especially important for targets that use multiple address spaces,
and commonly place global variables in address spaces other than zero.

Fixes PR22383

Test Plan: New test case added: llvm-used.cu

Reviewers: jingyue

Subscribers: llvm-commits

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

llvm-svn: 227861
2015-02-02 21:05:49 +00:00
David Majnemer 8ab003a0db The prefix 'Ms-' should be 'MS-'
Clang is otherwise consistent that Microsoft be abbreviated as MS, not
Ms.

llvm-svn: 227842
2015-02-02 19:30:52 +00:00
David Majnemer 129f417efd MS ABI: Implement support for 'novtable'
It is common for COM interface classes to be marked as 'novtable' to
tell the compiler that constructors and destructors should not reference
virtual function tables.

This commit implements this feature in clang.

llvm-svn: 227796
2015-02-02 10:22:20 +00:00
Nico Weber 82d9e7ec1c Wrap to 80 columns. No behavior change.
llvm-svn: 227782
2015-02-02 05:38:59 +00:00
Nico Weber 7f8ec52067 Follow-up to r217302: Don't crash on ~A::A in a postfix expr suffix followed by '<'.
This used to crash, complaining "ObjectType and scope specifier cannot coexist":

    struct A { } b = b.~A::A <int>;

The only other caller of ParseOptionalCXXScopeSpecifier() that passes in a
non-empty ObjectType clears the ObjectType of the scope specifier comes back
non-empty (see the tok::period case in Parser::ParsePostfixExpressionSuffix()),
so do that here too.

Found by SLi's bot.

llvm-svn: 227781
2015-02-02 05:33:50 +00:00
Nico Weber 10d02b5604 Remove a comment I accidentally added in r227581. No behavior change.
llvm-svn: 227777
2015-02-02 04:18:38 +00:00
John McCall 2859258e2f Allow objc_bridge(id) to be used on typedefs of [cv] void*.
rdar://19678874

llvm-svn: 227774
2015-02-01 22:34:06 +00:00
Craig Topper 53565c60e7 [X86] Add other flavors of AVX512 cmpps/cmppd intrinsics.
llvm-svn: 227773
2015-02-01 22:27:40 +00:00
Craig Topper 2a898bfc67 [X86] Add the AVX512 exp2a23 intrinsics.
llvm-svn: 227769
2015-02-01 21:34:11 +00:00
Benjamin Kramer 04ec7e316b Reimplement iterator wrappers on top of llvm::iterator_adaptor_base.
Eliminates a ton of boilerplate proxying the iterator methods. NFC.

llvm-svn: 227764
2015-02-01 20:31:36 +00:00
Chandler Carruth d294bdb5ad [multiversion] Update Clang for the API change in LLVM r227731.
This moves all of the PassManager <-> Target communication to use the
new pass manager's TargetIRAnalysis even with the old pass manager. See
the LLVM commit for some of why things are moving in this direction, but
the short version is that this will enable us to create per-function
TargetTransformInfo objects that have correct subtarget information for
that function.

llvm-svn: 227732
2015-02-01 12:26:23 +00:00
Craig Topper da97c20128 [X86] Add all intrinsics for scalar rsqrt28/rcp28 to avx512erintrin.h. Add parentheses around all macro arguments.
llvm-svn: 227722
2015-02-01 10:15:11 +00:00
Craig Topper c4b852a909 [X86] Flesh out more of the avx512erintrin.h file.
llvm-svn: 227719
2015-02-01 08:52:55 +00:00
Craig Topper b01fc317c1 [X86] Use macros in AVX512ER header to allow ICE to be checked for immediate argument.
llvm-svn: 227716
2015-02-01 08:05:12 +00:00
Craig Topper 67826a5883 [X86] Rename _mm512_valign_epi64/32 intrinsics to _mm512_alignr_epi64/32 to match Intel docs. Make immediate argument to them an ICE. Fix mask size for the alignd version.
llvm-svn: 227713
2015-02-01 07:35:40 +00:00