Commit Graph

66697 Commits

Author SHA1 Message Date
Antonio Maiorano 5ccb65f77d clang-format-vsix: add a date stamp to the VSIX version number to ensure upgradability
Presently, the version number of the VSIX matches the LLVM version number. However, as this number doesn't change often, it means that as we release new versions of this VSIX, it will have the same version number, which means users must first uninstall the old version before installing the new one. With this change, we generate a 4th part to the version number that is a date stamp (year, month, day); for example: 4.0.0.161203.

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

llvm-svn: 289909
2016-12-16 01:37:01 +00:00
Adrian Prantl ed4eb86531 Revert "Update for LLVM global variable debug info API change."
This reverts commit 289901 while investigating bot breakage.

llvm-svn: 289908
2016-12-16 01:01:40 +00:00
Richard Smith 6f1daa4660 [c++1z] P0195R2: Allow multiple using-declarators in a single using-declaration.
llvm-svn: 289905
2016-12-16 00:58:48 +00:00
Adrian Prantl 35bbcefb4b Update for LLVM global variable debug info API change.
llvm-svn: 289901
2016-12-16 00:35:42 +00:00
Kelvin Li ff1302c162 Fix typo in error messages. NFC.
llvm-svn: 289897
2016-12-16 00:15:54 +00:00
Kuba Mracek 0c7c687b5b [sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT when building compiler-rt from clang/runtime/CMakeLists.txt
Differential Revision: https://reviews.llvm.org/D26558

llvm-svn: 289890
2016-12-15 23:20:54 +00:00
Anna Zaks 136e9f466e [asan][docs] Fix the documentation to use clang++ for the C++ example
After Darwin has been updated not to link in stdc++ on Darwin this actually
started to break.

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

llvm-svn: 289887
2016-12-15 22:55:21 +00:00
Anna Zaks 44cdeb1da2 [analyzer] Teach the analyzer that pointers can escape into __cxa_demangle
This fixes a reported false positive in the malloc checker.

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

llvm-svn: 289886
2016-12-15 22:55:18 +00:00
Anna Zaks 6d4e76b988 [analyzer] Refine the diagnostics in the nullability checker to differentiate between nil and null
This is a big deal for ObjC, where nullability annotations are extensively
used. I've also changed "Null" -> "null" and removed "is" as this is the
pattern that Sema is using.

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

llvm-svn: 289885
2016-12-15 22:55:15 +00:00
Anna Zaks 40c74c6d22 [analyzer] Refer to macro names in diagnostics for macros representing a literal
When a macro expending to a literal is used in a comparison, use the macro name
in the diagnostic rather than the literal. This improves readability of path
notes.

Added tests for various macro literals that could occur. Only BOOl, Int, and
NULL tests have changed behavior with this patch.

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

llvm-svn: 289884
2016-12-15 22:55:11 +00:00
Anna Zaks 232ecfdf9c [analyzer] Include type name in Retain Count Checker diagnostics
The more detailed diagnostic will make identifying which object the
diagnostics refer to easier.

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

llvm-svn: 289883
2016-12-15 22:55:03 +00:00
Devin Coughlin 64c01f7bef [analyzer] Add a new SVal to support pointer-to-member operations.
Add a new type of NonLoc SVal for C++ pointer-to-member operations. This SVal
supports both pointers to member functions and pointers to member data.

A patch by Kirill Romanenkov!

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

llvm-svn: 289873
2016-12-15 21:27:06 +00:00
David L. Jones c4808b9e0a Add a class ASTRecordReader which wraps an ASTReader, a RecordData, and ModuleFile.
Summary:
When reading an ASTRecord, each RecordData is logically contained within a
single ModuleFile, and global(er) state is contained by a single ASTReader. This
means that any operations that read from a RecordData and reference an ASTReader
or a ModuleFile, will always reference the same ASTReader or ModuleFile.
ASTRecordReader groups these together so that parameters don't need to be
duplicated ad infinitum. Most uses of the Idx variable seem to be redunant
aliases as well, but I'll leave that for now.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 289870
2016-12-15 20:53:26 +00:00
Michal Gorny 391f221df6 [test] Extend llvm_shlib_dir fix to unittests
Extend the fix from rL286952 to unittests. The fix added clang built
library directories (via llvm_shlib_dir) to LD_LIBRARY_PATH.
The previous logic has used llvm_libs_dir only which points to installed
LLVM when doing stand-alone builds.

The patch also removes the redundant win32 code that is no longer
necessary now that shlibdir is used unconditionally.

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

llvm-svn: 289865
2016-12-15 20:31:08 +00:00
Mehdi Amini 9f10f34a6b Fix printf specifier handling: invalid specifier should not be marked as "consuming data arguments"
Reviewers: rsmith, bruno, dexonsmith

Subscribers: cfe-commits

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

llvm-svn: 289850
2016-12-15 18:54:00 +00:00
Justin Lebar 3cf25461e0 [CUDA] Add --ptxas-path= flag.
Summary:
This lets you build with one CUDA installation but use ptxas from
another install.

This is useful e.g. if you want to avoid bugs in an old ptxas without
actually upgrading wholesale to a newer CUDA version.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 289847
2016-12-15 18:44:57 +00:00
Ahmed Bougacha 24f5776216 [Driver] Bump default x86 cpu to Penryn when targeting macosx10.12+.
10.12 dropped support for all pre-Penryn Macs.

llvm-svn: 289839
2016-12-15 18:14:27 +00:00
Kelvin Li 51336dd0b4 Fix typo in comment. NFC.
llvm-svn: 289836
2016-12-15 17:55:32 +00:00
Saleem Abdulrasool 05b8fde8ee 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.

llvm-svn: 289829
2016-12-15 16:30:20 +00:00
Alexey Bataev 3da2619b6f Revert "[TESTS] Initial commit of tests, by Andrew Tischenko"
This reverts commit 5898c713bee5e96aae87c73e11f3f4a7d19c74ed.

llvm-svn: 289812
2016-12-15 12:24:20 +00:00
Alexey Bataev 70f090d568 [TESTS] Initial commit of tests, by Andrew Tischenko
llvm-svn: 289809
2016-12-15 12:06:27 +00:00
Yaxun Liu 402804b6d6 Re-commit r289252 and r289285, and fix PR31374
llvm-svn: 289787
2016-12-15 08:09:08 +00:00
Prakhar Bahuguna 61ef150d53 [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

llvm-svn: 289786
2016-12-15 07:59:24 +00:00
Saleem Abdulrasool 342beeb91e 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.

llvm-svn: 289783
2016-12-15 07:29:04 +00:00
Saleem Abdulrasool 6cb0744934 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.

llvm-svn: 289776
2016-12-15 06:59:05 +00:00
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