Commit Graph

56840 Commits

Author SHA1 Message Date
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
Reid Kleckner
690c5baa6d Fix Driver/mg.c test when fgrep is a shell Cygwin shell script
llvm-svn: 228036
2015-02-03 21:49:15 +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
Daniel Jasper
e03491d390 Move "inline" to the right place.
llvm-svn: 227957
2015-02-03 09:54:58 +00:00
Daniel Jasper
d142381cd8 Add some overloads so that floating point literals can be AST matched properly.
I am not entirely sure whether the implemented sematics are ideal. In
particular, should floatLiteral(equals(0.5)) match "0.5f" and should
floatLiteral(equals(0.5f)) match "0.5". With the overloads in this
patch, the answer to both questions is yes, but I am happy to change
that.

llvm-svn: 227956
2015-02-03 09:45:52 +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
Ted Kremenek
0f26d132d7 [analyzer] Change ccc-analyzer to accept both -isystem <path> and -isystem<path>
Patch by Thomas Hauth!

llvm-svn: 227946
2015-02-03 06:23:36 +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
David Majnemer
61968bc85a test: Make encode-test-5.m's output not dependent on its filename
Pipe the file into clang instead of passing the file path on the command
line.

llvm-svn: 227896
2015-02-02 23:38:27 +00:00
Daniel Jasper
05ce1eed0a Revert "Add some overloads so that floating point literals can be AST matched properly."
Apparently the build bots get angry for some reason. Can't reproduce
that in a local cmake/ninja build. Will look closer. Rolling back for
now.

llvm-svn: 227895
2015-02-02 23:35:39 +00:00
Filipe Cabecinhas
10ff1333e4 clang lit.cfg: Fix a bug pointed by Sean Silva
llvm-svn: 227894
2015-02-02 23:17:54 +00:00
Daniel Jasper
88de3d7284 Add some overloads so that floating point literals can be AST matched properly.
I am not entirely sure whether the implemented sematics are ideal. In
particular, should floatLiteral(equals(0.5)) match "0.5f" and should
floatLiteral(equals(0.5f)) match "0.5". With the overloads in this
patch, the answer to both questions is yes, but I am happy to change
that.

llvm-svn: 227892
2015-02-02 23:04:00 +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
5fc217451b FileCheck'ize CodeGenObjC test
This fixes PR22437.

llvm-svn: 227843
2015-02-02 19:30:54 +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
2ba2b26632 MS ABI: Add more documentation and tests for novtable
llvm-svn: 227838
2015-02-02 19:05:46 +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
95514e0422 Remove decltype in an attempt to fix the MSVC build.
C++ is hard, attempt #1 of n.

llvm-svn: 227768
2015-02-01 21:32:12 +00:00
Benjamin Kramer
06e0f5a784 Actually we can just inline the base typedef and use the injected class name for the base class.
llvm-svn: 227765
2015-02-01 20:47:51 +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
Craig Topper
a5df398006 [X86] Add test for avx512er builtins that I forgot to commit with changes to the header file.
llvm-svn: 227762
2015-02-01 19:56:51 +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
3b079c5ed2 [X86] Convert some more const ints to ICE in AVX512 builtins.
llvm-svn: 227714
2015-02-01 07:35:43 +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
Craig Topper
72c7d51251 [X86] Change rounding parameter of all the AVX512 builtins to an ICE.
llvm-svn: 227712
2015-02-01 07:35:35 +00:00
Filipe Cabecinhas
01e77c2617 Fix a typo
We're not that much into metals.

llvm-svn: 227696
2015-01-31 23:25:54 +00:00
Filipe Cabecinhas
f2a3aec5c7 Tweak behavior due to -fexceptions, in C++ mode, imply -fcxx-exceptions
Added test

llvm-svn: 227695
2015-01-31 23:05:51 +00:00
Chandler Carruth
aab5ec078e [PM] Update Clang for the new LLVM API in r227685 for managing the
TargetTransformInfo, and unify the code in a single place.

llvm-svn: 227686
2015-01-31 11:18:46 +00:00
Craig Topper
da798ddba5 [X86] Make AVX512 integer comparison builtins use unsigned types for the masks.
llvm-svn: 227681
2015-01-31 08:58:36 +00:00
Craig Topper
ae2957cce6 [X86] AVX512 scatter/gather builtins as taking an ICE for scale instead of just a const int.
llvm-svn: 227680
2015-01-31 08:58:30 +00:00
Craig Topper
1a8b0472d5 [X86] Add immediate range checking for a couple XOP builtins.
llvm-svn: 227679
2015-01-31 08:57:52 +00:00
Daniel Jasper
30526e79e8 clang-format: Fix incorrect handling of leading whitespace.
Added an assertion that triggered in an existing test case (without
observable differences) and fixed the code.

llvm-svn: 227677
2015-01-31 07:05:46 +00:00
Craig Topper
9fee8ab4f9 [x86] Remove tab characters from avxintrin.h. NFC.
llvm-svn: 227676
2015-01-31 06:33:59 +00:00
Craig Topper
459554f164 [X86] Make order consistent between 'const' and 'int' in one of the intrinsic header files. NFC
llvm-svn: 227675
2015-01-31 06:31:30 +00:00
Craig Topper
1601525f1c [X86] Add range checking to the immediate arguments of many of the SSE/AVX builtins.
llvm-svn: 227674
2015-01-31 06:31:23 +00:00
Richard Smith
5089542793 [modules] When we try to complete the redeclaration chain for a class template
specialization, pull in any lazy specializations of the class template.

llvm-svn: 227668
2015-01-31 03:04:55 +00:00
David Blaikie
303facbeb8 DebugInfo: Fix line table for comparisons harder/better for the sake of C (& the GDB buildbot)
llvm-svn: 227663
2015-01-31 01:10:11 +00:00
David Blaikie
9fd4d08515 Rename test file to be more accurate (& free up the file name for a more appropriate test)
llvm-svn: 227662
2015-01-31 01:10:09 +00:00
Saleem Abdulrasool
71d1dd1e0c CodeGen: create a WindowsARMTargetCodeGenInfo
Create a new TargetCodeGenInfo for Windows on ARM to permit annotating the
functions with stack-probe-size (for /Gs and -mstack-probe-support) for
generating the stack probe necessary for Windows targets.  This will be used by
the backend when lowering the frame to generate the stack probe appropriately.

llvm-svn: 227641
2015-01-30 23:29:19 +00:00
Reid Kleckner
3a417c301b SEH: Don't jump to an unreachable continuation block
If both the __try and __except blocks do not return, we want to delete
the continuation block as unreachable instead.

llvm-svn: 227627
2015-01-30 22:16:45 +00:00
Reid Kleckner
165143587a Windows: Fix _CPPUNWIND definition to follow -fcxx-exceptions
This is consistent with how we interpret the MSVC /EH flag, which
controls -fcxx-exceptions.

llvm-svn: 227616
2015-01-30 21:42:55 +00:00
Filipe Cabecinhas
18a72611f1 Special-case the PS4 SDK for a clang test
Original patch by Gao Yunzhong!

llvm-svn: 227593
2015-01-30 18:25:59 +00:00
Filipe Cabecinhas
3455c4dce8 Shuffle tests around to more appropriate files
llvm-svn: 227592
2015-01-30 18:25:48 +00:00
Eric Christopher
58c2199cef Fix regression in r227409 where we were passing -fsyntax-only
in all cases.

Patch by Artem Belevich.

llvm-svn: 227591
2015-01-30 18:22:23 +00:00
Daniel Sanders
7f933f4c5e [mips] Pass ABI name via -target-abi instead of target-features
Patch by Vladimir Medic

Reviewers: echristo, atanasyan, dsanders

Reviewed By: atanasyan, dsanders

Subscribers: llvm-commits, echristo, atanasyan

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

llvm-svn: 227583
2015-01-30 17:35:23 +00:00
Nico Weber
f9e37be2d6 Follow-up to r217302 and r227555: Don't crash on inline ~A::A() if A is an int.
Even with r227555, this still crashed:

  struct S {
    int A;
    ~A::A() {}
  };

That's because ParseOptionalCXXScopeSpecifier()'s call to
ActOnCXXNestedNameSpecifier() doesn't mark the scope spec as invalid if sema
thought it's a good idea to fixit-correct "::" to ":".  For the diagnostic
improvement done in r217302, we never want :: to be interpreted as :, so fix
this by setting ColonSacred to false temporarily.

Found by SLi's bot.

llvm-svn: 227581
2015-01-30 16:53:11 +00:00
Nathan Sidwell
55d53fe79f Code cleanup
Parser::ParseLexedMethodDeclaration: Use local var for Param
Sema::MergeCXXFunctionDecls: Use hasInheritedDefaultArg

llvm-svn: 227577
2015-01-30 14:21:35 +00:00
Filipe Cabecinhas
c9c4025c8a Remove unneeded code
We don't really care about enabling RTTI with -fexceptions, only with
-fcxx-exceptions.

llvm-svn: 227567
2015-01-30 11:17:56 +00:00
Fraser Cormack
cc6e894587 Fix OpenCL 1.2 double as an optional core feature behaviour
In OpenCL 1.2, using double no longer requires using the pragma cl_khr_fp64,
instead a kernel is allowed to use double, but must first have queried
clGetDeviceInfo's CL_DEVICE_DOUBLE_FP_CONFIG.

Page 197, section 6.1.1 of the OpenCL 1.2 specification has a footnote 23
describing this behaviour.

I've also added test cases such that the pragma must be used if targeting
OpenCL 1.0 or 1.1, but is ignored in 1.2 and 2.0.

Patch by Neil Henning!

Reviewers: Pekka Jääskeläinen

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

llvm-svn: 227565
2015-01-30 10:51:46 +00:00
David Majnemer
8c969eaf1a Sema: Disable template instantiation once a fatal error is raised
Fatal errors disable all further diagnostics.  Continuing to permit
template instantiation does nothing but make it take longer for clang to
finish with the TU.

Instead, halt all further instantiation.

Fixed in PR22396.

llvm-svn: 227556
2015-01-30 05:01:23 +00:00
Nico Weber
d004586faa Follow-up to r217302: Don't crash on ~A::A() if A is undeclared.
llvm-svn: 227555
2015-01-30 04:05:15 +00:00
Nico Weber
07425af920 Typo fixo.
llvm-svn: 227554
2015-01-30 03:47:03 +00:00
Nico Weber
2890061b7d Wrap to 80 cols by removing trailing whitespace. No behavior change.
llvm-svn: 227553
2015-01-30 02:35:21 +00:00
Richard Smith
d0e102fece Teach AST printing to not print whitespace inside {} and () for initialization,
to match LLVM's preferred style.

llvm-svn: 227545
2015-01-30 02:04:26 +00:00
Nico Weber
9cc795c188 Weaken an assertion that isn't true for invalid input.
llvm-svn: 227540
2015-01-30 01:48:49 +00:00
Reid Kleckner
ab80f18f57 clang-cl: Enable -fexceptions but not -fcxx-exceptions by default
This enables proper IRgen of SEH constructs.

llvm-svn: 227528
2015-01-30 01:04:16 +00:00
Filipe Cabecinhas
28f353c7d0 Add some more PS4 driver settings related to rtti and exceptions.
Summary:
The PS4 defaults to -fno-rtti, and has to have rtti enabled when enabling
exceptions.

This commit makes clang add the -fno-rtti by default on the PS4, unless
-frtti was passed in.

It also diagnoses misuses for the PS4:
- Exceptions need rtti. Warn and enable rtti if no rtti flag was passed,
  error if -fno-rtti was passed.

I also added a more general warning for when -fno-rtti is the default
(currently it's only on the PS4) and the vptr sanitizer is on.

Fixed a few tests, due to different flag order when passing cc1 arguments.

Reviewers: chandlerc

Subscribers: cfe-commits

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

llvm-svn: 227518
2015-01-29 23:56:43 +00:00
Ulrich Weigand
f32a1acee8 [PowerPC] Work around TLS linker bug
Work around a bug in GNU ld (and gold) linker versions up to 2.25
that may mis-optimize code generated by this version of clang/LLVM
to access general-dynamic or local-dynamic TLS variables.

Bug is fixed here:
https://sourceware.org/ml/binutils/2015-01/msg00318.html

llvm-svn: 227480
2015-01-29 19:08:51 +00:00
Rafael Espindola
3c5f2354b8 This reverts commit r227432, r227438 and r227448.
It should bring the bots back.

Original messagses:

r227448:
   Remove unnecessary default.

r227438:
   Fix Index/print-type.cpp test following r227432.

r227432:
    libclang: Add three functions useful for dealing with anonymous fields:
       clang_Cursor_getOffsetOfField
       clang_Cursor_isAnonymous
       clang_Type_visitFields
    Python: Add corresponding methods for dealing with anonymous fields.

    Patch by Loïc Jaquemet

llvm-svn: 227472
2015-01-29 17:22:53 +00:00
Aaron Ballman
66c653fab4 Reverting r227453, which adds back the fuzzer library. Now excluding the clang-format fuzzer functionality based on LLVM_USE_SANITIZE_COVERAGE being set or unset.
llvm-svn: 227465
2015-01-29 16:58:53 +00:00
Aaron Ballman
8816257949 Temporarily reverting the fuzzer library as it causes too many build issues for MSVC users. This reverts: 227354
llvm-svn: 227453
2015-01-29 15:49:46 +00:00
Francois Pichet
19197e2d8b Remove unnecessary default.
llvm-svn: 227448
2015-01-29 15:42:56 +00:00
Filipe Cabecinhas
7a24104293 [xcore] Make the exceptions test actually check for the absence of -fexceptions in the proper place
llvm-svn: 227443
2015-01-29 15:03:36 +00:00
Francois Pichet
b4c7a47cd8 Fix Index/print-type.cpp test following r227432.
llvm-svn: 227438
2015-01-29 13:33:44 +00:00
NAKAMURA Takumi
4b643c23fd Disable a couple of crash-* tests for now. It seems they might be incompatible to win32.
llvm-svn: 227434
2015-01-29 13:23:23 +00:00
Daniel Jasper
0955cb41eb clang-format: FIXME that led to access of uninitialized memory.
I have so far not succeeded in finding a nicely reduced test case or an
observable difference which could help me create a test failure without
msan.

Committing without test to unblock kcc's further fuzzing progress.

llvm-svn: 227433
2015-01-29 13:11:47 +00:00
Francois Pichet
f3be1cc5a9 libclang: Add three functions useful for dealing with anonymous fields:
clang_Cursor_getOffsetOfField
   clang_Cursor_isAnonymous
   clang_Type_visitFields
Python: Add corresponding methods for dealing with anonymous fields.

Patch by Loïc Jaquemet

llvm-svn: 227432
2015-01-29 12:45:29 +00:00
Daniel Jasper
47b35aeaa1 clang-format: Fix crasher caused by not properly setting dry-run.
llvm-svn: 227427
2015-01-29 10:47:14 +00:00
David Majnemer
310e3a8f60 MS ABI: Implement proper support for setjmp
On targets which use the MSVCRT, setjmp is a macro which expands to
_setjmp or _setjmpex.

_setjmp and _setjmpex have a secret, hidden argument which is not listed
in the function prototype on X64 and WoA.  This hidden argument always
seems to be the frame pointer.

_setjmpex isn't used on X86, _setjmp is magically replaced with a call
to _setjmp3.  The second argument is zero for 'normal' setjmp/longjmp
pairs, otherwise it is a count of additional variadic arguments.  This
is used when setjmp appears inside of a try or __try.

It is not safe to use a pointer to setjmp because _setjmp, _setjmpex and
_setmp3 are not compatible with setjmp.

llvm-svn: 227426
2015-01-29 09:29:21 +00:00
David Majnemer
b9bf14c549 Basic: Re-sort these builtins
No functional change, it just makes it a little easier to find what you
are looking for.

llvm-svn: 227425
2015-01-29 09:29:17 +00:00
Nico Weber
6cf2df29e7 Make a codegen warning a real warning instead of a getCustomDiagID().
Warnings shouldn't use getCustomDiagID(), since then they can't be disabled
via a flag, can't be remapped, etc.

llvm-svn: 227420
2015-01-29 06:25:59 +00:00
Francisco Lopes da Silva
8cafefaef2 Sema: Turn some applicable functions static. NBC.
llvm-svn: 227418
2015-01-29 05:54:59 +00:00
Richard Smith
99335be950 Don't use BCPL comments here, in case someone wants to use <stdatomic.h> from C89 mode.
llvm-svn: 227417
2015-01-29 03:34:39 +00:00
Eric Christopher
cc7ff50e43 Ensure that -fsyntax-only with fortran 90 passes along silently
to the underlying gcc.
PR22234

Patch by Artem Belevich.

llvm-svn: 227409
2015-01-29 00:56:17 +00:00
Derek Schuff
71658bd15e Remove NaClX86_64TargetCodeGenInfo and NaClARMTargetCodeGenInfo
Summary:
They just existed before to use NaCl's custom ABIInfos; now that those are gone,
the custom TargetCodeGenInfos are no longer needed either.

Test Plan: don't break the existing tests

Reviewers: jvoung

Subscribers: jfb, cfe-commits

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

llvm-svn: 227406
2015-01-29 00:47:04 +00:00
Joerg Sonnenberger
1689d3f732 For the --be8 flag, check explicitly for pre-v7 / pre-v6m cores.
Those used the old Big Endian support on ARM and don't need flags.
Refactor the logic in a separate common function, which also looks at
-march. Add corresponding logic for the Linux toolchain.

llvm-svn: 227393
2015-01-28 23:30:39 +00:00
Dan Albert
6f2875d834 [clang] Use -android environment for all compiler-rt libs.
Summary:
This was already done for the sanitizers, but it needs to be done for
the profile and builtin libs as well.

Reviewers: srhines, timmurray, eugenis, samsonov

Reviewed By: samsonov

Subscribers: compnerd, cfe-commits

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

llvm-svn: 227392
2015-01-28 23:23:36 +00:00
Fariborz Jahanian
36f7f1303f CXX [qoi]. Prevent a crash when initializer expression is
invalid when trying to create temporary copy of the invalid
initializer. rdar://19109967

llvm-svn: 227378
2015-01-28 22:08:10 +00:00
Richard Smith
1ae689c2b8 PR22367: Don't forget to create a CXXFunctionalCastExpr around
list-initialization that gets converted to some form other than an
InitListExpr. CXXTemporaryObjectExpr is a special case here, because it
represents a fused CXXFunctionalCastExpr + CXXConstructExpr. That, in
itself, is probably a design error...

llvm-svn: 227377
2015-01-28 22:06:01 +00:00
Nathan Sidwell
ffa7dc379f PR 17456
More helpful diagnostic on casts between unrelated class hierarchies.

llvm-svn: 227371
2015-01-28 21:31:26 +00:00
Kaelyn Takata
c49838b331 Revert a change from r222797 that is no longer needed and can cause
infinite recursion.

Also guard against said infinite recursion by adding an assert that will
trigger if CorrectDelayedTyposInExpr is called before a previous call to
CorrectDelayedTyposInExpr returns (i.e. if the TreeTransform run by
CorrectDelayedTyposInExpr calls a sequence of methods that
end up calling CorrectDelayedTyposInExpr, as the new test case had done
prior to this commit). Fixes PR22292.

llvm-svn: 227368
2015-01-28 21:10:46 +00:00
Derek Schuff
3970a7ec9b Remove support for pnaclcall attribute
Summary:
It was used for interoperability with PNaCl's calling conventions, but
it's no longer needed.

Also Remove NaCl*ABIInfo which just existed to delegate to either the portable
or native ABIInfo, and remove checkCallingConvention which was now a no-op
override.

Reviewers: jvoung

Subscribers: jfb, llvm-commits

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

llvm-svn: 227362
2015-01-28 20:24:52 +00:00
Richard Smith
fee9e20b90 Fix layering violation: include/clang/Basic/PlistSupport.h should not include
files from include/clang/Lex. Clean up module map.

llvm-svn: 227361
2015-01-28 20:14:54 +00:00
David Blaikie
298720d324 DebugInfo: Attribute implicit boolean tests to the expression being tested, not to the outer use of that expression.
This is half a fix for a GDB test suite failure that expects to start at
'a' in the following code:

  void func(int a)
    if (a
        &&
	b)
	...

But instead, without this change, the comparison was assigned to '&&'
(well, worse actually - because there was a chained 'a && b && c' and it
was assigned to the second '&&' because of a recursive application of
this bug) and then the load folded into the comparison so breaking on
the function started at '&&' instead of 'a'.

The other part of this needs to be fixed in LLVM where it's ignoring the
location of the icmp and instead using the location of the branch
instruction.

The fix to the conditional operator is actually a no-op currently,
because the conditional operator's location coincides with 'a' (the
start of the conditional expression) but should probably be '?' instead.
See the FIXME in the test case that mentions the ARCMigration tool
failures when I tried to make that change.

llvm-svn: 227356
2015-01-28 19:50:09 +00:00
Kostya Serebryany
d2ef30feed Add clang-format-fuzzer target
Summary:
This adds clang-format-fuzzer binary,
which depends on the Fuzzer lib,
see http://reviews.llvm.org/D7184

This fuzer has found ~15 bugs so far, and I hope to set up a bot for it.

Test Plan: run on a bot.

Reviewers: samsonov, djasper

Reviewed By: djasper

Subscribers: curdeius, cfe-commits

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

llvm-svn: 227354
2015-01-28 19:39:18 +00:00
Filipe Cabecinhas
22e7635dc5 Testcase for PS4 target defaults (from r227215 and r227219)
llvm-svn: 227343
2015-01-28 18:49:45 +00:00
Alex Rosenberg
286f124da5 Enable pragma comment processing for PS4. Original patch by Yunzhong Gao!
llvm-svn: 227336
2015-01-28 18:26:15 +00:00
Tom Stellard
d99fb956a3 R600: Use a Southern Islands GPU as the default for the amdgcn target
llvm-svn: 227315
2015-01-28 15:38:44 +00:00
Hal Finkel
77366097f4 Fix typo (count correctly) in include/clang/AST/TypeNodes.def
Patch by Mingjie Xing.

llvm-svn: 227313
2015-01-28 15:11:18 +00:00
Nathan Sidwell
0ba1940b8d PR 20146
make new diagnostic an ExtWarn

llvm-svn: 227312
2015-01-28 14:48:39 +00:00
Sean Silva
fdcbb0284e Avoid testing for a particular choice of resource dir.
Without this patch, this test was accidentally testing that
CLANG_RESOURCE_DIR, CLANG_LIBDIR_SUFFIX, and CLANG_VERSION_STRING
were set to a particular set of values.

The test was also getting pretty hairy since it was attempting to craft
a regular expression that covered "all" possible combinations of
settings for these configure-time constants.

Clean it up by directly capturing the resource directory in a FileCheck
variable.

llvm-svn: 227310
2015-01-28 14:19:08 +00:00
Francisco Lopes da Silva
0c010cddb3 Improves overload completion result chunks.
The code building the code completion string for overloads was providing
less detail compared to the one building completion strings for function
declarations. There was no information about optionals and no information
about what's a parameter and what's a function identifier, everything
besides ResultType, CurrentParameter and special characters was classified
as Text.

This makes code completion strings for overload candidates to follow a
pattern very similar, but not identical, to the one in use for function
declarations:

 - return type chunk: ResultType
 - function identifier chunk: Text
 - parameter chunks: Placeholder
 - optional parameter chunks: Optional
 - current parameter chunk: CurrentParameter

llvm-svn: 227309
2015-01-28 14:17:22 +00:00
David Majnemer
e85cff84b9 Sema: Ensure that __c11_atomic_fetch_add has a pointer to complete type
Pointer arithmetic is only makes sense if the pointee type is complete.

This fixes PR22361.

llvm-svn: 227295
2015-01-28 05:48:06 +00:00
Larisse Voufo
4891e74c39 Re-arrange DR test cases, and update DR status page.
llvm-svn: 227279
2015-01-28 01:01:21 +00:00
Kaelyn Takata
20deb1d78c Use the real CXXScopeSpec when setting the correction SourceRange.
Otherwise, in the most important case and the only case where SS and
TempSS are different (which is when the CXXScopeSpec should be dropped,
and TempSS is NULL) the wrong SourceRange will be used in the fixit for
the typo correction. Fixes the remaining issue in PR20626.

llvm-svn: 227278
2015-01-28 00:46:09 +00:00
Hans Wennborg
2e56d950ff Intrin.h: define _XCR_XFEATURE_ENABLED_MASK
Users expect to be able to use this with _xgetbv.

llvm-svn: 227270
2015-01-27 23:34:35 +00:00
Richard Smith
1bbaba8746 Cleanups, and add some FIXMEs. No functional change.
llvm-svn: 227267
2015-01-27 23:23:39 +00:00
Kaelyn Takata
7a503694fe Fix a think-o in handling ambiguous corrections for a TypoExpr.
Under certain circumstances, the identifier mentioned in the diagnostic
won't match the intended correction even though the replacement
expression and the note pointing to the decl are both correct.
Basically, the TreeTransform assumes the TypoExpr's Consumer points to
the correct TypoCorrection, but the handling of typos that appear to be
ambiguous from the point of view of TransformTypoExpr would cause that
assumption to be violated by altering the Consumer's correction stream.
This fix allows the Consumer's correction stream to be reset to the
right TypoCorrection after successfully resolving the percieved ambiguity.

Included is a fix to suppress correcting the RHS of an assignment to the
LHS of that assignment for non-C++ code, to prevent a regression in
test/SemaObjC/provisional-ivar-lookup.m.

This fixes PR22297.

llvm-svn: 227251
2015-01-27 22:01:39 +00:00
Larisse Voufo
19d0867284 Implement the remaining portion of DR1467 from r227022. I may have overlooked a few things, but this implementation comes straight from the DR resolution itself.
llvm-svn: 227224
2015-01-27 18:47:05 +00:00
Alex Rosenberg
ba1b6a16c4 Check wchar_t type on PS4.
llvm-svn: 227223
2015-01-27 18:43:05 +00:00
Adrian Prantl
f75014aa34 Update the doxygen comments in CGDebugInfo.h to follow the coding standards.
llvm-svn: 227221
2015-01-27 18:32:19 +00:00
Kaelyn Takata
05f4050928 Properly handle typos in the conditional of ?: expressions in C.
In particular, remove the OpaqueExpr transformation from r225389 and
move the correction of the conditional from CheckConditionalOperands to
ActOnConditionalOp before the OpaqueExpr is created. This fixes the
typo correction behavior in C code that uses the GNU extension for a
binary ?: (without an expression between the "?" and the ":").

llvm-svn: 227220
2015-01-27 18:26:18 +00:00
Filipe Cabecinhas
b1e6c2dd3d Fix part of r227215. PS4 code just omits leaf frame pointers.
llvm-svn: 227219
2015-01-27 18:08:32 +00:00
Filipe Cabecinhas
4b44257c54 Added more PS4 defaults for code generation
llvm-svn: 227215
2015-01-27 17:27:37 +00:00
Sean Silva
110de6fc29 No longer SCE_PRIVATE ;)
llvm-svn: 227200
2015-01-27 16:53:56 +00:00
Alex Rosenberg
12207fab78 Begin to teach clang about the PS4.
llvm-svn: 227194
2015-01-27 14:47:44 +00:00
Craig Topper
335e218760 [X86] Add intrinsics for AVX512 128 and 256 bit integer comparison of word and byte vectors.
llvm-svn: 227186
2015-01-27 09:16:29 +00:00
Richard Smith
48372b68fe DR1902: if overload resolution recurses, and the inner overload resolution
selects a deleted function, the outer function is still a candidate even though
the initialization sequence is "otherwise ill-formed".

llvm-svn: 227169
2015-01-27 03:30:40 +00:00
Pete Cooper
f051cbf631 Don't generate llvm.expect intrinsics with -O0.
The backend won't run LowerExpect on -O0.  In a debug LTO build, this results in llvm.expect intrinsics being in the LTO IR which doesn't know how to optimize them.

Thanks to Chandler for the suggestion and review.

Differential revision: http://reviews.llvm.org/D7183

llvm-svn: 227135
2015-01-26 20:51:58 +00:00
Ben Langmuir
7b30f53b18 Tweak r227115 per review feedback
Use getAsArrayTypeUnsafe() instead of getUnqualifiedDesugaredType() to
get the underlying ArrayType.

llvm-svn: 227129
2015-01-26 20:01:17 +00:00
Reid Kleckner
ee15ea3560 Fix broken doc link to Clang 3.5 release notes
We appear to use 3.5.0 in the directory structure now. That's probably
unnecessary. We should probably let the micro releases update the docs
for the same minor version.

llvm-svn: 227127
2015-01-26 19:53:16 +00:00
Ben Langmuir
577b39349e Fix assert instantiating string init of static variable
... when the variable's type is a typedef of a ConstantArrayType. Just
look through the typedef (and any other sugar).  We only use the
constant array type here to get the element count.

llvm-svn: 227115
2015-01-26 19:04:10 +00:00
Eric Christopher
611dfed99f Update for LLVM API change.
llvm-svn: 227114
2015-01-26 19:03:30 +00:00
Fariborz Jahanian
4732d43cc2 Objective-C SDK modernizer to use NS_ENUM/NS_OPTIONS macros
with typed enums. rdar://19352510

llvm-svn: 227104
2015-01-26 17:41:03 +00:00
Joerg Sonnenberger
dceac987bd For NetBSD/ARM-EB, link with --be8. Support for the older BE32 is
currently not planned.

llvm-svn: 227088
2015-01-26 12:30:16 +00:00
Craig Topper
b4789096c0 [X86] Add AVX512 integer comparison intrinsics for word and byte vectors.
llvm-svn: 227079
2015-01-26 09:24:10 +00:00
Evgeniy Stepanov
5e927b6285 [msan] Remove MSanDR reference from the manual.
It is no longer supported.

llvm-svn: 227078
2015-01-26 09:17:37 +00:00
Craig Topper
2f25a5a875 [X86] Add more of the AVX512 integer comparision intrinsics. This adds 128 and 256 bit vectors of dwords and qwords.
llvm-svn: 227075
2015-01-26 08:11:49 +00:00
Nico Weber
b3a9978dc8 Don't let virtual calls and dynamic casts call Sema::MarkVTableUsed().
clang currently calls MarkVTableUsed() for classes that get their virtual
methods called or that participate in a dynamic_cast. This is unnecessary,
since CodeGen only emits vtables when it generates constructor, destructor, and
vtt code. (*)

Note that Sema::MarkVTableUsed() doesn't cause the emission of a vtable.
Its main user-visible effect is that it instantiates virtual member functions
of template classes, to make sure that if codegen decides to write a vtable
all the entries in the vtable are defined.

While this shouldn't change the behavior of codegen (other than being faster),
it does make clang more permissive: virtual methods of templates (in particular
destructors) end up being instantiated less often. In particular, classes that
have members that are smart pointers to incomplete types will now get their
implicit virtual destructor instantiated less frequently. For example, this
used to not compile but does now compile:

    template <typename T> struct OwnPtr {
      ~OwnPtr() { static_assert((sizeof(T) > 0), "TypeMustBeComplete"); }
    };
    class ScriptLoader;
    struct Base { virtual ~Base(); };
    struct Sub : public Base {
      virtual void someFun() const {}
      OwnPtr<ScriptLoader> m_loader;
    };
    void f(Sub *s) { s->someFun(); }

The more permissive behavior matches both gcc (where this is not often
observable, since in practice most things with virtual methods have a key
function, and Sema::DefineUsedVTables() skips vtables for classes with key
functions) and cl (which is my motivation for this change) – this fixes
PR20337.  See this issue and the review thread for some discussions about
optimizations.

This is similar to r213109 in spirit. r225761 was a prerequisite for this
change.

Various tests relied on "a->f()" marking a's vtable as used (in the sema
sense), switch these to just construct a on the stack. This forces
instantiation of the implicit constructor, which will mark the vtable as used.

(*) The exception is -fapple-kext mode: In this mode, qualified calls to
virtual functions (`a->Base::f()`) still go through the vtable, and since the
vtable pointer off this doesn't point to Base's vtable, this needs to reference
Base's vtable directly. To keep this working, keep referencing the vtable for
virtual calls in apple kext mode.

llvm-svn: 227073
2015-01-26 06:23:36 +00:00
Nico Weber
220b3ad598 Test that member functions of constexpr constructed templates are instantiated.
They are referenced from the vtable. (This worked fine, but I couldn't find
an existing test for this.  Maybe I didn't look hard enough.)

llvm-svn: 227072
2015-01-26 06:08:07 +00:00
Nico Weber
4a18449c2c Remove -verify from a codegen test that didn't have any expected-foo lines.
Makes the error output of the test more readable when it fails. Also allows
removing a "not" from the run line.

llvm-svn: 227071
2015-01-26 05:47:24 +00:00
Yaron Keren
3bf8462331 clang-format two Decl* code locations, NFC.
llvm-svn: 227070
2015-01-26 04:41:07 +00:00
Nico Weber
fe0053eb42 Reword comment.
llvm-svn: 227069
2015-01-26 03:03:49 +00:00
Nico Weber
99e05d02cb Test that qualified virtual calls mark vtables referenced in apple kext mode.
I broke this locally while working on PR20337 and no test caught that.  Now
there's coverage for this, and a comment explaining why this is needed.

llvm-svn: 227068
2015-01-26 02:59:07 +00:00
Craig Topper
4cac1c2318 [X86] Add AVX512F integer comparision intrinsics to header file.
llvm-svn: 227067
2015-01-25 23:30:07 +00:00
Craig Topper
95b0d73cee [X86] Add immediate range checking to AVX512 integer comparision builtins.
llvm-svn: 227066
2015-01-25 23:30:05 +00:00
Craig Topper
ad1766aaa0 [X86] Add AVX512 floating cmpgt and integer comparison builtins. Intrinsic header file usages coming later.
llvm-svn: 227065
2015-01-25 23:30:00 +00:00
Renato Golin
b625f48862 Allows Clang to use LLVM's fixes-x18 option
This patch allows clang to have llvm reserve the x18
platform register on AArch64. FreeBSD will use this in the kernel for
per-cpu data but has no need to reserve this register in userland so
will need this flag to reserve it.

This uses llvm r226664 to allow this register to be reserved.

Patch by Andrew Turner.

llvm-svn: 227062
2015-01-25 23:17:48 +00:00
NAKAMURA Takumi
1dba307c0f clang/test/Driver/rewrite-map-in-diagnostics.c: This depends on crash-recovery.
llvm-svn: 227061
2015-01-25 23:10:21 +00:00
Francisco Lopes da Silva
1a4f855595 Sema: Formatting. No behavior change.
llvm-svn: 227052
2015-01-25 17:00:47 +00:00
Francisco Lopes da Silva
a349a8aee9 Sema: require a complete type before lookup.
llvm-svn: 227037
2015-01-25 08:47:59 +00:00
David Blaikie
4e340b75b2 Fix the buildbots (fallout from r227028) by returning the exprloc of non-binary operator overload calls (and ->) to the start of the expression, not the location of the operator
I'll give this some further thought/discussion later, but this is enough
to unbreak the buildbots at least.

llvm-svn: 227034
2015-01-25 07:44:05 +00:00
Nico Weber
a24b299c00 Rename four test files from .C to .cpp.
lit.cfg has never supported running .C files, so these tests were never
executed by check-clang.  Rename them to .cpp so that they run as part of
the test suite, and minorly tweak two of them that look like they were broken
when checked in to actually pass.

llvm-svn: 227029
2015-01-25 02:04:36 +00:00
David Blaikie
9f7ae2c948 DebugInfo: Attribute calls to overloaded operators with the operator, not the start of the whole expression
llvm-svn: 227028
2015-01-25 01:25:37 +00:00
David Blaikie
9b47966615 DebugInfo: Use the preferred location rather than the start location for expression line info
This causes things like assignment to refer to the '=' rather than the
LHS when attributing the store instruction, for example.

There were essentially 3 options for this:

* The beginning of an expression (this was the behavior prior to this
  commit). This meant that stepping through subexpressions would bounce
  around from subexpressions back to the start of the outer expression,
  etc. (eg: x + y + z would go x, y, x, z, x (the repeated 'x's would be
  where the actual addition occurred)).

* The end of an expression. This seems to be what GCC does /mostly/, and
  certainly this for function calls. This has the advantage that
  progress is always 'forwards' (never jumping backwards - except for
  independent subexpressions if they're evaluated in interesting orders,
  etc). "x + y + z" would go "x y z" with the additions occurring at y
  and z after the respective loads.
  The problem with this is that the user would still have to think
  fairly hard about precedence to realize which subexpression is being
  evaluated or which operator overload is being called in, say, an asan
  backtrace.

* The preferred location or 'exprloc'. In this case you get sort of what
  you'd expect, though it's a bit confusing in its own way due to going
  'backwards'. In this case the locations would be: "x y + z +" in
  lovely postfix arithmetic order. But this does mean that if the op+
  were an operator overload, say, and in a backtrace, the backtrace will
  point to the exact '+' that's being called, not to the end of one of
  its operands.

(actually the operator overload case doesn't work yet for other reasons,
but that's being fixed - but this at least gets scalar/complex
assignments and other plain operators right)

llvm-svn: 227027
2015-01-25 01:19:10 +00:00
Nico Weber
562ff37507 Name a bool parameter. No behavior change.
llvm-svn: 227026
2015-01-25 01:00:21 +00:00
Nathan Sidwell
d5b9a1d78a Remove duplicate code
llvm-svn: 227024
2015-01-25 00:25:44 +00:00
David Blaikie
2d321fb79d DebugInfo: Correct the line location of geps on array accesses
llvm-svn: 227023
2015-01-24 23:35:17 +00:00
Larisse Voufo
d201099177 First steps in implementing DR1467: List-initialization of aggregate from same-type object.
Only the first two items for now, changing Sections 8.5.4 [dcl.init.list] paragraph 3 and 13.3.1.7 [over.match.list] paragraph 1,
so that defining class objects and character arrays using uniform initialization syntax is actually treated as list initialization
and before it is treated aggregate initialization.

llvm-svn: 227022
2015-01-24 23:09:54 +00:00
Justin Bogner
903678caa0 InstrProf: Use an Optional instead of an out parameter
llvm-svn: 227015
2015-01-24 20:22:32 +00:00
Justin Bogner
9fa8c9984c test: Convert some tests to FileCheck
These were all doing trivial greps. It's better to use FileCheck.

llvm-svn: 227007
2015-01-24 17:39:36 +00:00
Justin Bogner
2af264a44a test: Remove two redundant lines from this test
The FileCheck already checks for these lines, no need to grep as well.

llvm-svn: 227006
2015-01-24 17:39:32 +00:00
Richard Trieu
15b66535ca When checking the template argument list, use a copy of that list for changes
and only update the orginal list on a valid arugment list.  When checking an
individual expression template argument, and conversions are required, update
the expression in the template argument.  Since template arguments are
speculatively checked, the copying of the template argument list prevents
updating the template arguments when the list does not match the template.

Additionally, clean up the integer checking code in the template diffing code.
The code performs unneccessary conversions from APSInt to APInt.

Fixes PR21758.

This essentially reverts r224770 to recommits r224667 and r224668 with extra
changes to prevent the template instantiation problems seen in PR22006.
A test to catch the discovered problem is also added.

llvm-svn: 226983
2015-01-24 02:48:32 +00:00
Chandler Carruth
57bb7c7cad [PM] Update Clang to reflect the TLI API change in LLVM r226981.
llvm-svn: 226982
2015-01-24 02:25:21 +00:00
Richard Smith
8a63989728 [modules] Sometimes we can deserialize a class member but not have yet
encountered any definition for the class; this happens when the definition is
added by an update record that is not yet loaded. In such a case, eagerly pick
the original parent of the member as the canonical definition of the class
rather than muddling through with the canonical declaration (the latter can
lead to us failing to merge properly later if the canonical definition turns
out to be some other declaration).

llvm-svn: 226977
2015-01-24 01:07:20 +00:00
Justin Bogner
f69dc349d5 InstrProf: Use the stream when dumping counters
llvm-svn: 226968
2015-01-23 23:46:13 +00:00
David Blaikie
a1fd099575 DebugInfo: Remove outdated comment. Column info is no longer needed to differentiate inline callsites.
llvm-svn: 226955
2015-01-23 22:48:27 +00:00
David Blaikie
a627202e19 Disable warnings in an IRGen test to make test failures less noisy
llvm-svn: 226954
2015-01-23 22:47:05 +00:00
Fariborz Jahanian
f9317f1586 Objective-C moderinzer [qoi], add space on rhs when needed when
converting to property-dot syntax for setters.
rdar://19381786

llvm-svn: 226944
2015-01-23 21:58:46 +00:00
Daniel Jasper
d1c13736e0 clang-format: Fix another crasher caused by incomplete macro code.
We did't properly mark all of an AnnotatedLine's children as finalized
and thus would reformat the same tokens in different branches of #if/#else
sequences leading to invalid replacements.

llvm-svn: 226930
2015-01-23 19:37:25 +00:00
Fariborz Jahanian
30609b8a78 Objective-C modernizer. Avoid using property-dot syntax when
receiver type is not valid for property-dot syntz use.
rdar://19381786

llvm-svn: 226927
2015-01-23 19:23:42 +00:00
Reid Kleckner
6b7156b74d Attempt to fix ::sscanf Cygwin build break reported in PR22302
llvm-svn: 226925
2015-01-23 19:16:25 +00:00
Francisco Lopes da Silva
13937abe88 Add tests for code completion of variadic prototypes
llvm-svn: 226924
2015-01-23 19:06:57 +00:00
Daniel Jasper
7509216a41 clang-format: Fix incorrect classification of "*".
Before:
  *a = b *c;

After:
  *a = b * c;

llvm-svn: 226923
2015-01-23 19:04:49 +00:00
Sanjay Patel
76c9e0986c Process the -fno-signed-zeros optimization flag (PR20870)
The driver currently accepts but ignores the -fno-signed-zeros flag. 
This patch passes the flag through and enables 'nsz' fast-math-flag 
generation in IR.

The existing OpenCL flag for the same functionality is made into an
alias here. It may be removed in a subsequent patch.

This should resolve bug 20870 ( http://llvm.org/bugs/show_bug.cgi?id=20870 );
patches for the optimizer were checked in at:
http://llvm.org/viewvc/llvm-project?view=revision&revision=225050
http://llvm.org/viewvc/llvm-project?view=revision&revision=224583

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

llvm-svn: 226915
2015-01-23 16:40:50 +00:00
Alexander Kornienko
6ee521c7eb Replace size() calls on containers with empty() calls where appropriate. NFC
http://reviews.llvm.org/D7090

Patch by Gábor Horváth!

llvm-svn: 226914
2015-01-23 15:36:10 +00:00
Francisco Lopes da Silva
62a9a4fc9b Sema: code completion for variadic prototypes.
llvm-svn: 226908
2015-01-23 13:17:51 +00:00
Rafael Espindola
6565e92f3f [pr22293] Don't crash during codegen of a recursive destructor.
In ItaniumCXXABI::EmitCXXDestructors we first emit the base destructor
and then try to emit the complete one as an alias.

If in the base ends up calling the complete destructor, the GD for the
complete will be in the list of deferred decl by the time we replace
it with an alias and delete the original GV.

llvm-svn: 226896
2015-01-23 05:26:38 +00:00
Richard Smith
d2a7eda2b7 Fix reference to sysroot in this test (broken in r226875).
llvm-svn: 226885
2015-01-23 00:30:44 +00:00
Richard Smith
ac425e9165 PR22299: Relocate code for handling -fmodule-map-file= so that we don't try to
produce diagnostics with source locations before the diagnostics system is
ready for them.

llvm-svn: 226882
2015-01-23 00:01:13 +00:00
Simon Atanasyan
495523e4ea [Mips] Fix type of 64-bit integer in case of MIPS N64 ABI
Differential Revision: http://reviews.llvm.org/D7127

llvm-svn: 226877
2015-01-22 23:16:48 +00:00
Richard Smith
999500a26d Reorganize test/Modules:
* Put all input files under Inputs/, move corresponding tests into test/Modules.
 * Rename a modulemap test file to [...].modulemap, and teach lit that such files are tests.

llvm-svn: 226875
2015-01-22 23:07:47 +00:00
Hans Wennborg
b60dfbea0e Make the ?: precedence warning handle pointers to the left of ?
Previously, Clang would fail to warn on:

  int n = x + foo ? 1 : 2;

when foo is a pointer.

llvm-svn: 226870
2015-01-22 22:11:56 +00:00
Francisco Lopes da Silva
c6ccc4fe91 Sema: code completion for pointer and reference to functions.
llvm-svn: 226865
2015-01-22 21:14:08 +00:00
Joerg Sonnenberger
a43872ccdd When reporting constraints that should be constant, the type doesn't
really help. Improve diagnostics.

llvm-svn: 226863
2015-01-22 21:01:00 +00:00
Francisco Lopes da Silva
0ab906ce1c Sema: Add FIXME note
llvm-svn: 226813
2015-01-22 12:41:44 +00:00
Alexander Musman
df7a8e2bc8 Support ‘omp for’ with static chunked schedule kind.
Differential Revision: http://reviews.llvm.org/D7006

llvm-svn: 226795
2015-01-22 08:49:35 +00:00
Mohit K. Bhakkad
f4c47f62ac [MSan][Clang][MIPS] Enabled memory and dataflow options for MIPS64 platform
Reviewers: kcc, samsonov, petarj, eugenis
llvm-svn: 226790
2015-01-22 07:21:22 +00:00
Alexey Bataev
b57056f483 [OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".)
Differential Revision: http://reviews.llvm.org/D6431

llvm-svn: 226788
2015-01-22 06:17:56 +00:00
Alexey Bataev
02e1ec6966 Revert commit revision 226786
Need to add initialization of AtomicInfo::EvaluationKind field

llvm-svn: 226787
2015-01-22 06:09:48 +00:00
Alexey Bataev
92efdce503 [OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".)
Differential Revision: http://reviews.llvm.org/D6431

llvm-svn: 226786
2015-01-22 05:44:37 +00:00
Alexey Bataev
137421c8a9 Revert commit r226784.
Accidentally modified file SemaType.cpp must be restored to its original state. 

llvm-svn: 226785
2015-01-22 05:35:53 +00:00
Alexey Bataev
13c7c4930c [OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".
Differential Revision: http://reviews.llvm.org/D6431

llvm-svn: 226784
2015-01-22 05:29:28 +00:00
Francisco Lopes da Silva
36e1ddfd13 Makes a simple member function static.
This function has been just included with the initial support for C++
parameter completion and it's trivial enough to be a static member.

llvm-svn: 226780
2015-01-22 04:30:23 +00:00
Richard Smith
1b65dbc477 [modules] If we add an implicit special member to a class through an update
record, and that class declaration is not the canonical definition of the
class, be sure to add the class to the list of classes that are consulted when
we look up a special member in the canonical definition.

llvm-svn: 226778
2015-01-22 03:50:31 +00:00
Richard Smith
9ba845c2e6 Fix test file names so they're picked up by lit.
llvm-svn: 226776
2015-01-22 03:24:07 +00:00
Reid Kleckner
2a2e156318 SEH: Emit the constant filter 1 as a catch-all
Minor optimization of code like __try { ... } __except(1) { ... }.

llvm-svn: 226766
2015-01-22 02:25:56 +00:00
Richard Smith
f1f4bc2176 [modules] If we load two declarations with typedef names for linkage purposes
on top of a local declaration of the same entity, we still need to remember
that we loaded the first one or we may fail to merge the second one properly.

llvm-svn: 226765
2015-01-22 02:21:23 +00:00
Justin Bogner
00270df517 InstrProf: Avoid creating profile names for symbols in system headers
We don't emit any coverage mapping for uncovered functions that come
from system headers, but we were creating a GlobalVariable with each
of their names. This is wasteful since the linker will need to dead
strip the unused symbols, and it can lead to issues when merging
coverage with others TUs that do have coverage for those functions.

llvm-svn: 226764
2015-01-22 02:17:23 +00:00
Richard Smith
5156c38570 [modules] It's possible to merge into the pattern of a class template before we
load the definition data from the declaration itself. In that case, merge
properly; don't assume the prior definition is the same as our own.

llvm-svn: 226761
2015-01-22 01:41:56 +00:00
Reid Kleckner
1d59f99f5c Initial support for Win64 SEH IR emission
The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.

Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
  outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
  implemented.
- __finally blocks will not run after exceptions. Fixing this requires
  work in the LLVM SEH preparation pass.

The IR lowering looks like this:

// C code:
bool safe_div(int n, int d, int *r) {
  __try {
    *r = normal_div(n, d);
  } __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
    return false;
  }
  return true;
}

; LLVM IR:
define i32 @filter(i8* %e, i8* %fp) {
  %ehptrs = bitcast i8* %e to i32**
  %ehrec = load i32** %ehptrs
  %code = load i32* %ehrec
  %matches = icmp eq i32 %code, i32 u0xC0000094
  %matches.i32 = zext i1 %matches to i32
  ret i32 %matches.i32
}

define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) {
  %rr = invoke i32 @normal_div(i32 %n, i32 %d)
      to label %normal unwind to label %lpad

normal:
  store i32 %rr, i32* %r
  ret i1 1

lpad:
  %ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler
      catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*)
  %ehptr = extractvalue {i8*, i32} %ehvals, i32 0
  %sel = extractvalue {i8*, i32} %ehvals, i32 1
  %filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*))
  %matches = icmp eq i32 %sel, %filter_sel
  br i1 %matches, label %eh.except, label %eh.resume

eh.except:
  ret i1 false

eh.resume:
  resume
}

Reviewers: rjmccall, rsmith, majnemer

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

llvm-svn: 226760
2015-01-22 01:36:17 +00:00
Rafael Espindola
e855c2ae0a Revert "Try to fix -Asserts build bots."
This reverts commit r226758.

Looks like rnk's 226757 fixed the real issue.
Sorry for the noise.

llvm-svn: 226759
2015-01-22 01:33:41 +00:00
Rafael Espindola
b88c11281c Try to fix -Asserts build bots.
llvm-svn: 226758
2015-01-22 01:26:39 +00:00
Reid Kleckner
395dad8213 Give the block inlining test a triple to determinise output
It fails on Windows due to another temporary being emitted first, so the
LLVM internal renaming scheme gives out the name
__block_descriptor_tmp1.

llvm-svn: 226757
2015-01-22 01:19:19 +00:00
Richard Smith
855cbfddbe Remove an out-of-date and incorrect comment.
llvm-svn: 226756
2015-01-22 01:15:51 +00:00
Hans Wennborg
9cf7122ff7 Fix compiler_builtins.m test to not rely on including system stdlib.h and malloc.h
Importing _Builtin_intrinsics.sse and avx would transitively pull in those
headers, and the test would fail when building in an environment where
they were not available on the include path.

This fixes PR20995 for me.

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

llvm-svn: 226754
2015-01-22 00:45:20 +00:00
Rafael Espindola
e5df59ff78 Emit DeferredDeclsToEmit in a DFS order.
Currently we emit DeferredDeclsToEmit in reverse order. This patch changes that.

The advantages of the change are that

* The output order is a bit closer to the source order. The change to
test/CodeGenCXX/pod-member-memcpys.cpp is a good example.

* If we decide to deffer more, it will not cause as large changes in the
estcases as it would without this patch.

llvm-svn: 226751
2015-01-22 00:24:57 +00:00
Rafael Espindola
701d2dd4b7 Use CHECK-LABEL when possible. NFC.
llvm-svn: 226743
2015-01-21 23:33:55 +00:00
Chris Bieneman
0a9f607f7b Adopt new cl::HideUnrelatedOptions API added r226729.
Summary: cl::HideUnrelatedOptions allows tools to hide all options not part of a specific OptionCategory. This is the common use case for cl::getRegisteredOptions, which should be deprecated in the future because it exposes implementation details of command line parsing.

Reviewers: dexonsmith

Subscribers: klimek, cfe-commits

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

llvm-svn: 226741
2015-01-21 23:26:11 +00:00
David Blaikie
835afb205f DebugInfo: Remove forced column-info workaround for inlined calls
This workaround was to provide unique call sites to ensure LLVM's inline
debug info handling would properly unique two calls to the same function
on the same line. Instead, this has now been fixed in LLVM (r226736) and
the workaround here can be removed.

Originally committed in r176895, but this isn't a straight revert due to
all the changes since then. I just searched for anything ForcedColumn*
related and removed them.

We could test this - but it didn't strike me as terribly valuable once
we're no longer adding this workaround everything just works as expected
& it's no longer a special case to test for.

llvm-svn: 226738
2015-01-21 23:08:17 +00:00
David Blaikie
07c6bfd502 DebugInfo: Remove distinct-call-inlining test case as this is being fixed in LLVM.
This test will start failing shortly once this bug is fixed in LLVM. At
that point this behavior is no longer required in Clang and will be
removed. In the interim, remove this test just to avoid the race between
the LLVM and Clang commits.

After the LLVM commit, I'll cleanup the workaround behavior in Clang.

llvm-svn: 226735
2015-01-21 22:57:22 +00:00
Rafael Espindola
2144377536 Use a CHECK-LABEL. NFC
llvm-svn: 226709
2015-01-21 22:38:24 +00:00
Reid Kleckner
9da9448339 Add the "thunk" attribute to MS ABI virtual member pointers
This attribute implies indicates that the function musttail calls
another function and returns whatever it returns. The return type of the
thunk is meaningless, as the thunk can dynamically call different
functions with different return types. So long as the callers bitcast
the thunk with the correct type, behavior is well defined.

This attribute was necessary to fix PR20944, where the indirect call
combiner noticed that the thunk returned void and replaced the results
of the indirect call instruction with undef.

Over-the-shoulder reviewed by David Majnemer.

llvm-svn: 226707
2015-01-21 22:18:17 +00:00
Francisco Lopes da Silva
24a777238e Add back a FIXME note to lit.cfg.
llvm-svn: 226703
2015-01-21 21:38:05 +00:00
Daniel Jasper
e4b48c635c clang-format: Fix crasher when splitting incomplete escape sequences.
llvm-svn: 226698
2015-01-21 19:50:35 +00:00
Saleem Abdulrasool
97a01f0161 Fix isTriviallyCopyableType for arrays
Fix isTriviallyCopyableType for arrays. An array of type T is trivially copyable
if T is trivially copyable.

Patch by Agustín Bergé!

llvm-svn: 226696
2015-01-21 19:39:10 +00:00
Daniel Jasper
04b979dd81 clang-format: Fix crasher caused by incorrect resetting of token info.
llvm-svn: 226685
2015-01-21 18:35:47 +00:00
Daniel Jasper
d1debfc2bb clang-format: Fix bad memory access.
llvm-svn: 226680
2015-01-21 18:04:02 +00:00
Daniel Jasper
fd725c060b clang-format: Fix use-heap-after-free bug.
Discovered by the awesome test case and ASAN.

llvm-svn: 226678
2015-01-21 17:35:29 +00:00
Rafael Espindola
17c57ecf4a Used CHECK-DAG since the order is not important.
llvm-svn: 226677
2015-01-21 17:12:04 +00:00
Rafael Espindola
469e2ee83a Used CHECK-DAG since the order is not important.
llvm-svn: 226675
2015-01-21 16:56:43 +00:00
Francisco Lopes da Silva
975a9f6ece Initial support for C++ parameter completion
The improved completion in call context now works with:

 - Functions.
 - Member functions.
 - Constructors.
 - New expressions.
 - Function call expressions.
 - Template variants of the previous.

There are still rough edges to be fixed:

 - Provide support for optional parameters.         (fix known)
 - Provide support for member initializers.         (fix known)
 - Provide support for variadic template functions. (fix unknown)
 - Others?

llvm-svn: 226670
2015-01-21 16:24:11 +00:00
Rafael Espindola
11bb53bc77 Don't assume variable name.
Should fix the test in -Asserts builds.

llvm-svn: 226668
2015-01-21 16:18:42 +00:00
Rafael Espindola
e20c966cf4 Make the test a bit stricter. NFC.
llvm-svn: 226667
2015-01-21 16:13:57 +00:00
Rafael Espindola
3a0e228cca Make the test a bit stricter. NFC.
llvm-svn: 226666
2015-01-21 16:03:26 +00:00
Rafael Espindola
6d1178ca40 clang-format function. NFC.
llvm-svn: 226662
2015-01-21 14:55:00 +00:00
David Majnemer
475b25eefa AST: Don't ignore alignas on EnumDecls when calculating alignment
We didn't consider any alignment attributes on an EnumDecl when
calculating alignment.

While we are here, ignore alignment specifications on typedef types if
one is used as the underlying type.  Otherwise, weird things happen:

enum Y : int;
Y y;

typedef int __attribute__((aligned(64))) u;
enum Y : u {};

What is the alignment of 'Y'?  It would be more consistent with the
overall design of enums with fixed underlying types to consider the
underlying type's UnqualifiedDesugaredType.

This fixes PR22279.

llvm-svn: 226653
2015-01-21 10:54:38 +00:00
David Majnemer
290d347471 Revert "Sema: err_after_alias is unreachable, remove it"
This reverts commit r226626.  err_after_alias is, in fact, reachable.

llvm-svn: 226633
2015-01-21 01:30:40 +00:00
David Majnemer
8c9cdb6573 MS ABI: Virtual member pointer thunks should be in COMDAT groups
They can be emitted by multiple translation units and thus belong in a
COMDAT group.

llvm-svn: 226630
2015-01-21 01:21:31 +00:00
David Majnemer
3072fc885e MS ABI: Let guard variables be present in COMDATs
A guard variable in a COMDAT'd function should also be in a COMDAT.

llvm-svn: 226629
2015-01-21 01:04:30 +00:00
David Majnemer
740d59ec49 CodeGen: Compiler generated __declspec(uuid) objects should be COMDAT'd
llvm-svn: 226628
2015-01-21 01:04:28 +00:00
David Majnemer
1efd55ff21 Sema: err_after_alias is unreachable, remove it
Examples this would have catched are now handled by the attribute
verification code.

llvm-svn: 226626
2015-01-21 00:52:17 +00:00
Kaelyn Takata
21a886936b Correct all typos in the initialization arguments, even if one could not
be corrected.

This fixes PR22250, which exposed the bug where if there's more than one
TypoExpr in the arguments, once one failed to be corrected none of the
TypoExprs after it would be handled at all thanks to an early return.

llvm-svn: 226624
2015-01-21 00:04:19 +00:00
Rafael Espindola
e6fbdcedf9 Link libclang with dl if available.
This is in preparation for changing the link to use -Wl,-z,defs.

llvm-svn: 226609
2015-01-20 21:10:35 +00:00
Ben Langmuir
c91ac9ed49 Fix crashes on missing @interface for category
In a few places we didn't check that Category->getClassInterface() was
not null before using it.

llvm-svn: 226605
2015-01-20 20:41:36 +00:00
Kaelyn Takata
e7d3dfdb75 Add the test that was supposed to be included with r223162.
The test case is based on the reduction from PR21679 and has to be
freestanding to work correctly, since some of the expected errors (and
some of the problems that were fixed) only occur when the end of the
file is reached.

llvm-svn: 226603
2015-01-20 20:15:29 +00:00
Hans Wennborg
77dc236605 Implement command line options for stack probe space
This code adds the -mstack-probe-size command line option and implements the /Gs
compiler switch for clang-cl.

This should fix http://llvm.org/bugs/show_bug.cgi?id=21896

Patch by Andrew H!

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

llvm-svn: 226601
2015-01-20 19:45:50 +00:00
Fariborz Jahanian
86dd4565ec Patch fixes PR21932 crash on invalid code. Using
property-dot syntax on 'super' with no super
class. Patch by Jason Haslam.

llvm-svn: 226578
2015-01-20 16:53:34 +00:00
Daniel Jasper
6fd5d646cc clang-format: Fix AlwaysBreakBeforeMultilineStrings with ColumnLimit=0
Before:
  const char *x =
      "hello llvm";

After:
  const char *x = "hello llvm";

This fixes llvm.org/PR22245.
Patch by Bill Meltsner, thank you!

llvm-svn: 226564
2015-01-20 12:59:20 +00:00
Alexander Kornienko
21de0ae3d4 Re-apply "r226548 - Introduce SPIR calling conventions" reverted in r226558.
The test was fixed after a discussion with the revision author: the check
pattern was made more flexible as the "%call" part is not what we actually want
to check strictly there.

The original patch description:
===
Introduce SPIR calling conventions.

This implements Section 3.7 from the SPIR 1.2 spec:

    SPIR kernels should use "spir_kernel" calling convention.
    Non-kernel functions use "spir_func" calling convention. All
    other calling conventions are disallowed.

The patch works only for OpenCL source. Any other uses will need
to ensure that kernels are assigned the spir_kernel calling
convention correctly.
===

llvm-svn: 226561
2015-01-20 11:20:41 +00:00
Alexander Kornienko
22c9d67e34 Reverting r226548 as one of the tests fails in some configurations.
Here's the fail log from our internal setup:
===
  .../tools/clang/clang -cc1 -internal-isystem .../tools/clang/staging/include -nostdsysteminc .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl -triple spir-unknown-unknown -emit-llvm -o -
  FileCheck .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl
.../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl:11:12: error: expected string not found in input
 // CHECK: %call = tail call spir_func i32 @get_dummy_id(i32 0)
           ^
<stdin>:6:52: note: scanning from here
define spir_kernel void @foo(i32 addrspace(1)* %A) #0 {
                                                   ^
<stdin>:7:2: note: possible intended match here
 %1 = tail call spir_func i32 @get_dummy_id(i32 0) #2
 ^
===

Here's a failure on a public CI server:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/1183/

llvm-svn: 226558
2015-01-20 10:55:33 +00:00