]> granicus.if.org Git - clang/log
clang
7 years ago[Driver] Bump default x86 cpu to Penryn when targeting macosx10.12+.
Ahmed Bougacha [Thu, 15 Dec 2016 18:14:27 +0000 (18:14 +0000)]
[Driver] Bump default x86 cpu to Penryn when targeting macosx10.12+.

10.12 dropped support for all pre-Penryn Macs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289839 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix typo in comment. NFC.
Kelvin Li [Thu, 15 Dec 2016 17:55:32 +0000 (17:55 +0000)]
Fix typo in comment.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289836 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: ubsan is built static on windows, give handlers local storage
Saleem Abdulrasool [Thu, 15 Dec 2016 16:30:20 +0000 (16:30 +0000)]
CodeGen: ubsan is built static on windows, give handlers local storage

The UBSAN runtime is built static on Windows.  This requires that we give local
storage always.  This impacts Windows where the linker would otherwise have to
generate a thunk to access the symbol via the IAT.  This should repair the
windows clang build bots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289829 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[TESTS] Initial commit of tests, by Andrew Tischenko"
Alexey Bataev [Thu, 15 Dec 2016 12:24:20 +0000 (12:24 +0000)]
Revert "[TESTS] Initial commit of tests, by Andrew Tischenko"

This reverts commit 5898c713bee5e96aae87c73e11f3f4a7d19c74ed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289812 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TESTS] Initial commit of tests, by Andrew Tischenko
Alexey Bataev [Thu, 15 Dec 2016 12:06:27 +0000 (12:06 +0000)]
[TESTS] Initial commit of tests, by Andrew Tischenko

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289809 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-commit r289252 and r289285, and fix PR31374
Yaxun Liu [Thu, 15 Dec 2016 08:09:08 +0000 (08:09 +0000)]
Re-commit r289252 and r289285, and fix PR31374

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289787 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Implement execute-only support in CodeGen
Prakhar Bahuguna [Thu, 15 Dec 2016 07:59:24 +0000 (07:59 +0000)]
[ARM] Implement execute-only support in CodeGen

Summary:
This implements execute-only support for ARM code generation, which
prevents the compiler from generating data accesses to code sections.
The following changes are involved:

* Add the CodeGen option "-arm-execute-only" to the ARM code generator.
* Add the clang flag "-mexecute-only" as well as the GCC-compatible
  alias "-mpure-code" to enable this option.
* When enabled, literal pools are replaced with MOVW/MOVT instructions,
  with VMOV used in addition for floating-point literals. As the MOVT
  instruction is required, execute-only support is only available in
  Thumb mode for targets supporting ARMv8-M baseline or Thumb2.
* Jump tables are placed in data sections when in execute-only mode.
* The execute-only text section is assigned section ID 0, and is
  marked as unreadable with the SHF_ARM_PURECODE flag with symbol 'y'.
  This also overrides selection of ELF sections for globals.

Reviewers: t.p.northover, rengolin

Subscribers: llvm-commits, aemerson

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289786 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: force builtins to be local
Saleem Abdulrasool [Thu, 15 Dec 2016 07:29:04 +0000 (07:29 +0000)]
CodeGen: force builtins to be local

Unfortunately _setjmp3 can be both import or local.  The ASAN tests try to
emulate the flags which makes this harder to detect.  Rely on the linker
creating or using thunks here instead.  Should repair the ASAN windows bots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289783 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: fix runtime function dll storage
Saleem Abdulrasool [Thu, 15 Dec 2016 06:59:05 +0000 (06:59 +0000)]
CodeGen: fix runtime function dll storage

Properly attribute DLL storage to runtime functions.  When generating the
runtime function, scan for an existing declaration which may provide an explicit
declaration (local storage) or a DLL import or export storage from the user.
Honour that if available.  Otherwise, if building with a local visibility of the
public or standard namespaces (-flto-visibility-public-std), give the symbols
local storage (it indicates a /MT[d] link, so static runtime).  Otherwise,
assume that the link is dynamic, and give the runtime function dllimport
storage.

This allows for implementations to get the correct storage as long as they are
properly declared, the user to override the import storage, and in case no
explicit storage is given, use of the import storage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289776 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Fix printf specifier handling: invalid specifier should not be marked as...
Mehdi Amini [Thu, 15 Dec 2016 04:58:51 +0000 (04:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289763 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix printf specifier handling: invalid specifier should not be marked as "consuming...
Mehdi Amini [Thu, 15 Dec 2016 04:51:22 +0000 (04:51 +0000)]
Fix printf specifier handling: invalid specifier should not be marked as "consuming data arguments"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289762 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix os_log formating with arbitrary precision and field width
Mehdi Amini [Thu, 15 Dec 2016 04:02:31 +0000 (04:02 +0000)]
Fix os_log formating with arbitrary precision and field width

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289761 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[c++1z] Permit constant evaluation of a call through a function pointer whose
Richard Smith [Thu, 15 Dec 2016 02:35:39 +0000 (02:35 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289754 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMove checks for creation of objects of abstract class type from the various
Richard Smith [Thu, 15 Dec 2016 02:28:18 +0000 (02:28 +0000)]
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289753 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoInclude SmallSet.h in BackendUtil.cpp
Hal Finkel [Thu, 15 Dec 2016 02:19:17 +0000 (02:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289752 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse PIC relocation mode by default for PowerPC64 ELF
Joerg Sonnenberger [Thu, 15 Dec 2016 00:02:57 +0000 (00:02 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289744 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCreate SampleProfileLoader pass in llvm instead of clang
Dehao Chen [Wed, 14 Dec 2016 21:41:04 +0000 (21:41 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289715 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert 289252 (and follow-up 289285), it caused PR31374
Nico Weber [Wed, 14 Dec 2016 21:38:18 +0000 (21:38 +0000)]
Revert 289252 (and follow-up 289285), it caused PR31374

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289713 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate MSVC compat docs about debug info
Nico Weber [Wed, 14 Dec 2016 21:34:19 +0000 (21:34 +0000)]
Update MSVC compat docs about debug info

https://reviews.llvm.org/D27769

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289712 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DebugInfo] Changed DIBuilder::createCompileUnit() to take DIFile instead of FileName...
Amjad Aboud [Wed, 14 Dec 2016 20:24:40 +0000 (20:24 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289701 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unused variable found by GCC warning.
Richard Smith [Wed, 14 Dec 2016 19:45:03 +0000 (19:45 +0000)]
Remove unused variable found by GCC warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289698 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAArch64: add architecture version feature to Clang invocation.
Tim Northover [Wed, 14 Dec 2016 19:21:30 +0000 (19:21 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289692 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DebugInfo] Restore test case for long double constants.
David Gross [Wed, 14 Dec 2016 18:52:33 +0000 (18:52 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289686 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Add tests for enabled static analyzer checkers.
Devin Coughlin [Wed, 14 Dec 2016 18:46:01 +0000 (18:46 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289685 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoImprove our handling of tag decls in function prototypes
Reid Kleckner [Wed, 14 Dec 2016 17:44:11 +0000 (17:44 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289678 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agorevert r289670 which breaks bot.
Dehao Chen [Wed, 14 Dec 2016 17:22:53 +0000 (17:22 +0000)]
revert r289670 which breaks bot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289675 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCreate SampleProfileLoader pass in llvm instead of clang
Dehao Chen [Wed, 14 Dec 2016 16:49:34 +0000 (16:49 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289670 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Allow setting the default linker during build
Petr Hosek [Wed, 14 Dec 2016 16:46:50 +0000 (16:46 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289668 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate the default of the Mozilla coding style
Sylvestre Ledru [Wed, 14 Dec 2016 16:09:29 +0000 (16:09 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289660 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix assert message. NFC.
Kelvin Li [Wed, 14 Dec 2016 15:39:58 +0000 (15:39 +0000)]
Fix assert message.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289657 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFixing cast condition for removing casts from builtin FPClassification.
Neil Hickey [Wed, 14 Dec 2016 13:18:48 +0000 (13:18 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289650 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReplace APFloatBase static fltSemantics data members with getter functions
Stephan Bergmann [Wed, 14 Dec 2016 11:57:17 +0000 (11:57 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289647 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[c++1z] P0217R3: Allow by-value structured binding of arrays.
Richard Smith [Wed, 14 Dec 2016 03:22:16 +0000 (03:22 +0000)]
[c++1z] P0217R3: Allow by-value structured binding of arrays.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289630 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PS4] Undo dialect tweak for Objective-C.
Paul Robinson [Wed, 14 Dec 2016 02:06:11 +0000 (02:06 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289625 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWhen emitting a multidimensional array copy, only emit a single flattened
Richard Smith [Wed, 14 Dec 2016 01:32:13 +0000 (01:32 +0000)]
When emitting a multidimensional array copy, only emit a single flattened
cleanup loop for exception handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289623 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLTO: Add support for multi-module bitcode files.
Peter Collingbourne [Wed, 14 Dec 2016 01:17:59 +0000 (01:17 +0000)]
LTO: Add support for multi-module bitcode files.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289621 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove custom handling of array copies in lambda by-value array capture and
Richard Smith [Wed, 14 Dec 2016 00:03:17 +0000 (00:03 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289618 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeGen][ObjC] Emit objc_unsafeClaimAutoreleasedReturnValue for
Akira Hatanaka [Tue, 13 Dec 2016 23:32:22 +0000 (23:32 +0000)]
[CodeGen][ObjC] Emit objc_unsafeClaimAutoreleasedReturnValue for
fragile runtime too.

Follow-up to r258962.

rdar://problem/29269006

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289615 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd support for Samsung Exynos M3 (NFC)
Evandro Menezes [Tue, 13 Dec 2016 23:31:57 +0000 (23:31 +0000)]
Add support for Samsung Exynos M3 (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289614 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: Start using inrange annotations on vtable getelementptr.
Peter Collingbourne [Tue, 13 Dec 2016 20:50:44 +0000 (20:50 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289585 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: New vtable group representation: struct of vtable arrays.
Peter Collingbourne [Tue, 13 Dec 2016 20:40:39 +0000 (20:40 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289584 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAlign EvalInfo in ExprConstant to avoid PointerUnion assertions
Reid Kleckner [Tue, 13 Dec 2016 19:48:32 +0000 (19:48 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289575 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema] Prefer SmallVector over `new`ed memory blocks. NFC.
George Burgess IV [Tue, 13 Dec 2016 19:22:56 +0000 (19:22 +0000)]
[Sema] Prefer SmallVector over `new`ed memory blocks. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289571 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago__uuidof() and declspec(uuid("...")) should be allowed on enumeration types
Reid Kleckner [Tue, 13 Dec 2016 18:58:09 +0000 (18:58 +0000)]
__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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289567 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Detect ObjC properties that are both (copy) and Mutable.
Artem Dergachev [Tue, 13 Dec 2016 17:19:18 +0000 (17:19 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289554 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate for clang after llvm::StringLiteral.
Zachary Turner [Tue, 13 Dec 2016 17:10:16 +0000 (17:10 +0000)]
Update for clang after llvm::StringLiteral.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289553 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFixing build failure by adding triple option to new test condition.
Neil Hickey [Tue, 13 Dec 2016 17:04:33 +0000 (17:04 +0000)]
Fixing build failure by adding triple option to new test condition.

Adding -triple option to ensure target supports double for fpmath test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289552 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoImprove handling of floating point literals in OpenCL to only use double precision...
Neil Hickey [Tue, 13 Dec 2016 16:22:50 +0000 (16:22 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289544 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}
Alexander Kornienko [Tue, 13 Dec 2016 16:19:34 +0000 (16:19 +0000)]
Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289543 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL] Improve address space diagnostics.
Egor Churaev [Tue, 13 Dec 2016 14:07:23 +0000 (14:07 +0000)]
[OpenCL] Improve address space diagnostics.

Reviewers: Anastasia

Subscribers: bader, yaxunl, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289536 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL] Enable unroll hint for OpenCL 1.x.
Egor Churaev [Tue, 13 Dec 2016 14:02:35 +0000 (14:02 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289535 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: Keep string-literal-label + value pairs on a line.
Daniel Jasper [Tue, 13 Dec 2016 11:16:42 +0000 (11:16 +0000)]
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);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289531 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: Improve braced-list detection.
Daniel Jasper [Tue, 13 Dec 2016 10:05:03 +0000 (10:05 +0000)]
clang-format: Improve braced-list detection.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289525 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: clean up -Wpedantic warning (NFC)
Saleem Abdulrasool [Tue, 13 Dec 2016 03:27:35 +0000 (03:27 +0000)]
CodeGen: clean up -Wpedantic warning (NFC)

  lib/CodeGen/CGExpr.cpp:2511:2: warning: extra ';' [-Wpedantic]
   };
    ^

Clean up warning from gcc 6.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289514 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Run clang-format and fix style
Dominic Chen [Tue, 13 Dec 2016 01:40:41 +0000 (01:40 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289511 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[Modules] Make header inclusion order from umbrella dirs deterministic"
Bruno Cardoso Lopes [Mon, 12 Dec 2016 23:22:30 +0000 (23:22 +0000)]
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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289494 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[Headers] Add #include_next for tgmath.h on Darwin"
Bruno Cardoso Lopes [Mon, 12 Dec 2016 23:06:58 +0000 (23:06 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289487 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Modules] Make header inclusion order from umbrella dirs deterministic
Bruno Cardoso Lopes [Mon, 12 Dec 2016 22:41:20 +0000 (22:41 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289478 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CrashReproducer] Collect PCH included via -include-pch
Bruno Cardoso Lopes [Mon, 12 Dec 2016 19:28:25 +0000 (19:28 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289460 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Frontend] Use vfs for directory iteration while searching PCHs. NFCI
Bruno Cardoso Lopes [Mon, 12 Dec 2016 19:28:21 +0000 (19:28 +0000)]
[Frontend] Use vfs for directory iteration while searching PCHs. NFCI

Use the vfs lookup instead of real filesytem and handle the case where
-include-pch is a directory and this dir is searched for a PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289459 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix typo and remove unnecessary statement.
Samuel Antao [Mon, 12 Dec 2016 19:26:31 +0000 (19:26 +0000)]
Fix typo and remove unnecessary statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289458 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoBring back note about not supporting global register variables.
Michael Kuperstein [Mon, 12 Dec 2016 19:11:39 +0000 (19:11 +0000)]
Bring back note about not supporting global register variables.

This was accidentally removed in r260506, even though we only support
non-allocatable global register variables. The general (allocatable) case
is explicitly not supported.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289455 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAvoid use of std::to_string. NFC.
Vedant Kumar [Mon, 12 Dec 2016 18:47:33 +0000 (18:47 +0000)]
Avoid use of std::to_string. NFC.

Apparently this routine isn't available on some Android platforms. See
the mailing list thread re: D21695.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289452 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix format and a few typos in comments.
Samuel Antao [Mon, 12 Dec 2016 18:00:20 +0000 (18:00 +0000)]
Fix format and a few typos in comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289450 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Fix] Add missing include from r289444.
Filipe Cabecinhas [Mon, 12 Dec 2016 16:43:40 +0000 (16:43 +0000)]
[Fix] Add missing include from r289444.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289446 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang] Version support for UBSan handlers
Filipe Cabecinhas [Mon, 12 Dec 2016 16:18:40 +0000 (16:18 +0000)]
[clang] Version support for UBSan handlers

This adds a way for us to version any UBSan handler by itself.
The patch overrides D21289 for a better implementation (we're able to
rev up a single handler).

After this, then we can land a slight modification of D19667+D19668.

We probably don't want to keep all the versions in compiler-rt (maybe we
want to deprecate on one release and remove the old handler on the next
one?), but with this patch we will loudly fail to compile when mixing
incompatible handler calls, instead of silently compiling and then
providing bad error messages.

Reviewers: kcc, samsonov, rsmith, vsk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289444 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Attempt to fix new linux-ld tests on Windows
Michal Gorny [Mon, 12 Dec 2016 16:04:37 +0000 (16:04 +0000)]
[Driver] Attempt to fix new linux-ld tests on Windows

(broken by r289436)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289440 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Fix finding multilib gcc install on Gentoo (with gcc-config)
Michal Gorny [Mon, 12 Dec 2016 15:07:43 +0000 (15:07 +0000)]
[Driver] Fix finding multilib gcc install on Gentoo (with gcc-config)

Fix the gcc-config code to support multilib gcc installs properly. This
solves two problems: -mx32 using the 64-bit gcc directory (due to matching
installation triple), and -m32 not respecting gcc-config at all (due to
mismatched installation triple).

In order to fix the former issue, split the multilib scan out of
Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple() (the code
is otherwise unchanged), and call it for each installation found via
gcc-config.

In order to fix the latter issue, split the gcc-config processing out of
Generic_GCC::GCCInstallationDetector::init() and repeat it for all
triples, including extra and biarch triples. The only change
in the gcc-config code itself is adding the call to multilib scan.

Convert the gentoo_linux_gcc_multi_version_tree test input to multilib
x86_64+32+x32 install, and add appropriate tests to linux-header-search
and linux-ld.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289436 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse function_ref to avoid allocation in std::function. NFC.
Benjamin Kramer [Mon, 12 Dec 2016 14:41:19 +0000 (14:41 +0000)]
Use function_ref to avoid allocation in std::function. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289433 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[StaticAnalysis] Remove unnecessary parameter in CallGraphNode::addCallee.
Haojian Wu [Mon, 12 Dec 2016 14:12:10 +0000 (14:12 +0000)]
[StaticAnalysis] Remove unnecessary parameter in CallGraphNode::addCallee.

Summary:
Remove the CallGraph in addCallee as it is not used in addCallee.
It decouples addCallee from CallGraph, so that we can use CallGraphNode
within our customized CallGraph.

Reviewers: bkramer

Subscribers: cfe-commits, ioeric

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289431 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: Separate out a language kind for ObjC.
Daniel Jasper [Mon, 12 Dec 2016 12:42:29 +0000 (12:42 +0000)]
clang-format: Separate out a language kind for ObjC.

While C(++) and ObjC are generally formatted the same way and can be
mixed, people might want to choose different styles based on the
language. This patch recognizes .m and .mm files as ObjC and also
implements a very crude detection of whether or not a .h file contains
ObjC code. This can be improved over time.

Also move most of the ObjC tests into their own test file to keep file
size maintainable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289428 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Simplify ToolChain::GetCXXStdlibType (NFC)
Jonas Hahnfeld [Mon, 12 Dec 2016 07:53:47 +0000 (07:53 +0000)]
[Driver] Simplify ToolChain::GetCXXStdlibType (NFC)

I made the wrong assumption that execution would continue after an error Diag
which led to unneeded complex code.
This patch aligns with the better implementation of ToolChain::GetRuntimeLibType.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289422 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd two new AST nodes to represent initialization of an array in terms of
Richard Smith [Mon, 12 Dec 2016 02:53:20 +0000 (02:53 +0000)]
Add two new AST nodes to represent initialization of an array in terms of
initialization of each array element:

 * ArrayInitLoopExpr is a prvalue of array type with two subexpressions:
   a common expression (an OpaqueValueExpr) that represents the up-front
   computation of the source of the initialization, and a subexpression
   representing a per-element initializer
 * ArrayInitIndexExpr is a prvalue of type size_t representing the current
   position in the loop

This will be used to replace the creation of explicit index variables in lambda
capture of arrays and copy/move construction of classes with array elements,
and also C++17 structured bindings of arrays by value (which inexplicably allow
copying an array by value, unlike all of C++'s other array declarations).

No uses of these nodes are introduced by this change, however.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289413 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CrashReproducer] Setup a module collector callback for HeaderInclude
Bruno Cardoso Lopes [Sun, 11 Dec 2016 04:27:31 +0000 (04:27 +0000)]
[CrashReproducer] Setup a module collector callback for HeaderInclude

Collect missing include that cannot be fetched otherwise (e.g. when
using headermaps).

rdar://problem/27913709

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289361 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CrashReproducer] Collect headermap files
Bruno Cardoso Lopes [Sun, 11 Dec 2016 04:27:28 +0000 (04:27 +0000)]
[CrashReproducer] Collect headermap files

Include headermaps (.hmap files) in the .cache directory and
add VFS entries. All headermaps are known after HeaderSearch
setup, collect them right after.

rdar://problem/27913709

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289360 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX-512] Remove masking from 512-bit vpermil builtins. The backend now has versions...
Craig Topper [Sun, 11 Dec 2016 01:26:52 +0000 (01:26 +0000)]
[AVX-512] Remove masking from 512-bit vpermil builtins. The backend now has versions without masking so wrap it with select.

This will allow the backend to constant fold these to generic shuffle vectors like 128-bit and 256-bit without having to working about handling masking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289351 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX-512] Remove masking from 512-bit pshufb builtin. The backend now has a version...
Craig Topper [Sat, 10 Dec 2016 23:09:52 +0000 (23:09 +0000)]
[AVX-512] Remove masking from 512-bit pshufb builtin. The backend now has a version without masking so wrap it with select.

This will allow the backend to constant fold these to generic shuffle vectors like 128-bit and 256-bit without having to working about handling masking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289345 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX-512] Remove 128/256-bit masked vpermilvar builtins and replace with select and...
Craig Topper [Sat, 10 Dec 2016 20:27:39 +0000 (20:27 +0000)]
[AVX-512] Remove 128/256-bit masked vpermilvar builtins and replace with select and the avx unmasked builtins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289338 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSimplify parseShowColorsArgs logic, NFC.
Yaron Keren [Sat, 10 Dec 2016 14:55:14 +0000 (14:55 +0000)]
Simplify parseShowColorsArgs logic, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289328 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Improve VirtualCallChecker diagnostics and move into optin package.
Devin Coughlin [Sat, 10 Dec 2016 01:16:09 +0000 (01:16 +0000)]
[analyzer] Improve VirtualCallChecker diagnostics and move into optin package.

The VirtualCallChecker is in alpha because its interprocedural diagnostics
represent the call path textually in the diagnostic message rather than with a
path sensitive diagnostic.

This patch turns off the AST-based interprocedural analysis in the checker so
that no call path is needed and improves with diagnostic text. With these
changes, the checker is ready to be moved into the optin package.

Ultimately the right fix is to rewrite this checker to be path sensitive -- but
there is still value in enabling the checker for intraprocedural analysis only
The interprocedural mode can be re-enabled with an -analyzer-config flag.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289309 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] Another attempt at python 3 compatibility
Vedant Kumar [Sat, 10 Dec 2016 00:54:13 +0000 (00:54 +0000)]
[clang-format] Another attempt at python 3 compatibility

The entries in vim.current.buffer appear to be decoded strings, which
means that python3 won't allow invoking 'decode' on them. Keep the old
behavior when running under python2, but skip the error-inducing decode
step with python3..

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289308 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ubsan] Treat ObjC's BOOL as if its range is always {0, 1}
Vedant Kumar [Fri, 9 Dec 2016 23:48:18 +0000 (23:48 +0000)]
[ubsan] Treat ObjC's BOOL as if its range is always {0, 1}

On some Apple platforms, the ObjC BOOL type is defined as a signed char.
When performing instrumentation for -fsanitize=bool, we'd like to treat
the range of BOOL like it's always {0, 1}. While we can't change clang's
IRGen for char-backed BOOL's due to ABI compatibility concerns, we can
teach ubsan to catch potential abuses of this type.

rdar://problem/29502773

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289290 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CUDA,Driver] Added --no-cuda-gpu-arch= option.
Artem Belevich [Fri, 9 Dec 2016 22:59:17 +0000 (22:59 +0000)]
[CUDA,Driver] Added --no-cuda-gpu-arch= option.

This allows us to negate preceding --cuda-gpu-arch=X.
This comes handy when user needs to override default
flags set for them by the build system.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289287 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[c++17] P0490R0, NB comment FI 20: allow direct-initialization of decomposition decla...
Richard Smith [Fri, 9 Dec 2016 22:56:20 +0000 (22:56 +0000)]
[c++17] P0490R0, NB comment FI 20: allow direct-initialization of decomposition declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289286 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix unused variable warnings. NFCI.
Simon Pilgrim [Fri, 9 Dec 2016 22:45:21 +0000 (22:45 +0000)]
Fix unused variable warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289285 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[modules] Add optional out-param to ASTReader::ReadAST for imported submodules.
Graydon Hoare [Fri, 9 Dec 2016 21:45:49 +0000 (21:45 +0000)]
[modules] Add optional out-param to ASTReader::ReadAST for imported submodules.

Summary:
The Swift frontend is acquiring the ability to load non-module PCH files containing
bridging definitions from C/ObjC. As part of this work, it needs to know which submodules
were imported by a PCH in order to wrap them in local Swift modules. This information
is collected by ASTReader::ReadAST in a local vector, but is currently kept private.

The change here is just to make the type of the vector elements public, and provide
an optional out-parameter to the ReadAST method to provide the vector's contents to
a caller after a successful read.

Reviewers: manmanren, rsmith, doug.gregor

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289276 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove special error recovery for ::(id)
Reid Kleckner [Fri, 9 Dec 2016 21:10:43 +0000 (21:10 +0000)]
Remove special error recovery for ::(id)

The code pattern used to implement the token rewriting hack doesn't
interact well with token caching in the pre-processor. As a result,
clang would crash on 'int f(::(id));' while doing a tenative parse of
the contents of the outer parentheses. The original code from PR11852
still doesn't crash the compiler.

This error recovery also often does the wrong thing with member function
pointers. The test case from the original PR doesn't recover the right
way either:
  void S::(*pf)() = S::f; // should be 'void (S::*pf)()'

Instead we were recovering as 'void S::*pf()', which is still wrong.

If we still think that users mistakenly parenthesize identifiers in
nested name specifiers, we should change clang to intentionally parse
that form with an error, rather than doing a token rewrite.

Fixes PR26623, but I think there will be many more bugs like this around
token rewriting in the parser.

Reviewers: rsmith, rtrieu

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289273 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoImprove error message when referencing a non-tag type with a tag
Reid Kleckner [Fri, 9 Dec 2016 19:47:58 +0000 (19:47 +0000)]
Improve error message when referencing a non-tag type with a tag

Other compilers accept invalid code here that we reject, and we need a
better error message to try to convince users that the code is really
incorrect. Consider:
  class Foo {
    typedef MyIterHelper<Foo> iterator;
    friend class iterator;
  };

Previously our wording was "elaborated type refers to a typedef".
"elaborated type" isn't widely known terminology, so the new diagnostic
says "typedef 'iterator' cannot be referenced with class specifier".

Reviewers: rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289259 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd tests for a couple more DRs.
Richard Smith [Fri, 9 Dec 2016 19:35:45 +0000 (19:35 +0000)]
Add tests for a couple more DRs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289258 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agocxx_dr_status: update to latest issue list and add a couple more tests.
Richard Smith [Fri, 9 Dec 2016 19:11:50 +0000 (19:11 +0000)]
cxx_dr_status: update to latest issue list and add a couple more tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289255 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd support for non-zero null pointer for C and OpenCL
Yaxun Liu [Fri, 9 Dec 2016 19:01:11 +0000 (19:01 +0000)]
Add support for non-zero null pointer for C and OpenCL

In amdgcn target, null pointers in global, constant, and generic address space take value 0 but null pointers in private and local address space take value -1. Currently LLVM assumes all null pointers take value 0, which results in incorrectly translated IR. To workaround this issue, instead of emit null pointers in local and private address space, a null pointer in generic address space is emitted and casted to local and private address space.

Tentative definition of global variables with non-zero initializer will have weak linkage instead of common linkage since common linkage requires zero initializer and does not have explicit section to hold the non-zero value.

Virtual member functions getNullPointer and performAddrSpaceCast are added to TargetCodeGenInfo which by default returns ConstantPointerNull and emitting addrspacecast instruction. A virtual member function getNullPointerValue is added to TargetInfo which by default returns 0. Each target can override these virtual functions to get target specific null pointer and the null pointer value for specific address space, and perform specific translations for addrspacecast.

Wrapper functions getNullPointer is added to CodegenModule and getTargetNullPointerValue is added to ASTContext to facilitate getting the target specific null pointers and their values.

This change has no effect on other targets except amdgcn target. Other targets can provide support of non-zero null pointer in a similar way.

This change only provides support for non-zero null pointer for C and OpenCL. Supporting for other languages will be added later incrementally.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289252 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDR1295 and cleanup for P0135R1: Make our initialization code more directly
Richard Smith [Fri, 9 Dec 2016 18:49:13 +0000 (18:49 +0000)]
DR1295 and cleanup for P0135R1: Make our initialization code more directly
mirror the description in the standard. Per DR1295, this means that binding a
const / rvalue reference to a bit-field no longer "binds directly", and per
P0135R1, this means that we materialize a temporary in reference binding
after adjusting cv-qualifiers and before performing a derived-to-base cast.

In C++11 onwards, this should have fixed the last case where we would
materialize a temporary of the wrong type (with a subobject adjustment inside
the MaterializeTemporaryExpr instead of outside), but we still have to deal
with that possibility in C++98, unless we want to start using xvalues to
represent materialized temporaries there too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289250 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DOXYGEN] Improved doxygen comments for x86 intrinsics headers.
Ekaterina Romanova [Fri, 9 Dec 2016 18:35:50 +0000 (18:35 +0000)]
[DOXYGEN] Improved doxygen comments for x86 intrinsics headers.

Tagged instruction names with <c> INSTR_NAME </c> to display them in typewriter font.

In the past, \c command was used, unfortunately it applied to only one word.
<c> .. </c> has the same meaning, but applies to all words in between the tags.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289249 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRelax IRgen check in decl-in-prototype.c to match signext on PPC64
Reid Kleckner [Fri, 9 Dec 2016 17:56:04 +0000 (17:56 +0000)]
Relax IRgen check in decl-in-prototype.c to match signext on PPC64

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289234 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDon't assert when redefining a built-in macro in a PCH, PR29119
Nico Weber [Fri, 9 Dec 2016 17:32:52 +0000 (17:32 +0000)]
Don't assert when redefining a built-in macro in a PCH, PR29119

PCH files store the macro history for a given macro, and the whole history list
for one identifier is given to the Preprocessor at once via
Preprocessor::setLoadedMacroDirective(). This contained an assert that no macro
history exists yet for that identifier. That's usually true, but it's not true
for builtin macros, which are created in Preprocessor() before flags and pchs
are processed. Luckily, ASTWriter stops writing macro history lists at builtins
(see shouldIgnoreMacro() in ASTWriter.cpp), so the head of the history list was
missing for builtin macros. So make the assert weaker, and splice the history
list to the existing single define for builtins.

https://reviews.llvm.org/D27545

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289228 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoStore decls in prototypes on the declarator instead of in the AST
Reid Kleckner [Fri, 9 Dec 2016 17:14:05 +0000 (17:14 +0000)]
Store decls in prototypes on the declarator instead of in the AST

This saves two pointers from FunctionDecl that were being used for some
rare and questionable C-only functionality.  The DeclsInPrototypeScope
ArrayRef was added in r151712 in order to parse this kind of C code:

    enum e {x, y};
    int f(enum {y, x} n) {
     return x; // should return 1, not 0
    }

The challenge is that we parse 'int f(enum {y, x} n)' it its own
function prototype scope that gets popped before we build the
FunctionDecl for 'f'. The original change was doing two questionable
things:

1. Saving all tag decls introduced in prototype scope on a TU-global
Sema variable. This is problematic when you have cases like this, where
'x' and 'y' shouldn't be visible in 'f':
    void f(void (*fp)(enum { x, y } e)) { /* no x */ }
This patch fixes that, so now 'f' can't see 'x', which is consistent
with GCC.

2. Storing the decls in FunctionDecl in ActOnFunctionDeclarator so that
they could be used in ActOnStartOfFunctionDef. This is just an
inefficient way to move information around. The AST lives forever, but
the list of non-parameter decls in prototype scope is short lived.

Moving these things to the Declarator solves both of these issues.

Reviewers: rsmith

Subscribers: jmolloy, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289225 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDocument and publish the useful module-file-info flag.
Vassil Vassilev [Fri, 9 Dec 2016 14:20:32 +0000 (14:20 +0000)]
Document and publish the useful module-file-info flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289213 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] calculate MaxInsertOffset in the original code correctly.
Eric Liu [Fri, 9 Dec 2016 11:45:50 +0000 (11:45 +0000)]
[clang-format] calculate MaxInsertOffset in the original code correctly.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289203 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Headers] Add #include_next for tgmath.h on Darwin
Bruno Cardoso Lopes [Fri, 9 Dec 2016 03:30:46 +0000 (03:30 +0000)]
[Headers] Add #include_next for tgmath.h on Darwin

Allow darwin to provide additional definitions and implementation
specifc values for tgmath.h on Apple platforms.

rdar://problem/19019845

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289181 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Sema and parsing for 'teams distribute parallel for' pragma
Kelvin Li [Fri, 9 Dec 2016 03:24:30 +0000 (03:24 +0000)]
[OpenMP] Sema and parsing for 'teams distribute parallel for' pragma

This patch is to implement sema and parsing for 'teams distribute parallel for' pragma.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289179 91177308-0d34-0410-b5e6-96231b3b80d8