Commit Graph

57107 Commits

Author SHA1 Message Date
NAKAMURA Takumi 472041f027 Whitespace.
llvm-svn: 230475
2015-02-25 10:32:20 +00:00
NAKAMURA Takumi a2acc360ed Revert r230446, "MS ABI: Try to respect external AST source record layouts"
It fails on Clang::PCH/headersearch.cpp for targeting msvc.

llvm-svn: 230474
2015-02-25 10:32:13 +00:00
Daniel Jasper 1c22048834 clang-format: Fix spacing for function with ref-qualification ..
.. when using SpacesInCStyleCastParentheses != SpacesInParentheses.

Before:
  FormatStyle Spaces = getLLVMStyle();
  Deleted &operator=(const Deleted &)& = default;

  Spaces.SpacesInParentheses = true;
  Deleted(const Deleted &)& = default;

  Spaces.SpacesInCStyleCastParentheses = true;
  Spaces.SpacesInParentheses= false;
  Deleted( const Deleted & )& = default;

After:
  FormatStyle Spaces = getLLVMStyle();
  Deleted &operator=(const Deleted &)& = default;;

  Spaces.SpacesInParentheses= true;
  Deleted( const Deleted & )& = default;

  Spaces.SpacesInCStyleCastParentheses = true;
  Spaces.SpacesInParentheses= false;
  Deleted(const Deleted &)& = default;

Patch by Jean-Philippe Dufraigne. Thank you!

llvm-svn: 230473
2015-02-25 10:30:06 +00:00
Daniel Jasper cd94c40b10 Revert "Produce less broken basic block sequences for __finally blocks."
The test is broken on buildbots:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/2279/

This reverts commit adda738b6dc533c42db5f5f5b31344098a3aba7d.

llvm-svn: 230472
2015-02-25 10:07:14 +00:00
Alexey Bataev 3eff5f46d7 [OPENMP] Rename methods of OpenMPRuntime class. NFC.
llvm-svn: 230470
2015-02-25 08:32:46 +00:00
Simon Atanasyan 3f02403b3a [Mips] Support mips-r6 path suffix for Adnroid MIPS toolchain
This path suffix is used if user provides the -mips32r6 command line
options.

llvm-svn: 230469
2015-02-25 07:31:12 +00:00
Sameer Sahasrabuddhe a75db66eee Restores r228382, which was reverted in r228406.
The original commit failed to handle "shift assign" (<<=), which
broke the test mentioned in r228406. This is now fixed and the
test added to the lit tests under SemaOpenCL.

*** Original commit message from r228382 ***

OpenCL: handle shift operator with vector operands

Introduce a number of checks:
1. If LHS is a scalar, then RHS cannot be a vector.
2. Operands must be of integer type.
3. If both are vectors, then the number of elements must match.

Relax the requirement for "usual arithmetic conversions":
When LHS is a vector, a scalar RHS can simply be expanded into a
vector; OpenCL does not require that its rank be lower than the LHS.
For example, the following code is not an error even if the implicit
type of the constant literal is "int".

  char2 foo(char2 v) { return v << 1; }

Consolidate existing tests under CodeGenOpenCL, and add more tests
under SemaOpenCL.

llvm-svn: 230464
2015-02-25 05:48:23 +00:00
Nico Weber 795bd2d411 Produce less broken basic block sequences for __finally blocks.
The way cleanups (such as PerformSEHFinally) get emitted is that codegen
generates some initialization code, then calls the cleanup's Emit() with the
insertion point set to a good place, then the cleanup is supposed to emit its
stuff, and then codegen might tack in a jump or similar to where the insertion
point is after the cleanup.

The PerformSEHFinally cleanup tries to just stash away the block it's supposed
to codegen into, and then does codegen later, into that stashed block.  However,
after codegen'ing the __finally block, it used to set the insertion point to
the finally's continuation block (where the __finally cleanup goes when its body
is completed after regular, non-exceptional control flow).  That's not correct,
as that block can (and generally does) already ends in a jump.  Instead,
remember the insertion point that was current before the __finally got emitted,
and restore that.

Fixes two of the crashes in PR22553.

llvm-svn: 230460
2015-02-25 04:05:18 +00:00
Nico Weber ebf9a058c6 Add comments for two CleanupKinds.
llvm-svn: 230459
2015-02-25 03:58:36 +00:00
Peter Collingbourne 03054d489e docs: Document optimizations in control flow integrity design doc.
llvm-svn: 230458
2015-02-25 03:35:03 +00:00
Adrian Prantl cbc368c5b5 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
llvm-svn: 230454
2015-02-25 02:44:04 +00:00
Adrian Prantl 7153ce8a06 Revert "Add a missing target requirement."
llvm-svn: 230453
2015-02-25 02:43:38 +00:00
Reid Kleckner b20cd673ff Fix bots failing on an explicit triple
Why do we need a registered target for this?

llvm-svn: 230450
2015-02-25 02:32:00 +00:00
Nico Weber fc3fe4f0a1 Don't crash on missing '{' after __except or __finally, PR22687.
Also add some general test/Parser coverage for SEH blocks.

llvm-svn: 230449
2015-02-25 02:22:06 +00:00
Reid Kleckner 64b04b9bdf Reland r230314 "Fix codegen for virtual methods that are (re-) exported from multiple modules."
This reverts the revert from commit r230406.

The changes in r230445 and r230446 make the test pass on Windows now.

llvm-svn: 230448
2015-02-25 02:19:56 +00:00
Reid Kleckner 7706f6a97b MS ABI: Add triple to test relying on key functions
llvm-svn: 230447
2015-02-25 02:16:15 +00:00
Reid Kleckner 3990db79c5 MS ABI: Try to respect external AST source record layouts
Covered by existing tests in test/CodeGen/override-layout.c and
test/CodeGenCXX/override-layout.cpp. Seriously, they found real bugs in
my code. :)

llvm-svn: 230446
2015-02-25 02:16:09 +00:00
Reid Kleckner 240ef5708e Add missing MD canonicalization to MS vtable builder
llvm-svn: 230445
2015-02-25 02:16:02 +00:00
Adrian Prantl 38beb0abc5 Add a missing target requirement.
llvm-svn: 230429
2015-02-25 01:52:05 +00:00
Richard Smith c4c34e2722 Remove slow and apparently pointless updating of all identifiers at the start
of writing out an AST file.

llvm-svn: 230428
2015-02-25 01:45:32 +00:00
Nico Weber dd25674a40 Fold ParseSEHTryBlockCommon() into its only caller. No behavior change.
ParseCXXTryBlockCommon() makes sense because it has two callers due to
function try blocks.  There are no SEH function try blocks.

llvm-svn: 230426
2015-02-25 01:43:27 +00:00
Adrian Prantl 8bf7af3de8 Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

This reapplies r230044 with a fixed configure+make build and updated
dependencies and testcase requirements. Over the last iteration this
version adds
- missing target requirements for testcases that specify an x86 triple,
- a missing clangCodeGen.a dependency to libClang.a in the make build.

rdar://problem/19104245

llvm-svn: 230423
2015-02-25 01:31:45 +00:00
Richard Smith c89bb9dd51 Make RedeclarableResult's ownership-transferring constructor be a move
constructor.

llvm-svn: 230417
2015-02-25 01:11:29 +00:00
Richard Smith 5638c1146e [modules] Fix a bug that would result in a build with P paths through a module
graph with M modules to take O(P) time, not just O(M) time, when using explicit
module builds.

llvm-svn: 230412
2015-02-25 00:56:02 +00:00
NAKAMURA Takumi e976aab1df Revert r230314, "Fix codegen for virtual methods that are (re-) exported from multiple modules."
It crashes for targeting (i686|x86_64)-win32.

  clang: clang/lib/AST/VTableBuilder.cpp:142: {anonymous}::FinalOverriders::OverriderInfo {anonymous}::FinalOverriders::getOverrider(const clang::CXXMethodDecl*, clang::CharUnits) const: Assertion `OverridersMap.count(std::make_pair(MD, BaseOffset)) && "Did not find overrider!"' failed.

llvm-svn: 230406
2015-02-25 00:18:22 +00:00
Jacques Pienaar 411b251cea clang-format: Change location of stashed token
Commit of patch in http://reviews.llvm.org/D7871

llvm-svn: 230395
2015-02-24 23:23:24 +00:00
Justin Bogner f07e34e9d8 InstrProf: Simplify a couple of tests after r230383
Most of the checks in these two tests were actually testing the
behaviour of the instrprof LLVM pass. Now that we're testing that
specifically in LLVM's test suite, it's better if we only test the
frontend's behaviour here.

llvm-svn: 230387
2015-02-24 21:49:28 +00:00
Jacques Pienaar a50178c23e CUDA: Add option to allow host device functions to call host functions
Commiting code from review http://reviews.llvm.org/D7841

llvm-svn: 230385
2015-02-24 21:45:33 +00:00
Richard Smith 7c9442a6ae PR22673 again: diagnose use of the used decl, not the found decl. This is also
wrong (DiagnoseUseOfDecl should take both), but it's more consistent with what
we do in other places.

llvm-svn: 230384
2015-02-24 21:44:43 +00:00
Richard Smith d3f2d321d7 PR22673: Don't forget to check a constructor for deletedness when we use it to
implicitly construct a temporary in a reference binding.

llvm-svn: 230381
2015-02-24 21:16:19 +00:00
Richard Smith 589cab5efb Add test that we reject invocations of deleted constructors. One of these
constructs is not rejected by should be; that's PR22673.

llvm-svn: 230370
2015-02-24 20:41:36 +00:00
Reid Kleckner 85c7e0a3f3 MS extensions: Properly diagnose address of MS property decl
Summary: Fixes PR22671.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 230362
2015-02-24 20:29:40 +00:00
Tim Northover bc784d1caa ARM: Simplify PCS handling.
The backend should now be able to handle all AAPCS rules based on argument
type, which means Clang no longer has to duplicate the register-counting logic
and the CodeGen can be significantly simplified.

llvm-svn: 230349
2015-02-24 17:22:40 +00:00
Michael Wong 867eeb5861 Commit patch for PR19649. Set the correct sign of wide character for literals based on underlying type of wchar_t.
Reviewed:
http://reviews.llvm.org/D7559
Patch by Rachel Craig; Test cases by Hubert Tong.

llvm-svn: 230333
2015-02-24 13:34:20 +00:00
Alexey Bataev d76df6d0ff [OPENMP] Update codegen for 'omp flush' directive.
__kmpc_omp_flush() runtime library now has only one argument and is not a vararg
anymore. This update makes the codegen compatible with these changes.

llvm-svn: 230331
2015-02-24 12:55:09 +00:00
Michael Kuperstein 4f818708a8 [WinX86_64 ABI] Treat C99 _Complex as a struct
MSVC does not support C99 _Complex.
ICC, however, does support it on windows x86_64, and treats it, for purposes of parameter passing, as equivalent to a struct containing two fields (for the real and imaginary part). 

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

llvm-svn: 230315
2015-02-24 09:35:58 +00:00
Manuel Klimek 7906f139c3 Fix codegen for virtual methods that are (re-) exported from multiple modules.
Fixes multiple crashes where a non-canonical decl would be used as key
in a lookup.

llvm-svn: 230314
2015-02-24 09:06:28 +00:00
Adrian Prantl a39924a1f8 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit r230305.
Off to fix another round of missing dependencies on various platforms.

llvm-svn: 230309
2015-02-24 05:14:17 +00:00
Ben Langmuir 1f6a32b3e7 Don't load Framework module.map files when searching subdirectories
This would cause frameworks to have spurious "redefinition" errors if
they had both a (legacy) "module.map" and a (new) "module.modulemap" file and we
happened to do a sub-directory search in that directory using a
non-framework include path (e.g. -Ifoo/ -Ffoo/).  For migration
purposes it's very handy that the compiler will prefer the new spelling
of the filename and not look at the old one if it doesn't need to.

llvm-svn: 230308
2015-02-24 04:58:15 +00:00
Adrian Prantl fc360dc30b Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

rdar://problem/19104245

This reapplies r230044 with a fixed configure+make build and updated
dependencies. Take 3.

llvm-svn: 230305
2015-02-24 04:25:59 +00:00
Justin Bogner c109102ecb InstrProf: Make sure counts in lambdas don't escape to the parent scope
When generating coverage maps, we were traversing the body as if it
were part of the parent function, but this doesn't make sense since
we're currently counting lambdas as separate functions.

llvm-svn: 230304
2015-02-24 04:13:56 +00:00
Richard Smith 7d7dee753d [modules] Properly check whether a declaration is std::initializer_list. This
bug is not actually modules-specific, but it's a little tricky to tickle it
outside of modules builds, so submitting with the reduced testcase I have.

llvm-svn: 230303
2015-02-24 03:30:14 +00:00
Richard Smith e3536dda40 [modules] Ensure we've imported all declarations of a template before
attempting to lazily deserialize its specializations; otherwise, there might be
pending specializations that we don't know about yet.

llvm-svn: 230301
2015-02-24 02:44:23 +00:00
Richard Smith e977e51d71 Refactor *TemplateDecl::addSpecialization to reduce duplication and add some
more asserts.

llvm-svn: 230296
2015-02-24 01:23:23 +00:00
Peter Collingbourne 4794190d81 CodeGenModule::EmitVTableBitSetEntries: Add check for identical bit set entries.
No two elements of this array should be the same, but the standard library
may pass the same element as both arguments to this function.

llvm-svn: 230293
2015-02-24 01:12:53 +00:00
Dmitri Gribenko a586ea13a4 Restore the libc++ definition of max_align_t on Apple platforms
Clang has introduced ::max_align_t in stddef.h in r201729, but libc++ was
already defining std::max_align_t on Darwin because there was none in the
global namespace.  After that Clang commit though, libc++ started defining
std::max_align_t to be a typedef for ::max_align_t, which has a different
definition.  This changed the ABI.  This commit restores the previous
definition.

rdar://19919394 rdar://18557982

llvm-svn: 230292
2015-02-24 01:06:22 +00:00
Justin Bogner d26f95bc94 Revert "Improve declaration / expression disambiguation around ptr-operators, and use"
This seems to break mixing function-style and c-style casts, and is
breaking bootstrapping llvm.

This reverts r230261.

llvm-svn: 230274
2015-02-23 22:36:28 +00:00
Dmitri Gribenko 78a38c9f6d Fix copy-paste errors in the test
llvm-svn: 230272
2015-02-23 22:08:10 +00:00
Richard Smith 152a172899 Improve declaration / expression disambiguation around ptr-operators, and use
the presence of an abstract declarator with a ptr-operator as proof that a
construct cannot parse as an expression to improve diagnostics along error
recovery paths.

llvm-svn: 230261
2015-02-23 21:16:05 +00:00
Joerg Sonnenberger 096feeb741 Only lower __builtin_setjmp / __builtin_longjmp to
llvm.eh.sjlj.setjmp / llvm.eh.sjlj.longjmp, if the backend is known to
support them outside the Exception Handling context. The default
handling in LLVM codegen doesn't work and will create incorrect code.
The ARM backend on the other hand will assert if the intrinsics are
used.

llvm-svn: 230255
2015-02-23 20:23:47 +00:00
Peter Collingbourne 0100e6c08c CFI: Improve design doc with larger virtual tables and asm examples.
llvm-svn: 230254
2015-02-23 20:22:17 +00:00
Zoran Jovanovic 5e7483a4c1 Fixed typo.
llvm-svn: 230253
2015-02-23 20:20:49 +00:00
Justin Bogner e4ca441a65 InstrProf: Run clang-format to fix some strange indentation (NFC)
Somehow this file ended up with a strange hybrid of the old "indent
inside a namespace" style and the new "don't", giving us a wonderful
two-space indent starting halfway through a namespace. Fix it.

llvm-svn: 230244
2015-02-23 19:27:00 +00:00
Reid Kleckner c4da9c8e50 -fms-extensions: Bump the default _MSC_VER from 1700 to 1800, aka VS2013
VS 2013 is the minimum supported version, so it's reasonable for Clang
to simulate this by default. This also simplifies the clang-cl
self-host, since we have the 18.00 version check.

llvm-svn: 230243
2015-02-23 19:25:48 +00:00
Mohit K. Bhakkad 69963e72f3 [TSan][Clang][MIPS] Enabled thread option for MIPS64 platform
Reviewers: kcc, samsonov, petarj, eugenis

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

llvm-svn: 230209
2015-02-23 09:32:35 +00:00
Ed Schouten 4992099b42 Add C11 *_DECIMAL_DIG.
Before C11 there was only the DECIMAL_DIG definition. As of C11, we now
have one definition per floating point type (e.g. DBL_DECIMAL_DIG).
Change the existing code to define the new versions. To remain backward
compatible, define __DECIMAL_DIG__ as __LDBL_DECIMAL_DIG__.

Also update the tests. It seems that some of the existing test vectors
were incorrect. Change all tests for __DECIMAL_DIG__ to expect
__LDBL_DECIMAL_DIG__. Add tests for *_DECIMAL_DIG for FreeBSD/amd64, as
I happen to have such a system laying around. I've validated that the
values are in sync with <float.h>.

llvm-svn: 230207
2015-02-23 09:12:31 +00:00
Nico Weber 6c4f606c08 Remove comment addressed by d0k in r229327.
llvm-svn: 230199
2015-02-23 02:23:19 +00:00
Larisse Voufo a65298af65 Relax the requirement on sized deallocation a bit: Default on unsized delete if sized delete is not provided in global scope, and -fdefine-sized-deallocation option is disabled.
llvm-svn: 230160
2015-02-22 06:36:53 +00:00
Larisse Voufo 01c97c0860 Fix typo.
llvm-svn: 230159
2015-02-22 06:36:49 +00:00
Larisse Voufo 0d0237f6cb Move -fdefine-sized-deallocation and -fno-sized-deallocation options from driver into CC1 for now.
llvm-svn: 230158
2015-02-22 06:36:46 +00:00
Nico Weber 805747956b Remove two unused methods. No behavior change.
llvm-svn: 230152
2015-02-22 00:27:32 +00:00
Richard Smith cf4bdde33a Cleanup: remove artificial division between lookup results and const lookup
results. No-one was ever modifying a lookup result, and it would not be
reasonable to do so.

llvm-svn: 230123
2015-02-21 02:45:19 +00:00
Richard Smith 40c7806451 Revert r167816 and replace it with a proper fix for the issue: do not
invalidate lookup_iterators and lookup_results for some name within a
DeclContext if the lookup results for a *different* name change.

llvm-svn: 230121
2015-02-21 02:31:57 +00:00
Hans Wennborg 5870373d19 Improve diagnostic when failing to synthesize implicit member due to dllexport (PR22591)
This is only a problem in C++03 mode targeting MS ABI (MinGW doesn't
export inline methods, and C++11 marks these methods implicitly
deleted).

Since targeting the MS ABI in pre-C++11 mode is a rare configuration,
this will probably not get fixed, but we can at least have a better
error message.

llvm-svn: 230115
2015-02-21 01:07:24 +00:00
Larisse Voufo 2e5c25ac77 Fix typo.
llvm-svn: 230114
2015-02-21 01:05:29 +00:00
Larisse Voufo dcc0eddd18 Move -fdefine-sized-deallocation and -fno-sized-deallocation options from driver into CC1 for now.
llvm-svn: 230112
2015-02-21 01:03:48 +00:00
Fariborz Jahanian f8dce0fec2 [Objective-C]. Provide a new formatting kind, "os_trace" which
can take a "const char*" format but supports standard printf 
and CF/NS types . rdar://19904147

llvm-svn: 230109
2015-02-21 00:45:58 +00:00
Adrian Prantl 67fbfa3773 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit 230099.

The Linux configure+make build variant still needs some work.

llvm-svn: 230103
2015-02-21 00:29:14 +00:00
Adrian Prantl 6572faa1eb configure+make: Rearange clangCodeGen to come before clangAST.
Follow-up to r230089.

llvm-svn: 230099
2015-02-21 00:15:40 +00:00
Adrian Prantl a05c7f876b configure+make: Add ipo to the dependencies of libclang.
Follow-up to r230089.

llvm-svn: 230096
2015-02-21 00:04:15 +00:00
Simon Atanasyan 162feb5f8e [Mips] Support mips32r3, mips32r5, mips64r3, mips64r5 MIPS ISA names
The patch teaches the clang's driver to understand new MIPS ISA names,
pass appropriate options to the assembler, defines corresponding macros etc

http://reviews.llvm.org/D7737

llvm-svn: 230092
2015-02-20 23:37:40 +00:00
Adrian Prantl f2b0cd91eb Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

rdar://problem/19104245

This reapplies r230044 with a fixed configure+make build and updated
dependencies. Take 2.

llvm-svn: 230089
2015-02-20 23:34:26 +00:00
Adrian Prantl 690b2f7746 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit r230067.

Investigating another batch of problems found by the bots.

llvm-svn: 230073
2015-02-20 22:12:19 +00:00
Adrian Prantl b59bc1a528 Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

rdar://problem/19104245

This reapplies r230044 with a fixed configure+make build and updated
dependencies.

llvm-svn: 230067
2015-02-20 21:53:12 +00:00
Ben Langmuir bc35fbe43a Don't try to rebuild modules on umbrella header mismatch
There are two issues here:
1) It's too late to rebuild at this point, because we won't go through
removeModules and when we try to reload the new .pcm we'll get the old
one instead.  We might be able to call removeModules after an OutOfDate
here, but I'm not yet confident that it is always safe to do so.

2) In practice, this check fails spuriously when the umbrella header
appears to change because of a VFS change that means it maps to a
different copy of the same file.  Because of this, we just skip the
check for now.

llvm-svn: 230064
2015-02-20 21:46:39 +00:00
Jacques Pienaar 68a7dbf86d Fix merging of << at end of input.
Commit of review http://reviews.llvm.org/D7766

llvm-svn: 230061
2015-02-20 21:09:01 +00:00
Peter Collingbourne a4ccff3281 Implement Control Flow Integrity for virtual calls.
This patch introduces the -fsanitize=cfi-vptr flag, which enables a control
flow integrity scheme that checks that virtual calls take place using a vptr of
the correct dynamic type. More details in the new docs/ControlFlowIntegrity.rst
file.

It also introduces the -fsanitize=cfi flag, which is currently a synonym for
-fsanitize=cfi-vptr, but will eventually cover all CFI checks implemented
in Clang.

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

llvm-svn: 230055
2015-02-20 20:30:56 +00:00
Adrian Prantl a4f522fa19 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit r230044 while dealing with buildbot breakage.

Conflicts:
	test/Modules/module_container.m

llvm-svn: 230052
2015-02-20 20:00:27 +00:00
Adrian Prantl fed81aa685 Require a target for this testacse.
llvm-svn: 230048
2015-02-20 19:52:43 +00:00
Adrian Prantl c4091aa74e Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

rdar://problem/19104245

llvm-svn: 230044
2015-02-20 19:44:52 +00:00
Rafael Espindola 6b07a1c6ee Add -funique-section-names and -fno-unique-section-names options.
For now -funique-section-names is the default, so no change in default behavior.

The total .o size in a build of llvm and clang goes from 241687775 to 230649031
bytes if -fno-unique-section-names is used.

llvm-svn: 230031
2015-02-20 18:08:57 +00:00
Daniel Jasper a0ef4f36c8 clang-format: [js] Support template strings.
Merge template strings (marked by backticks ``).
Do not format any contents of template strings.

Patch by Martin Probst. Thank you.

llvm-svn: 230011
2015-02-20 13:47:38 +00:00
Manuel Klimek d2e8b04d61 Add -fno-implicit-modules.
If this flag is set, we error out when a module build is required. This is
useful in environments where all required modules are passed via -fmodule-file.

llvm-svn: 230006
2015-02-20 11:44:41 +00:00
Richard Smith ed563c27fe PR22435: Correctly implement tiebreaker for reference ordering in function
template partial ordering rules. This rule applies per pair of types being
compared, not per pair of function templates being compared.

llvm-svn: 229965
2015-02-20 04:45:22 +00:00
Larisse Voufo 89088232b2 Add -fno-sized-deallocation option for completeness of fix in r229241 in documentation in r229818.
llvm-svn: 229950
2015-02-20 02:07:22 +00:00
Jordan Rose 000bac5e17 [analyzer] RetainCountChecker: don't try to track ivars known to be nil.
We expect in general that any nil value has no retain count information
associated with it; violating this results in unexpected state unification
/later/ when we decide to throw the information away. Unexpectedly caching
out can lead to an assertion failure or crash.

rdar://problem/19862648

llvm-svn: 229934
2015-02-19 23:57:04 +00:00
Hans Wennborg 97cbed422c Don't dllexport inline methods when targeting MinGW.
MinGW neither imports nor exports such methods. The import bit was
committed earlier, in r221154, and this takes care of the export part.

This also partially fixes PR22591.

llvm-svn: 229922
2015-02-19 22:39:24 +00:00
Dimitry Andric 6b5ed34a40 Add support for analyzing FreeBSD kernel printf extensions.
This adds a new __freebsd_kprintf__ format string type, which enables
checking when used in __attribute__((format(...))) attributes.  It can
check the FreeBSD kernel specific %b, %D, %r and %y specifiers, using
existing diagnostic messages.  Also adds test cases for all these
specifiers.

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

llvm-svn: 229921
2015-02-19 22:32:33 +00:00
Fariborz Jahanian 4019c7f747 [Objective-C Sema]. Don't warn about use of
property accessors in @selector not implemented 
because they will be auto-synthesized. rdar://16607480

llvm-svn: 229919
2015-02-19 21:52:41 +00:00
David Majnemer 67a8ec6258 Itanium ABI: Pack expansions change the arity of expressions to unknown
llvm-svn: 229918
2015-02-19 21:41:48 +00:00
Reid Kleckner 4343922dde Avoid using a COMDAT for sized delete on MachO
llvm-svn: 229915
2015-02-19 21:13:45 +00:00
Reid Kleckner 66abf2f92f Put the implicit weak sized deallocation funciton in C++14 in a comdat
Fixes PR22635.

llvm-svn: 229913
2015-02-19 21:01:34 +00:00
Ben Langmuir d89dc561c7 Revert "Mangle the IsSystem bit into the .pcm file name"
While I investigate some possible problems with this patch.

This reverts commit r228966

llvm-svn: 229910
2015-02-19 20:23:22 +00:00
Argyrios Kyrtzidis bd0b651bd2 [PCH/Modules] Check that the specific module cache path the PCH was built with, is the same as
the one in the current compiler invocation. If they differ reject the PCH.

This protects against the badness occurring from getting modules loaded from different module caches (see crashes).

rdar://19889860

llvm-svn: 229909
2015-02-19 20:12:20 +00:00
David Majnemer f63bcaa2c5 CodeGen: Weak reference temporaries belong in a COMDAT
llvm-svn: 229902
2015-02-19 19:35:18 +00:00
David Majnemer c9a9c7a673 CodeGen: static constexpr data members should have a linkonce_odr init
Classes can be defined in multiple translation units.  This means that
the static constexpr data members should have identical initializers in
all translation units.  Implement this by giving the reference temporary
linkonce_odr linkage.

llvm-svn: 229900
2015-02-19 19:25:17 +00:00
Filipe Cabecinhas d74002965e Make the _mm256_insert_epi64 definition more consistent
Use long long for the epi64 argument, like the other intrinsics.
NFC since this is only defined in 64-bit mode, not in 32-bit.

Fix suggested by H. J. Lu!

llvm-svn: 229886
2015-02-19 19:00:33 +00:00
Daniel Jasper fca735cd58 clang-format: [js] Support ES6 module exports.
Patch by Martin Probst, thank you!

llvm-svn: 229865
2015-02-19 16:14:18 +00:00
Daniel Jasper 354aa51587 clang-format: [js] Support ES6 module imports.
Patch by Martin Probst.

llvm-svn: 229863
2015-02-19 16:07:32 +00:00
Daniel Jasper 6fa9ec7885 clang-format: [js] Do not fall through for JS structural elements.
Patch by Martin Probst. Thank you.

llvm-svn: 229862
2015-02-19 16:03:16 +00:00
Nathan Sidwell 5bb231c279 FIX PR 18432, default args, friends & late-parsed members.
Sema::MergeCXXFunctionDecl: propagate hasUnparsedDefaultArg to new decl.

Parser::HandleMemberFunctionDeclDelays: check hasUnparsedDefaultArg
flag.

Parser::ParseLexedMethodDeclaration: handle inherited unparsed default
arg case.

llvm-svn: 229852
2015-02-19 14:03:22 +00:00
Anton Yartsev 5b5c7cec08 [analyzer] Different handling of alloca().
+ separate bug report for "Free alloca()" error to be able to customize checkers responsible for this error.
+ Muted "Free alloca()" error for NewDelete checker that is not responsible for c-allocated memory, turned on for unix.MismatchedDeallocator checker.
+ RefState for alloca() - to be able to detect usage of zero-allocated memory by upcoming ZeroAllocDereference checker.
+ AF_Alloca family to handle alloca() consistently - keep proper family in RefState, handle 'alloca' by getCheckIfTracked() facility, etc.
+ extra tests.

llvm-svn: 229850
2015-02-19 13:36:20 +00:00
Yaron Keren bc5986fe6a Spelling correction.
llvm-svn: 229839
2015-02-19 11:21:11 +00:00
Daniel Jasper 22a3e79aaf Make -fmodules-decluse and -fmodules-strict-decluse compatible options.
They don't actually influence the result of the module compilation.

llvm-svn: 229834
2015-02-19 09:56:13 +00:00
David Majnemer 12d3783add Mark DR1940 as implemented
llvm-svn: 229829
2015-02-19 07:29:01 +00:00
David Majnemer 6440548434 Mark DR1947 as implemented
llvm-svn: 229828
2015-02-19 07:28:57 +00:00
David Majnemer 7da2302780 Mark DR1948 as implemented
llvm-svn: 229827
2015-02-19 07:28:55 +00:00
David Majnemer 54dc82e1d2 Mark DR1994 as a duplicate of DR529
llvm-svn: 229826
2015-02-19 07:28:52 +00:00
David Majnemer 2dbad01349 Mark DR1968 as implemented
llvm-svn: 229825
2015-02-19 07:28:49 +00:00
NAKAMURA Takumi 8f2085ed16 CXXNameMangler::mangleUnresolvedPrefix(): Prune an obsolete \param, according to r229809. [-Wdocumentation]
llvm-svn: 229823
2015-02-19 07:14:26 +00:00
David Majnemer cb34c67c2a Itanium ABI: Don't pass nullptr to a bool argument
llvm-svn: 229822
2015-02-19 05:51:14 +00:00
Larisse Voufo ee3c1b2a71 Update C++ implementation status page with recent changes w.r.t. to sized deallocation.
llvm-svn: 229818
2015-02-19 04:34:13 +00:00
Alexey Bataev 054829b1bd [MSVC] Improved lookup into dependent/non-dependent bases of dependent class
Patch improves lookup into dependendt bases of dependent class and adds lookup
into non-dependent bases.
Differential Revision: http://reviews.llvm.org/D7173

llvm-svn: 229817
2015-02-19 04:28:23 +00:00
Ben Langmuir 07236733be Revert adding hostname to module hash
I didn't realize how easily the hostname could change - for example just
changing wireless networks seems to prompt it in some cases.

Users can always set their own local module cache path to avoid this.

This reverts commits r228592, 228594, 228601 and 228613.
rdar://19287368

llvm-svn: 229815
2015-02-19 04:03:57 +00:00
Justin Bogner 91f2e3c9c2 InstrProf: Always emit a coverage region for the condition of an if
When tools like llvm-cov show regions, it's much easier to understand
what's happening if the condition of an if shows a counter as well as
the body.

llvm-svn: 229813
2015-02-19 03:10:30 +00:00
Larisse Voufo 62d8aa5caf Fix a test case.
llvm-svn: 229812
2015-02-19 03:03:23 +00:00
Filipe Cabecinhas 54a2ba8b76 [Headers] Add tests for _mm256_insert_epi64 and fix its definition
Summary:
The definition for _mm256_insert_epi64 was taking an int, which would get
truncated before being inserted in the vector.

Original patch by Joshua Magee!

Reviewers: bruno, craig.topper

Subscribers: cfe-commits

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

llvm-svn: 229811
2015-02-19 03:02:33 +00:00
David Majnemer b8014dd7c0 Itanium ABI: Properly qualify the destructor-name
We didn't have enough qualificaiton before the scope specifier and we
had too much qualification in the destructor name itself.

llvm-svn: 229809
2015-02-19 02:16:16 +00:00
Filipe Cabecinhas ec5d0e6423 Improve our handling of rtti/sanitize=vptr/sanitize=undefined
This patch removes the huge blob of code that is dealing with
rtti/exceptions/sanitizers and replaces it with:

A ToolChain function which, for a given set of Args, figures out if rtti
should be:
  - enabled
  - disabled implicitly
  - disabled explicitly

A change in the way SanitizerArgs figures out what sanitizers to enable
(or if it should error out, or warn);

And a check for exceptions/rtti interaction inside addExceptionArgs.

The RTTIMode algorithm is:
  - If -mkernel, -fapple-kext, or -fno-rtti are passed, rtti was disabled explicitly;
  - If -frtti was passed or we're not targetting the PS4, rtti is enabled;
  - If -fexceptions or -fcxx-exceptions was passed and we're targetting
    the PS4, rtti was enabled implicitly;
  - If we're targetting the PS4, rtti is disabled implicitly;
  - Otherwise, rtti is enabled;

Since the only flag needed to pass to -cc1 is -fno-rtti if we want to
disable it, there's no problem in saying rtti is enabled if we're
compiling C code, so we don't look at the input file type.

addExceptionArgs now looks at the RTTIMode and warns that rtti is being
enabled implicitly if targetting the PS4 and exceptions are on. It also
errors out if, targetting the PS4, -fno-rtti was passed, and exceptions
were turned on.

SanitizerArgs now errors out if rtti was disabled explicitly and the vptr
sanitizer was enabled implicitly, but just turns off vptr if rtti is
disabled but -fsanitize=undefined was passed.

Also fixed tests, removed duplicate name from addExceptionArgs comment,
and added one or two surrounding lines when running clang-format.
This changes test/Driver/fsanitize.c to make it not expect a warning when
passed -fsanitize=undefined -fno-rtti, but expect vptr to not be on.

Removed all users and definition of SanitizerArgs::sanitizesVptr().

Reviewers: samsonov

Subscribers: llvm-commits, samsonov, rsmith

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

llvm-svn: 229801
2015-02-19 01:04:49 +00:00
Richard Smith 64ecacf6cb PR22566: a conversion from a floating-point type to bool is a narrowing conversion.
llvm-svn: 229792
2015-02-19 00:39:05 +00:00
Richard Smith 11152dd55f Allow errors on use of a private module header to be disabled, to better support incremental transition to modules.
llvm-svn: 229788
2015-02-19 00:10:28 +00:00
Jacques Pienaar fc27511223 clang-format: Space and triple angle braces.
Committing patch http://reviews.llvm.org/D6800.

llvm-svn: 229783
2015-02-18 23:48:37 +00:00
Alexey Samsonov f29e3f0791 Remove support for building sanitizers from Makefile/autoconf build on Linux.
This is a re-application of r229554 restricted to Linux build only.
Apple still uses Makefile/autoconf to build Clang and sanitizers.

llvm-svn: 229755
2015-02-18 22:26:22 +00:00
Alexey Samsonov 3a433f62fb [docs] Recommend to use CMake for building sanitizers.
llvm-svn: 229754
2015-02-18 22:26:20 +00:00
Justin Bogner bf42cfd75f InstrProf: Rewrite most of coverage mapping generation in a simpler way
The coverage mapping generation code previously generated a large
number of redundant coverage regions and then tried to merge similar
ones back together. This then relied on some awkward heuristics to
prevent combining of regions that were importantly different but
happened to have the same count. The end result was inefficient and
hard to follow.

Now, we more carefully create the regions we actually want. This makes
it much easier to create regions at precise locations as well as
making the basic approach quite a bit easier to follow. There's still
a fair bit of complexity here dealing with included code and macro
expansions, but that's pretty hard to avoid without significantly
reducing the quality of data we provide.

I had to modify quite a few tests where the source ranges became more
precise or the old ranges seemed to be wrong anyways, and I've added
quite a few new tests since a large number of constructs didn't seem
to be tested before.

llvm-svn: 229748
2015-02-18 21:24:51 +00:00
Benjamin Kramer 60b6f4f02b Remove unused diagnostic.
llvm-svn: 229729
2015-02-18 19:30:34 +00:00
David Majnemer a16d4707bc Itanium ABI: Write a character instead of a string literal
No functional change intended.

llvm-svn: 229726
2015-02-18 19:08:14 +00:00
David Majnemer eed9c8bb44 Itanium ABI: Restore disabled tests which are correctly mangled
llvm-svn: 229725
2015-02-18 19:08:12 +00:00
David Majnemer f8c02e6bfb Itanium ABI: Properly mangle extern "C" template arguments
extern "C" declarations should be considered like global declarations
for mangling purposes.

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

llvm-svn: 229724
2015-02-18 19:08:11 +00:00
Benjamin Kramer 33cd6dcf87 Driver: Fix use of dangling std::string temporary
What's going on here is that the ternary operator produces a std::string rvalue
that the StringRef points to. I'd hoped bugs like this were a thing of the past
with our asan testing but apparently this code path is only used when LLVM is
configured with a custom --with-c-include-dirs setting.

Unbreaks bootstrapping with GCC5 on Fedora (PR22625), patch by Jonathan Wakely!

llvm-svn: 229719
2015-02-18 18:45:54 +00:00
Meador Inge 34e79ed319 Sema: Allow 'constexpr' variables in range loops
This fixes PR22492, which is in response to CWG issue #1204.
Per the CWG issue 'contexpr' variables are now allowed in
for range loops.

llvm-svn: 229716
2015-02-18 18:34:59 +00:00
Daniel Jasper 3c42dba2dc clang-format: [JS] support AtScript style annotations for JS.
Based on Java annotation support and style.

Patch by Martin Probst.

llvm-svn: 229703
2015-02-18 17:17:15 +00:00
Daniel Jasper 8370908667 clang-format: [JS] Support classes.
This adds support for JavaScript class definitions (again following
TypeScript & AtScript style). This only required support for
visibility modifiers in JS, everything else was already working.

Patch by Martin Probst, thank you.

llvm-svn: 229701
2015-02-18 17:14:05 +00:00
Daniel Jasper b10bdff337 clang-format: [JS] Support type annotations.
This patch adds support for type annotations that follow TypeScript's,
Flow's, and AtScript's syntax style.

Patch by Martin Probst, thank you.
Review: http://reviews.llvm.org/D7721

llvm-svn: 229700
2015-02-18 17:09:53 +00:00
Zoran Jovanovic 26a1216a74 Change representation of member function pointers for MIPS targets
Differential Revision: http://reviews.llvm.org/D7148

llvm-svn: 229680
2015-02-18 15:21:35 +00:00
Daniel Sanders 933f0a04d3 Fix test/CodeGen/atomic_ops.c failure on clang-cmake-mips builder (and others).
Not all targets generate 'store atomic' instructions for
'_Atomic(_Complex int)'. Some targets use the __atomic_store builtin instead. 

This commit makes the test accept either one.

llvm-svn: 229676
2015-02-18 15:08:37 +00:00
Daniel Jasper c0b7c80fe6 Prevent use after free caused by accessing a member into a dense set.
The member gets invalidated as elements are added to the dense set. Directly
access the underlying pointer instead. Not sure how to create a test case for
this :-(. Maybe Richard can help.

llvm-svn: 229673
2015-02-18 14:13:46 +00:00
Bradley Smith d86d670e85 [ARM] Add missing M/R class CPUs
Add some of the missing M and R class Cortex CPUs, namely:

Cortex-M0+ (called Cortex-M0plus for GCC compatibility)
Cortex-M1
SC000
SC300
Cortex-R5

llvm-svn: 229661
2015-02-18 10:34:48 +00:00
David Majnemer 7ff7eb706a Itanium ABI: Mangle <mangled-name> according to the ABI
We attempted to be compatible with GCC's buggy mangling for templates
with a declaration for a template argument.

However, we weren't completely successful in copying their bug in cases
like:
  char foo;
  template <char &C> decltype(C) f() { return foo; };
  template char &f<foo>();

Instead, just follow the ABI specification.  This fixes PR22621.

llvm-svn: 229644
2015-02-18 07:47:09 +00:00
Nico Weber 4486d61c03 Port r163224 to C++.
The motivation is to fix a crash on

  struct S {} s;
  Foo S::~S() { s.~S(); }

What was happening here was that S::~S() was marked as invalid since its
return type is invalid, and as a consequence CheckFunctionDeclaration() wasn't
called and S::~S() didn't get merged into S's implicit destructor.  This way,
the class ended up with two destructors, which confused the overload printer
when it suddenly had to print two possible destructors for `s.~S()`.

In addition to fixing the crash, this change also seems to improve diagnostics
in a few other places, see test changes.

Crash found by SLi's bot.

llvm-svn: 229639
2015-02-18 05:19:40 +00:00
Nico Weber 6b05f386c8 Wrap to 80 columns. No behavior change.
llvm-svn: 229637
2015-02-18 04:53:03 +00:00
Saleem Abdulrasool b47d606e17 Sema: partially address post-commit comments
Un-parameterize the warning as there is exactly one attribute added in C++14.
Partially addresses post-commit review comments from Richard Smith.

llvm-svn: 229636
2015-02-18 04:33:26 +00:00
David Majnemer 5927e7b681 CodeGen: Relax a FileCheck line for SystemZ
llvm-svn: 229617
2015-02-18 02:28:15 +00:00
David Majnemer be52539650 Sema: size_t is available in C when -fms-compatibility is enabled
llvm-svn: 229616
2015-02-18 02:28:13 +00:00
David Majnemer a88b359fdc Itanium ABI: Improve our mangling of <destructor-name>
Our mangling of <destructor-name> wasn't quite right: we'd introduce
mangling substitutions where one shouldn't be possible.  We also didn't
correctly handle the case where the destroyed type was not dependent but
still a TemplateSpecializationType.

N.B. There isn't a mangling for a template-template parameter showing up
as the destroyed type.  We do the 'obvious' thing and mangle the index
of the parameter.

llvm-svn: 229615
2015-02-18 02:28:01 +00:00
Larisse Voufo e990a3f60c Rename flags and options to match current naming: from -fdef-sized-delete to -fdefine-sized-deallocation, and from DefaultSizedDelete to DefineSizedDeallocation.
llvm-svn: 229597
2015-02-18 01:04:10 +00:00
Anton Yartsev e5c0c14213 [analyzer] Refactoring: clarified the way the proper check kind is chosen.
llvm-svn: 229593
2015-02-18 00:39:06 +00:00
Reid Kleckner 469b6bce61 clang-cl: Map /wd4996 to -Wno-deprecated-declarations
This is typically used to suppress warnings about calling snprintf and
other "deprecated" POSIX functions. Accepting this flag helps avoid tons
of useless warnings when trying out clang-cl on a new project.

Patch by Scott Graham!

llvm-svn: 229583
2015-02-17 23:28:19 +00:00
Matthias Braun 44bf1c9c53 Revert "Remove support for building sanitizers from Makefile/autoconf build."
This reverts commit r229554.

Reverting this commit for now as several apple internal builds still
rely on this functionality.

llvm-svn: 229582
2015-02-17 23:27:37 +00:00
Reid Kleckner 5177a81e25 clang-cl: Disable frame pointer elimination at -O0
This wasn't kicking in because the _SLASH_O flag didn't match our check
for OPT_O0. Add an alias that does to keep the logic simple.

llvm-svn: 229575
2015-02-17 22:40:42 +00:00