Commit Graph

66672 Commits

Author SHA1 Message Date
Mehdi Amini ba80a837ab Revert "Fix printf specifier handling: invalid specifier should not be marked as "consuming data arguments""
This reverts commit r289762, wasn't ready to be pushed, it broke the printf tests.

llvm-svn: 289763
2016-12-15 04:58:51 +00:00
Mehdi Amini 0dcbcb7eb8 Fix printf specifier handling: invalid specifier should not be marked as "consuming data arguments"
llvm-svn: 289762
2016-12-15 04:51:22 +00:00
Mehdi Amini ab11d83048 Fix os_log formating with arbitrary precision and field width
llvm-svn: 289761
2016-12-15 04:02:31 +00:00
Richard Smith dfe85e2d88 [c++1z] Permit constant evaluation of a call through a function pointer whose
type differs from the type of the actual function due to having a different
exception specification.

llvm-svn: 289754
2016-12-15 02:35:39 +00:00
Richard Smith 81f5ade227 Move checks for creation of objects of abstract class type from the various
constructs that can do so into the initialization code. This fixes a number
of different cases in which we used to fail to check for abstract types.

Thanks to Tim Shen for inspiring the weird code that uncovered this!

llvm-svn: 289753
2016-12-15 02:28:18 +00:00
Hal Finkel 1a328f508f Include SmallSet.h in BackendUtil.cpp
BackendUtil.cpp uses llvm::SmallSet but did not include the header. It was
included indirectly, but this will change once the AssumptionCache is removed.
NFC.

llvm-svn: 289752
2016-12-15 02:19:17 +00:00
Joerg Sonnenberger abedf7a0c0 Use PIC relocation mode by default for PowerPC64 ELF
Most of the PowerPC64 code generation already creates PIC access. This
changes to a full PIC default, similar to what GCC is doing.

Overall, a monolithic clang binary shrinks by 600KB (about 1%). This can
be a slight regression for TLS access and will use the TOC more
aggressively instead of synthesizing immediates. It is expected to be
performance neutral.

Differential Revision: https://reviews.llvm.org/D26564

llvm-svn: 289744
2016-12-15 00:02:57 +00:00
Dehao Chen 5717aff105 Create SampleProfileLoader pass in llvm instead of clang
Summary:
We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from
clang to llvm pass manager builder.

Reviewers: tejohnson, davidxl, dnovillo

Subscribers: mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D27744

llvm-svn: 289715
2016-12-14 21:41:04 +00:00
Nico Weber 7849eeb035 Revert 289252 (and follow-up 289285), it caused PR31374
llvm-svn: 289713
2016-12-14 21:38:18 +00:00
Nico Weber 65aedad628 Update MSVC compat docs about debug info
https://reviews.llvm.org/D27769

llvm-svn: 289712
2016-12-14 21:34:19 +00:00
Amjad Aboud fa9a17ee80 [DebugInfo] Changed DIBuilder::createCompileUnit() to take DIFile instead of FileName and Directory.
This way it will be easier to expand DIFile (e.g., to contain checksum) without the need to modify the createCompileUnit() API.

Reviewers: cfe-commits, rnk

Differential Revision: https://reviews.llvm.org/D27763

llvm-svn: 289701
2016-12-14 20:24:40 +00:00
Richard Smith 418ed82eae Remove unused variable found by GCC warning.
llvm-svn: 289698
2016-12-14 19:45:03 +00:00
Tim Northover 64aec507e8 AArch64: add architecture version feature to Clang invocation.
Otherwise we don't get the correct predefines and so on in the front-end (or
the right features in the backend).

llvm-svn: 289692
2016-12-14 19:21:30 +00:00
David Gross ff06759ffb [DebugInfo] Restore test case for long double constants.
Summary:
D27549 (partial fix for PR26619) emits a constant value in the debug
metadata for a floating-point static const that does not exceed 64
bits in size.  Whether or not a long double exceeds 64 bits in size
depends on the target.  Modify the test case so that it expects a
constant value for long double if and only if the long double is no
larger than 64 bits.

Reviewers: cfe-commits, probinson

Differential Revision: https://reviews.llvm.org/D27597

llvm-svn: 289686
2016-12-14 18:52:33 +00:00
Devin Coughlin 78c17385cb [Driver] Add tests for enabled static analyzer checkers.
The driver passes flags to cc1 that enable various checkers based on
the target triple. This commit adds tests for these flags on Darwin, Linux,
and Windows.

This is a test-only change.

llvm-svn: 289685
2016-12-14 18:46:01 +00:00
Reid Kleckner 34a0f3dc2f Improve our handling of tag decls in function prototypes
r289225 broke AST invariants by reparenting enumerators into function
decl contexts. This improves things by only reparenting TagDecls while
also attempting to preserve the lexical declcontext chain. The
interesting example here is:
  int f(struct S { enum E { a = 1 } b; } c);

The semantic contexts of E and S should be f, and the lexical context of
S should be f and the lexical context of E should be S. We didn't do
that with r289225, but now we should.

This change should also improve our behavior on this example:
  void f() {
    extern void ext(struct S { } o);
    // S injected here
  }

Before r289225 we would only remove 'S' from the surrounding tag
injection context if it was the TU, but now we properly reparent S from
f to ext.

Fixes PR31366

llvm-svn: 289678
2016-12-14 17:44:11 +00:00
Dehao Chen a85a8f9c2a revert r289670 which breaks bot.
llvm-svn: 289675
2016-12-14 17:22:53 +00:00
Dehao Chen a37569927b Create SampleProfileLoader pass in llvm instead of clang
Summary:
We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from
clang to llvm pass manager builder.

Reviewers: tejohnson, davidxl, dnovillo

Subscribers: mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D27744

llvm-svn: 289670
2016-12-14 16:49:34 +00:00
Petr Hosek fe2c2b082f [Driver] Allow setting the default linker during build
This change allows setting the default linker used by the Clang
driver when configuring the build.

Differential Revision: https://reviews.llvm.org/D25263

llvm-svn: 289668
2016-12-14 16:46:50 +00:00
Sylvestre Ledru dcb038d4f2 Update the default of the Mozilla coding style
Summary:
I also proposed the change in Firefox .clang-format file:
https://bugzilla.mozilla.org/show_bug.cgi?id=1322321

Reviewers: klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27557

llvm-svn: 289660
2016-12-14 16:09:29 +00:00
Kelvin Li 8437625e35 Fix assert message. NFC.
llvm-svn: 289657
2016-12-14 15:39:58 +00:00
Neil Hickey 7b5ddab55b Fixing cast condition for removing casts from builtin FPClassification.
The function SemaBuiltinFPClassification removed superfluous float to double 
casts, this was changed to also remove float to float casts but this isn't 
valid in all cases, for example when doing an rvaluetolvalue cast. Added a
check to only remove if this was a conventional floating cast.

Added additional tests into SemaOpenCL/extensions to cover these cases

llvm-svn: 289650
2016-12-14 13:18:48 +00:00
Stephan Bergmann 17c7f70362 Replace APFloatBase static fltSemantics data members with getter functions
At least the plugin used by the LibreOffice build
(<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly
uses those members (through inline functions in LLVM/Clang include files in turn
using them), but they are not exported by utils/extract_symbols.py on Windows,
and accessing data across DLL/EXE boundaries on Windows is generally
problematic.

Differential Revision: https://reviews.llvm.org/D26671

llvm-svn: 289647
2016-12-14 11:57:17 +00:00
Richard Smith 378b8c8f01 [c++1z] P0217R3: Allow by-value structured binding of arrays.
llvm-svn: 289630
2016-12-14 03:22:16 +00:00
Paul Robinson 41a2508e59 [PS4] Undo dialect tweak for Objective-C.
In r267772, we had set the PS4's default dialect for both C and
Objective-C to gnu99.  Make that change only for C; we don't really
support Objective-C/C++ so there's no point fiddling the dialect.

llvm-svn: 289625
2016-12-14 02:06:11 +00:00
Richard Smith 939b6880d4 When emitting a multidimensional array copy, only emit a single flattened
cleanup loop for exception handling.

llvm-svn: 289623
2016-12-14 01:32:13 +00:00
Peter Collingbourne 1a0720e8c4 LTO: Add support for multi-module bitcode files.
Differential Revision: https://reviews.llvm.org/D27313

llvm-svn: 289621
2016-12-14 01:17:59 +00:00
Richard Smith 30e304e2a6 Remove custom handling of array copies in lambda by-value array capture and
copy constructors of classes with array members, instead using
ArrayInitLoopExpr to represent the initialization loop.

This exposed a bug in the static analyzer where it was unable to differentiate
between zero-initialized and unknown array values, which has also been fixed
here.

llvm-svn: 289618
2016-12-14 00:03:17 +00:00
Akira Hatanaka 74f0789552 [CodeGen][ObjC] Emit objc_unsafeClaimAutoreleasedReturnValue for
fragile runtime too.

Follow-up to r258962.

rdar://problem/29269006

llvm-svn: 289615
2016-12-13 23:32:22 +00:00
Evandro Menezes ba17775c84 Add support for Samsung Exynos M3 (NFC)
llvm-svn: 289614
2016-12-13 23:31:57 +00:00
Peter Collingbourne 25a2b70cd0 CodeGen: Start using inrange annotations on vtable getelementptr.
This annotation allows the optimizer to split vtable groups, as permitted by
a change to the Itanium ABI [1] that prevents compilers from adjusting virtual
table pointers between virtual tables.

[1] https://github.com/MentorEmbedded/cxx-abi/pull/7

Differential Revision: https://reviews.llvm.org/D24431

llvm-svn: 289585
2016-12-13 20:50:44 +00:00
Peter Collingbourne 2849c4e841 CodeGen: New vtable group representation: struct of vtable arrays.
In a future change, this representation will allow us to use the new inrange
annotation on getelementptr to allow the optimizer to split vtable groups.

Differential Revision: https://reviews.llvm.org/D22296

llvm-svn: 289584
2016-12-13 20:40:39 +00:00
Reid Kleckner 06df402b06 Align EvalInfo in ExprConstant to avoid PointerUnion assertions
32-bit MSVC doesn't provide more than 4 byte stack alignment by default.
This conflicts with PointerUnion's attempt to make assertions about
alignment. This fixes the problem by explicitly asking the compiler for
8 byte alignment.

llvm-svn: 289575
2016-12-13 19:48:32 +00:00
George Burgess IV 215f6e788e [Sema] Prefer SmallVector over `new`ed memory blocks. NFC.
llvm-svn: 289571
2016-12-13 19:22:56 +00:00
Reid Kleckner e516eab140 __uuidof() and declspec(uuid("...")) should be allowed on enumeration types
Although not specifically mentioned in the documentation, MSVC accepts
__uuidof(…) and declspec(uuid("…")) attributes on enumeration types in
addition to structs/classes. This is meaningful, as such types *do* have
associated UUIDs in ActiveX typelibs, and such attributes are included
by default in the wrappers generated by their #import construct, so they
are not particularly unusual.

clang currently rejects the declspec with a –Wignored-attributes
warning, and errors on __uuidof() with “cannot call operator __uuidof on
a type with no GUID” (because it rejected the uuid attribute, and
therefore finds no value). This is causing problems for us while trying
to use clang-tidy on a codebase that makes heavy use of ActiveX.

I believe I have found the relevant places to add this functionality,
this patch adds this case to clang’s implementation of these MS
extensions.  patch is against r285994 (or actually the git mirror
80464680ce).

Both include an update to test/Parser/MicrosoftExtensions.cpp to
exercise the new functionality.

This is my first time contributing to LLVM, so if I’ve missed anything
else needed to prepare this for review just let me know!

__uuidof: https://msdn.microsoft.com/en-us/library/zaah6a61.aspx
declspec(uuid("…")): https://msdn.microsoft.com/en-us/library/3b6wkewa.aspx
 #import: https://msdn.microsoft.com/en-us/library/8etzzkb6.aspx

Reviewers: aaron.ballman, majnemer, rnk

Differential Revision: https://reviews.llvm.org/D26846

llvm-svn: 289567
2016-12-13 18:58:09 +00:00
Artem Dergachev e69d2e47e5 [analyzer] Detect ObjC properties that are both (copy) and Mutable.
When an Objective-C property has a (copy) attribute, the default setter
for this property performs a -copy on the object assigned.

Calling -copy on a mutable NS object such as NSMutableString etc.
produces an immutable object, NSString in our example.
Hence the getter becomes type-incorrect.

rdar://problem/21022397

Differential Revision: https://reviews.llvm.org/D27535

llvm-svn: 289554
2016-12-13 17:19:18 +00:00
Zachary Turner 26dab1283f Update for clang after llvm::StringLiteral.
llvm-svn: 289553
2016-12-13 17:10:16 +00:00
Neil Hickey c881be1c23 Fixing build failure by adding triple option to new test condition.
Adding -triple option to ensure target supports double for fpmath test.

llvm-svn: 289552
2016-12-13 17:04:33 +00:00
Neil Hickey 88c0fac534 Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64.
This change makes sure single-precision floating point types are used if the 
cl_fp64 extension is not supported by the target.

Also removed the check to see whether the OpenCL version is >= 1.2, as this has
been incorporated into the extension setting code.

Differential Revision: https://reviews.llvm.org/D24235

llvm-svn: 289544
2016-12-13 16:22:50 +00:00
Alexander Kornienko 7cdc705b03 Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}
llvm-svn: 289543
2016-12-13 16:19:34 +00:00
Egor Churaev de82a65053 [OpenCL] Improve address space diagnostics.
Reviewers: Anastasia

Subscribers: bader, yaxunl, cfe-commits

Differential Revision: https://reviews.llvm.org/D27671

llvm-svn: 289536
2016-12-13 14:07:23 +00:00
Egor Churaev 24939d479e [OpenCL] Enable unroll hint for OpenCL 1.x.
Summary: Although the feature was introduced only in OpenCL C v2.0 spec., it's useful for OpenCL 1.x too and doesn't require HW support.

Reviewers: Anastasia

Subscribers: yaxunl, cfe-commits, bader

Differential Revision: https://reviews.llvm.org/D27453

llvm-svn: 289535
2016-12-13 14:02:35 +00:00
Daniel Jasper 7209bb9d4e clang-format: Keep string-literal-label + value pairs on a line.
We have previously done that for <<-operators. This patch also adds
this logic for "," and "+".

Before:
  string v = "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa + "aaaaaaaaaaaaaaaa: " +
             aaaaaaaaaaaaaaaa + "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa;
  string v = StrCat("aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa, "aaaaaaaaaaaaaaaa: ",
                    aaaaaaaaaaaaaaaa, "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa);

After:
  string v = "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa +
	     "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa +
	     "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa;
  string v = StrCat("aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa,
		    "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa,
		    "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa);

llvm-svn: 289531
2016-12-13 11:16:42 +00:00
Daniel Jasper e4ada024b0 clang-format: Improve braced-list detection.
Before:
  vector<int> v { 12 }
      GUARDED_BY(mutex);

After:
  vector<int> v{12} GUARDED_BY(mutex);

llvm-svn: 289525
2016-12-13 10:05:03 +00:00
Saleem Abdulrasool ca6e2b4876 CodeGen: clean up -Wpedantic warning (NFC)
lib/CodeGen/CGExpr.cpp:2511:2: warning: extra ';' [-Wpedantic]
   };
    ^

Clean up warning from gcc 6.

llvm-svn: 289514
2016-12-13 03:27:35 +00:00
Dominic Chen c7772add11 [analyzer] Run clang-format and fix style
Summary: Split out formatting and style changes from D26061

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26691

llvm-svn: 289511
2016-12-13 01:40:41 +00:00
Bruno Cardoso Lopes 295f940ca6 Revert "[Modules] Make header inclusion order from umbrella dirs deterministic"
Reverts commit r289478.

This broke
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/2070
(and maybe
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/2246)

llvm-svn: 289494
2016-12-12 23:22:30 +00:00
Bruno Cardoso Lopes 88458c31e7 Revert "[Headers] Add #include_next for tgmath.h on Darwin"
Reverts r289181: it's currently breaking modules using simd.h in
10.12 SDK.

This reverts commit 6e73e3464e96a4e00492c24aa790d36e1adb5702.

llvm-svn: 289487
2016-12-12 23:06:58 +00:00
Bruno Cardoso Lopes 630dce3947 [Modules] Make header inclusion order from umbrella dirs deterministic
Sort the headers by name before adding the includes in
collectModuleHeaderIncludes. This makes the include order for building
umbrellas deterministic across different filesystems and also guarantees
that the ASTWriter always dump top headers in the same order.

There's currently no good way to test for this behavior.

rdar://problem/28116411

llvm-svn: 289478
2016-12-12 22:41:20 +00:00
Bruno Cardoso Lopes 7aff2bb3d2 [CrashReproducer] Collect PCH included via -include-pch
Collect the necessary input PCH files.

Do not try to validate the AST before copying it out because if the
crash is in this path, we won't be able to collect it. Instead only
check if it's a file containg an AST.

rdar://problem/27913709

llvm-svn: 289460
2016-12-12 19:28:25 +00:00