platform/upstream/llvm.git
7 years ago[ELF] Record created ThunkSections in InputSectionDescription [NFC].
Peter Smith [Fri, 27 Oct 2017 08:56:20 +0000 (08:56 +0000)]
[ELF] Record created ThunkSections in InputSectionDescription [NFC].

Instead of maintaining a map of the std::vector to ThunkSections, record the
ThunkSections directly in InputSectionDescription.

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

llvm-svn: 316750

7 years ago[CodeGen][ExpandMemcmp][NFC] Make tests more complete.
Clement Courbet [Fri, 27 Oct 2017 08:33:51 +0000 (08:33 +0000)]
[CodeGen][ExpandMemcmp][NFC] Make tests more complete.

llvm-svn: 316749

7 years ago[GVN][NFC] Refactor loop iteration with foreach
Max Kazantsev [Fri, 27 Oct 2017 08:19:35 +0000 (08:19 +0000)]
[GVN][NFC] Refactor loop iteration with foreach

llvm-svn: 316748

7 years agoAdd support for dwarf unwinding on windows on x86_64
Martin Storsjo [Fri, 27 Oct 2017 08:11:36 +0000 (08:11 +0000)]
Add support for dwarf unwinding on windows on x86_64

Clang doesn't currently support building for windows/x86_64 with
dwarf by setting command line parameters, but if manually modified
to use dwarf, we can make libunwind work in this configuration
as well.

Also include i386 in the docs when adding this as a supported
configuration; libunwind already works for i386 windows, but
can fail due to an issue unrelated to windows itself.

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

llvm-svn: 316747

7 years agoExpress Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTER
Martin Storsjo [Fri, 27 Oct 2017 07:59:01 +0000 (07:59 +0000)]
Express Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTER

This avoids having to keep the same information duplicated in multiple
places.

Adjust _LIBUNWIND_HIGHEST_DWARF_REGISTER to actually have the value
of the highest used register and only use the value
_LIBUNWIND_HIGHEST_DWARF_REGISTER + 1 (kMaxRegisterNumber + 1) for
allocating the savedRegisters array.

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

llvm-svn: 316745

7 years ago[clang-tidy ObjC] [3/3] New check objc-forbidden-subclassing
Haojian Wu [Fri, 27 Oct 2017 07:41:36 +0000 (07:41 +0000)]
[clang-tidy ObjC] [3/3] New check objc-forbidden-subclassing

Summary:
This is part 3 of 3 of a series of changes to improve Objective-C
linting in clang-tidy.

This adds a new clang-tidy check `objc-forbidden-subclassing` which
ensures clients do not create subclasses of Objective-C classes which
are not designed to be subclassed.

(Note that for code under your control, you should use
__attribute__((objc_subclassing_restricted)) instead -- this
is intended for third-party APIs which cannot be modified.)

By default, the following classes (which are publicly documented
as not supporting subclassing) are forbidden from subclassing:

ABNewPersonViewController
ABPeoplePickerNavigationController
ABPersonViewController
ABUnknownPersonViewController
NSHashTable
NSMapTable
NSPointerArray
NSPointerFunctions
NSTimer
UIActionSheet
UIAlertView
UIImagePickerController
UITextInputMode
UIWebView

Clients can set a CheckOption
`objc-forbidden-subclassing.ClassNames` to a semicolon-separated
list of class names, which overrides this list.

Test Plan: `ninja check-clang-tools`

Patch by Ben Hamilton!

Reviewers: hokein, alexfh

Reviewed By: hokein

Subscribers: saidinwot, Wizard, srhines, mgorny, xazax.hun

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

llvm-svn: 316744

7 years agollvm/CodeGen/GlobalISel/InstructionSelectorImpl.h: Fix -fmodules build introduced...
NAKAMURA Takumi [Fri, 27 Oct 2017 05:45:11 +0000 (05:45 +0000)]
llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h: Fix -fmodules build introduced in rL316715.

llvm-svn: 316743

7 years agoSimplify logic to find the last executable segment. NFC.
Rui Ueyama [Fri, 27 Oct 2017 05:08:39 +0000 (05:08 +0000)]
Simplify logic to find the last executable segment. NFC.

llvm-svn: 316742

7 years agoFix typo.
Rui Ueyama [Fri, 27 Oct 2017 04:59:33 +0000 (04:59 +0000)]
Fix typo.

llvm-svn: 316741

7 years agoFix a use-after-free in lldb-server
Pavel Labath [Fri, 27 Oct 2017 04:53:24 +0000 (04:53 +0000)]
Fix a use-after-free in lldb-server

UriParser::Parse is returning a StringRef pointing the the parsed
string, but we were calling it with a temporary string. Change this to a
local variable to make sure the string persists as long as we need it.

llvm-svn: 316740

7 years agoRevert rL316568 because of sudden performance drop on ARM
Max Kazantsev [Fri, 27 Oct 2017 04:17:44 +0000 (04:17 +0000)]
Revert rL316568 because of sudden performance drop on ARM

llvm-svn: 316739

7 years agoRemove a boolean flag `Create`. NFC.
Rui Ueyama [Fri, 27 Oct 2017 04:15:28 +0000 (04:15 +0000)]
Remove a boolean flag `Create`. NFC.

llvm-svn: 316738

7 years agoAdd subclass data to the FoldingSetNode for MemIntrinsicSDNodes.
Sean Fertile [Fri, 27 Oct 2017 04:02:51 +0000 (04:02 +0000)]
Add subclass data to the FoldingSetNode for MemIntrinsicSDNodes.

Not having the subclass data on an MemIntrinsicSDNodes means it was possible
to try to fold 2 nodes with the same operands but differing MMO flags. This
would trip an assertion when trying to refine the alignment between the 2
MachineMemOperands.

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

llvm-svn: 316737

7 years agoDefine a file-local write32 as a wrapper for endian::write32.
Rui Ueyama [Fri, 27 Oct 2017 03:59:34 +0000 (03:59 +0000)]
Define a file-local write32 as a wrapper for endian::write32.

llvm-svn: 316736

7 years agoDo not use InputSection::getFile<ELFT>() if InputSection::File suffices. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:25:04 +0000 (03:25 +0000)]
Do not use InputSection::getFile<ELFT>() if InputSection::File suffices.  NFC.

llvm-svn: 316735

7 years agoDe-template EhFrameHdr. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:14:24 +0000 (03:14 +0000)]
De-template EhFrameHdr. NFC.

llvm-svn: 316734

7 years agoDe-template EhReader. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:14:09 +0000 (03:14 +0000)]
De-template EhReader. NFC.

llvm-svn: 316733

7 years agoDe-template elf::getObjMsg. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:13:54 +0000 (03:13 +0000)]
De-template elf::getObjMsg. NFC.

llvm-svn: 316732

7 years agoDe-template EhFrameSection. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:13:39 +0000 (03:13 +0000)]
De-template EhFrameSection. NFC.

llvm-svn: 316731

7 years agoMake EhFrameHdr pull data from EhFrameSection. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:13:24 +0000 (03:13 +0000)]
Make EhFrameHdr pull data from EhFrameSection. NFC.

Previously, EhFrameSection pushes data to EhFrameHdr by calling addFde
function. By making EhFrameHdr pull data from EhFrameSection, we can
eliminate a member from EhFrameHdr.

llvm-svn: 316730

7 years agoDe-template a few functions. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:13:09 +0000 (03:13 +0000)]
De-template a few functions. NFC.

llvm-svn: 316729

7 years agoDefault to using in-tree clang for building test executables
Pavel Labath [Fri, 27 Oct 2017 02:24:04 +0000 (02:24 +0000)]
Default to using in-tree clang for building test executables

Summary:
Using the in-tree clang should be the default test configuration as that
is the one compiler that we can be sure everyone has (better
reproducibility of test results). Also, it should hopefully reduce the
impact of pr35040.

This also reduces the number of settings which control the compiler
used. LLDB_TEST_C_COMPILER is used for C files and
LLDB_TEST_CXX_COMPILER for C++ files. Both of the settings default to
the in-tree clang.

Reviewers: zturner

Subscribers: mgorny, davide, lldb-commits

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

llvm-svn: 316728

7 years agoAdd Arm Architecture plugin to the xcode project file.
Jason Molenda [Fri, 27 Oct 2017 02:21:55 +0000 (02:21 +0000)]
Add Arm Architecture plugin to the xcode project file.

llvm-svn: 316727

7 years agoInclude an error code when getRandomBytes failed.
Rui Ueyama [Fri, 27 Oct 2017 01:25:29 +0000 (01:25 +0000)]
Include an error code when getRandomBytes failed.

In a rare situation, the function can fail (e.g. it fails if it cannot
open /dev/urandom.)

llvm-svn: 316726

7 years agoFix test/Driver/wasm-toolchain.c on windows
Sam Clegg [Fri, 27 Oct 2017 01:20:16 +0000 (01:20 +0000)]
Fix test/Driver/wasm-toolchain.c on windows

llvm-svn: 316725

7 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 27 Oct 2017 01:09:08 +0000 (01:09 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316724

7 years ago[CodeGen] Add support for IncompleteArrayType in Obj-C ivars.
Volodymyr Sapsai [Fri, 27 Oct 2017 00:56:23 +0000 (00:56 +0000)]
[CodeGen] Add support for IncompleteArrayType in Obj-C ivars.

Fixes an assertion failure when ivar is a struct containing incomplete
array. Also completes support for direct flexible array members.

rdar://problem/21054495

Reviewers: rjmccall, theraven

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 316723

7 years ago[PDB] Handle an empty globals hash table with no buckets
Reid Kleckner [Fri, 27 Oct 2017 00:45:51 +0000 (00:45 +0000)]
[PDB] Handle an empty globals hash table with no buckets

llvm-svn: 316722

7 years agoRevert "[CGP] Merge empty case blocks if no extra moves are added."
Balaram Makam [Fri, 27 Oct 2017 00:35:18 +0000 (00:35 +0000)]
Revert "[CGP] Merge empty case blocks if no extra moves are added."

This reverts commit r316711. The domtree isn't getting updated correctly.

llvm-svn: 316721

7 years ago[LSan] Disable a couple of failing tests on PPC64 (pending investigation).
Alex Shlyapnikov [Fri, 27 Oct 2017 00:29:40 +0000 (00:29 +0000)]
[LSan] Disable a couple of failing tests on PPC64 (pending investigation).

llvm-svn: 316720

7 years ago[WebAssembly] Include libclang_rt.builtins in the standard way
Sam Clegg [Fri, 27 Oct 2017 00:26:07 +0000 (00:26 +0000)]
[WebAssembly] Include libclang_rt.builtins in the standard way

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

llvm-svn: 316719

7 years ago[X86] Add 'sse4' to X86TargetInfo::isValidFeatureName
Craig Topper [Fri, 27 Oct 2017 00:18:16 +0000 (00:18 +0000)]
[X86] Add 'sse4' to X86TargetInfo::isValidFeatureName

sse4 is valid for target attribute and functions as an alias of sse4.2.

llvm-svn: 316718

7 years ago[WebAssembly] MC: Don't allow zero sized data segments
Sam Clegg [Fri, 27 Oct 2017 00:08:55 +0000 (00:08 +0000)]
[WebAssembly] MC: Don't allow zero sized data segments

This ensures that each segment has a unique address.
Without this, consecutive zero sized symbols would
end up with the same address and the linker cannot
map symbols to unique data segments.

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

llvm-svn: 316717

7 years agoRemove an unnecessary inheritance.
Rui Ueyama [Thu, 26 Oct 2017 23:54:00 +0000 (23:54 +0000)]
Remove an unnecessary inheritance.

llvm-svn: 316716

7 years agoInstructionSelectorImpl.h: Modularize/remove ODR violations by using a static member...
David Blaikie [Thu, 26 Oct 2017 23:39:54 +0000 (23:39 +0000)]
InstructionSelectorImpl.h: Modularize/remove ODR violations by using a static member function to expose the debug name

llvm-svn: 316715

7 years agoMCCodePadder.h: Include definition of type for use with DenseMap
David Blaikie [Thu, 26 Oct 2017 23:39:52 +0000 (23:39 +0000)]
MCCodePadder.h: Include definition of type for use with DenseMap

Pointer traits require a full definition of a type to function
correctly, so the header must be included rather than only a forward
declaration.

llvm-svn: 316714

7 years agoUse -fuse-init-array if no gcc installation is found.
Nico Weber [Thu, 26 Oct 2017 23:26:29 +0000 (23:26 +0000)]
Use -fuse-init-array if no gcc installation is found.

clang currently uses .init_array instead of .ctors on Linux if it detects gcc
4.7+. Make it so that it also uses .init_array if no gcc installation is found
at all – if there's no old gcc, there's nothing we need to be compatible with.

icecc for example runs clang in a very small chroot, so before this change
clang would use .ctors if run under icecc. And lld currently silently mislinks
inputs with .ctors sections, so before this clang + icecc + lld would produce
broken binaries. (But this seems like a good change independent of that lld
bug.)

https://reviews.llvm.org/D39317

llvm-svn: 316713

7 years ago[X86] Make -march=i686 an alias of -march=pentiumpro
Craig Topper [Thu, 26 Oct 2017 23:06:19 +0000 (23:06 +0000)]
[X86] Make -march=i686 an alias of -march=pentiumpro

I think the only reason they are different is because we don't set tune_i686 for -march=i686 to match GCC. But GCC 4.9.0 seems to have changed this behavior and they do set it now. So I think they can aliases now.

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

llvm-svn: 316712

7 years ago[CGP] Merge empty case blocks if no extra moves are added.
Balaram Makam [Thu, 26 Oct 2017 22:34:01 +0000 (22:34 +0000)]
[CGP] Merge empty case blocks if no extra moves are added.

Summary:
Currently we skip merging when extra moves may be added in the header of switch instead of the case block, if the case block is used as an incoming
block of a PHI. If all the incoming values of the PHIs are non-constants and the destination block is dominated by the switch block then extra moves are likely not added by ISel, so there is no need to skip merging in this case.

Reviewers: efriedma, junbuml, davidxl, hfinkel, qcolombet

Reviewed By: efriedma

Subscribers: dberlin, kuhar, mcrosier, llvm-commits

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

llvm-svn: 316711

7 years agoSimplify.
Rui Ueyama [Thu, 26 Oct 2017 22:30:25 +0000 (22:30 +0000)]
Simplify.

Because of the same reason as r316600, I don't think we need a guard
against empty relocations.

llvm-svn: 316710

7 years ago[SimplifyIndVars] Shorten code by using SCEV helper [NFC]
Philip Reames [Thu, 26 Oct 2017 22:02:16 +0000 (22:02 +0000)]
[SimplifyIndVars] Shorten code by using SCEV helper [NFC]

llvm-svn: 316709

7 years ago[ARM] Honor -mfloat-abi for libcall calling convention
Eli Friedman [Thu, 26 Oct 2017 21:42:32 +0000 (21:42 +0000)]
[ARM] Honor -mfloat-abi for libcall calling convention

As far as I can tell, this matches gcc: -mfloat-abi determines the
calling convention for all functions except those explicitly defined as
soft-float in the ARM RTABI.

This change only affects cases where the user specifies -mfloat-abi to
override the default calling convention derived from the target triple.

Fixes https://bugs.llvm.org//show_bug.cgi?id=34530.

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

llvm-svn: 316708

7 years agoMove bit operations to a new file, ELF/Bits.h.
Rui Ueyama [Thu, 26 Oct 2017 21:37:17 +0000 (21:37 +0000)]
Move bit operations to a new file, ELF/Bits.h.

llvm-svn: 316707

7 years agoSupport/reg*: Roll some non-modular headers into their singular uses
David Blaikie [Thu, 26 Oct 2017 21:32:58 +0000 (21:32 +0000)]
Support/reg*: Roll some non-modular headers into their singular uses

These headers have static variables in them, which would easily create
ODR violations if the header was included in another header, and the
constants were used by an inline function, for example.

llvm-svn: 316706

7 years ago[X86][Driver] Move all of the X86 feature flags to one spot in the Options.td file...
Craig Topper [Thu, 26 Oct 2017 21:28:33 +0000 (21:28 +0000)]
[X86][Driver] Move all of the X86 feature flags to one spot in the Options.td file and pair them up with their negations.

It looks like at one time Options.td was in alphabetical order, but that looks to have long been broken. The result is that it all the no- x86 options got separated from their other friends for no good reason.

This patch puts them all together in one place with the no- paired with its none negated version.

I've kept all the SSE and AVX/AVX512 bits together since they represent a somewhat linear progression of features. The rest I just put in alphabetical order after.

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

llvm-svn: 316705

7 years ago[CGBlocks] Improve line info in backtraces containing *_helper_block
Vedant Kumar [Thu, 26 Oct 2017 21:27:24 +0000 (21:27 +0000)]
[CGBlocks] Improve line info in backtraces containing *_helper_block

Instead of only setting a non-zero debug location on the return
instruction in *_helper_block functions, set a proper location on all
instructions within these functions. Pick the start location of the
block literal expr for maximum clarity.

The debugger does not step into *_helper_block functions during normal
single-stepping because we mark their parameters as artificial. This is
what we want (the functions are implicitly generated and uninteresting
to most users). The stepping behavior is unchanged by this patch.

rdar://32907581

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

llvm-svn: 316704

7 years agoDo not add discriminator encoding for debug intrinsics.
Dehao Chen [Thu, 26 Oct 2017 21:20:52 +0000 (21:20 +0000)]
Do not add discriminator encoding for debug intrinsics.

Summary: There are certain requirements for debug location of debug intrinsics, e.g. the scope of the DILocalVariable should be the same as the scope of its debug location. As a result, we should not add discriminator encoding for debug intrinsics.

Reviewers: dblaikie, aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, aprantl, bjope, sanjoy, llvm-commits

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

llvm-svn: 316703

7 years ago[X86] Improve handling of UDIVREM8_ZEXT_HREG/SDIVREM8_SEXT_HREG to support 64-bit...
Craig Topper [Thu, 26 Oct 2017 21:12:03 +0000 (21:12 +0000)]
[X86] Improve handling of UDIVREM8_ZEXT_HREG/SDIVREM8_SEXT_HREG to support 64-bit extensions.

If the extend type is 64-bits, emit a 32-bit -> 64-bit extend after the UDIVREM8_ZEXT_HREG/UDIVREM8_SEXT_HREG operation.

This gives a shorter encoding for the second extend in the sext case, and allows us to completely remove the second extend in the zext case.

This also adds known bit and num sign bits support for UDIVREM8_ZEXT_HREG/SDIVREM8_SEXT_HREG.

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

llvm-svn: 316702

7 years ago[www] Regenerate diagnostics reference.
Richard Smith [Thu, 26 Oct 2017 21:06:52 +0000 (21:06 +0000)]
[www] Regenerate diagnostics reference.

llvm-svn: 316701

7 years ago[X86] Teach the assembly parser to warn on duplicate registers in gather instructions.
Craig Topper [Thu, 26 Oct 2017 21:03:54 +0000 (21:03 +0000)]
[X86] Teach the assembly parser to warn on duplicate registers in gather instructions.

Fixes PR32238.

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

llvm-svn: 316700

7 years ago[LICM] Restructure implicit exit handling to be more clear [NFCI]
Philip Reames [Thu, 26 Oct 2017 21:00:15 +0000 (21:00 +0000)]
[LICM] Restructure implicit exit handling to be more clear [NFCI]

When going to explain this to someone else, I got tripped up by the complicated meaning of IsKnownNonEscapingObject in load-store promotion.  Extract a helper routine and clarify naming/scopes to make this a bit more obvious.

llvm-svn: 316699

7 years ago[LSan] Enable LSan tests on PPC64 Linux.
Alex Shlyapnikov [Thu, 26 Oct 2017 20:59:04 +0000 (20:59 +0000)]
[LSan] Enable LSan tests on PPC64 Linux.

Summary:
LSan is functional on PPC64 Linux now, let's enable all tests.

One test required ppc specific changes: use_registers.cc.

Reviewers: eugenis

Subscribers: mgorny, llvm-commits

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

llvm-svn: 316698

7 years ago[TableGen] Use Twine instead of std::string concatenation in two calls to PrintFatalE...
Craig Topper [Thu, 26 Oct 2017 20:49:36 +0000 (20:49 +0000)]
[TableGen] Use Twine instead of std::string concatenation in two calls to PrintFatalError.

llvm-svn: 316697

7 years agoSupport/reg*.h: Make headers include their dependencies
David Blaikie [Thu, 26 Oct 2017 20:23:11 +0000 (20:23 +0000)]
Support/reg*.h: Make headers include their dependencies

llvm-svn: 316696

7 years agoFix C++ testcase I forgot to add to r316689.
Adrian Prantl [Thu, 26 Oct 2017 20:16:03 +0000 (20:16 +0000)]
Fix C++ testcase I forgot to add to r316689.

llvm-svn: 316695

7 years ago[GISel]: Missed checking if it's okay to create a G_CONSTANT of DstTy in the legaliza...
Aditya Nandakumar [Thu, 26 Oct 2017 20:13:54 +0000 (20:13 +0000)]
[GISel]: Missed checking if it's okay to create a G_CONSTANT of DstTy in the legalizationCombiner

llvm-svn: 316694

7 years ago[MinGW] Ignore the --enable-auto-import flag
Martin Storsjo [Thu, 26 Oct 2017 20:12:01 +0000 (20:12 +0000)]
[MinGW] Ignore the --enable-auto-import flag

In GNU ld, this option is enabled by default, but can be set
to reduce some warnings.

For lld, ignore the flag (for now); in case linking still succeeds
everything should be fine, if not, it should be clear to the user
what part failed (possibly requiring adjusting the user project
to not rely on this feature), instead of straight out failing due to
an unknown flag.

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

llvm-svn: 316693

7 years ago[MinGW] Support --out-implib=name in addition to "--out-implib name"
Martin Storsjo [Thu, 26 Oct 2017 20:11:58 +0000 (20:11 +0000)]
[MinGW] Support --out-implib=name in addition to "--out-implib name"

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

llvm-svn: 316692

7 years ago[COFF] Add a test for def files with spaces between @ and ordinal
Martin Storsjo [Thu, 26 Oct 2017 20:11:54 +0000 (20:11 +0000)]
[COFF] Add a test for def files with spaces between @ and ordinal

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

llvm-svn: 316691

7 years ago[COFF] Support ordinals in def files with space between @ and the number
Martin Storsjo [Thu, 26 Oct 2017 20:11:32 +0000 (20:11 +0000)]
[COFF] Support ordinals in def files with space between @ and the number

Both GNU ld and MS link.exe support declaring ordinals this way.

A test will be added in lld.

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

llvm-svn: 316690

7 years agoSimplify codegen and debug info generation for block context parameters.
Adrian Prantl [Thu, 26 Oct 2017 20:08:52 +0000 (20:08 +0000)]
Simplify codegen and debug info generation for block context parameters.

The exisiting code goes out of its way to put block parameters into an
alloca only at -O0, and then describes the funciton argument with a
dbg.declare, which is undocumented in the LLVM-CFE contract and does
not actually behave as intended after LLVM r642022.

This patch just generates the alloca unconditionally, the mem2reg pass
will eliminate it at -O1 and up anyway and points the dbg.declare to
the alloca as intended (which mem2reg will then correctly rewrite into
a dbg.value).

This reapplies r316684 with some dead code removed.

rdar://problem/35043980

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

llvm-svn: 316689

7 years agoFix TestMinidump for r316673
Pavel Labath [Thu, 26 Oct 2017 19:08:34 +0000 (19:08 +0000)]
Fix TestMinidump for r316673

The test was asserting that we can only find one frame in the minidump.
Now that we have the default unwind plan from the ABI plugin, we are
able to find 5 more frames using the frame pointer chaining. Correct the
expectation in the test.

llvm-svn: 316688

7 years ago[Analyzer] [Tests] Write analyzers crashes to stdout, and not to a separate file
George Karpenkov [Thu, 26 Oct 2017 19:00:22 +0000 (19:00 +0000)]
[Analyzer] [Tests] Write analyzers crashes to stdout, and not to a separate file

With this change it would be sufficient to look at CI console to see the
failure.

llvm-svn: 316687

7 years agoRevert "Simplify codegen and debug info generation for block context parameters."
Adrian Prantl [Thu, 26 Oct 2017 18:32:16 +0000 (18:32 +0000)]
Revert "Simplify codegen and debug info generation for block context parameters."

This reverts commit r316684 while investigating buildbot breakage.

llvm-svn: 316686

7 years ago[x86] use an insert op to put one variable element into a constant of vectors
Sanjay Patel [Thu, 26 Oct 2017 18:27:55 +0000 (18:27 +0000)]
[x86] use an insert op to put one variable element into a constant of vectors

Instead of loading (a potential ton of) scalar constants, load those as a vector and then insert into it.

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

llvm-svn: 316685

7 years agoSimplify codegen and debug info generation for block context parameters.
Adrian Prantl [Thu, 26 Oct 2017 18:16:05 +0000 (18:16 +0000)]
Simplify codegen and debug info generation for block context parameters.

The exisiting code goes out of its way to put block parameters into an
alloca only at -O0, and then describes the funciton argument with a
dbg.declare, which is undocumented in the LLVM-CFE contract and does
not actually behave as intended after LLVM r642022.

This patch just generates the alloca unconditionally, the mem2reg pass
will eliminate it at -O1 and up anyway and points the dbg.declare to
the alloca as intended (which mem2reg will then correctly rewrite into
a dbg.value).

rdar://problem/35043980

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

llvm-svn: 316684

7 years ago[Sanitizers] Set default allocator_release_to_os_interval_ms to 5 seconds
Alex Shlyapnikov [Thu, 26 Oct 2017 17:59:24 +0000 (17:59 +0000)]
[Sanitizers] Set default allocator_release_to_os_interval_ms to 5 seconds

Summary:
With new release to OS approach (see D38245) it's reasonable to enable
it by default. Setting allocator_release_to_os_interval_ms to 5000 seems
to be a reasonable default (might be tuned later, based on the
feedback).

Also delaying the first release to OS in each bucket for at least
allocator_release_to_os_interval_ms after the first allocation to
prevent just allocated memory to be madvised back to OS and let short
lived processes to avoid release to OS overhead altogether.

Reviewers: cryptoad

Subscribers: kubamracek, llvm-commits, mehdi_amini

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

llvm-svn: 316683

7 years ago[docs] Fix a small typo
Vedant Kumar [Thu, 26 Oct 2017 17:58:05 +0000 (17:58 +0000)]
[docs] Fix a small typo

llvm-svn: 316682

7 years ago[X86] Add a target attribute test for no-sse4.
Craig Topper [Thu, 26 Oct 2017 17:54:22 +0000 (17:54 +0000)]
[X86] Add a target attribute test for no-sse4.

llvm-svn: 316681

7 years agoAMDGPU: Commit missing fence-barrier test
Konstantin Zhuravlyov [Thu, 26 Oct 2017 17:54:09 +0000 (17:54 +0000)]
AMDGPU: Commit missing fence-barrier test

This should have been committed with memory model implementation

llvm-svn: 316680

7 years agoClear LastMappingSymbols and LastEMS(Info) when resetting the ARM(AArch64)ELFStreamer
Yichao Yu [Thu, 26 Oct 2017 17:36:43 +0000 (17:36 +0000)]
Clear LastMappingSymbols and LastEMS(Info) when resetting the ARM(AArch64)ELFStreamer

Summary:
This causes a segfault on ARM when (I think) the pass manager is used multiple times.

Reset set the (last) current section to NULL without saving the corresponding LastEMSInfo back into the map. The next use of the streamer then save the LastEMSInfo for the NULL section leaving the LastEMSInfo mapping for the last current section (the one that was there before the reset) NULL which cause the LastEMSInfo to be set to NULL when the section is being used again.

The reuse of the section (pointer) might mean that the map was holding dangling pointers previously which is why I went for clearing the map and resetting the info, making it as similar to the state right after the constructor run as possible. The AArch64 one doesn't have segfault (since LastEMS isn't a pointer) but it seems to have the same issue.

The segfault is likely caused by https://reviews.llvm.org/D30724 which turns LastEMSInfo into a pointer. As mentioned above, it seems that the actual issue was older though.

No test is included since the test is believed to be too complicated for such an obvious fix and not worth doing.

Reviewers: llvm-commits, shankare, t.p.northover, peter.smith, rengolin

Reviewed By: rengolin

Subscribers: mgorny, aemerson, rengolin, javed.absar, kristof.beyls

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

llvm-svn: 316679

7 years ago[dsymutil] Check AttrInfo.Name validity before using it
Keno Fischer [Thu, 26 Oct 2017 17:31:33 +0000 (17:31 +0000)]
[dsymutil] Check AttrInfo.Name validity before using it

Summary:
This upstreams a patch from the osxcross [1] toolchain.
It appears that llvm-dsymutil crashes at this place during GCC
bootstrap. Adding the check here seems reasonable, since it operates
on arbitrary input DWARF, not necessarily generated by the LLVM
toolchain, and it seems the un-mangled name need not necessarily exist.

Patch by Thomas Pöchtrager

[1] https://github.com/tpoechtrager/osxcross

Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D39336

llvm-svn: 316678

7 years agoMove MS inline asm parser methods out of line to reduce indentation, NFC
Reid Kleckner [Thu, 26 Oct 2017 17:07:48 +0000 (17:07 +0000)]
Move MS inline asm parser methods out of line to reduce indentation, NFC

llvm-svn: 316674

7 years agoAllow SysV-i386 ABI on everything other than Apple targets
Stephane Sezer [Thu, 26 Oct 2017 17:04:20 +0000 (17:04 +0000)]
Allow SysV-i386 ABI on everything other than Apple targets

Summary:
This matches other SysV ABIs that are different on Apple and non-Apple targets,
like `ABISysV_arm.cpp` for instance.

Reviewers: clayborg, emaste

Subscribers: aemerson, kristof.beyls, lldb-commits

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

llvm-svn: 316673

7 years ago[DynamicLibrary] Fix build on musl libc
Keno Fischer [Thu, 26 Oct 2017 16:44:13 +0000 (16:44 +0000)]
[DynamicLibrary] Fix build on musl libc

Summary:
On musl libc, stdin/out/err are defined as `FILE* const` globals,
and their address is not implicitly convertible to void *,
or at least gcc 6 doesn't allow it, giving errors like:

```
error: cannot initialize return object of type 'void *' with an rvalue of type 'FILE *const *' (aka '_IO_FILE *const *')
    EXPLICIT_SYMBOL(stderr);
    ^~~~~~~~~~~~~~~~~~~~~~~
```

Add an explicit cast to fix that problem.

Reviewers: marsupial, krytarowski, dim
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D39297

llvm-svn: 316672

7 years ago[MachineModuleInfoImpls] Replace qsort with array_pod_sort
Mandeep Singh Grang [Thu, 26 Oct 2017 16:07:20 +0000 (16:07 +0000)]
[MachineModuleInfoImpls] Replace qsort with array_pod_sort

Summary:
This seems to be the only place in llvm we directly call qsort. We can replace
this with a call to array_pod_sort. Also minor cleanup of the sorting function.

Reviewers: bkramer, Eugene.Zelenko, rafael

Reviewed By: bkramer

Subscribers: efriedma, llvm-commits

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

llvm-svn: 316671

7 years agoAdd objcCategoryImplDecl matcher
Dave Lee [Thu, 26 Oct 2017 15:53:37 +0000 (15:53 +0000)]
Add objcCategoryImplDecl matcher

Summary:
Add `objcCategoryImplDecl` which matches ObjC category definitions
(`@implementation`). This matcher complements `objcCategoryDecl` (`@interface`)
which was added in D30854.

Reviewers: aaron.ballman, malcolm.parsons, alexshap

Reviewed By: aaron.ballman

Subscribers: klimek, cfe-commits

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

llvm-svn: 316670

7 years agoReapply r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockInto...
Balaram Makam [Thu, 26 Oct 2017 15:04:53 +0000 (15:04 +0000)]
Reapply r316582 [Local] Fix a bug in the domtree update logic for MergeBasicBlockIntoOnlyPred.

Summary: This reverts r316612 to reapply r316582. The buildbot failure was unrelated to this commit.

Reviewers:

Subscribers:

llvm-svn: 316669

7 years agoRepresent runtime preemption in the IR.
Sean Fertile [Thu, 26 Oct 2017 15:00:26 +0000 (15:00 +0000)]
Represent runtime preemption in the IR.

Currently we do not represent runtime preemption in the IR, which has several
drawbacks:

  1) The semantics of GlobalValues differ depending on the object file format
     you are targeting (as well as the relocation-model and -fPIE value).
  2) We have no way of disabling inlining of run time interposable functions,
     since in the IR we only know if a function is link-time interposable.
     Because of this llvm cannot support elf-interposition semantics.
  3) In LTO builds of executables we will have extra knowledge that a symbol
     resolved to a local definition and can't be preemptable, but have no way to
     propagate that knowledge through the compiler.

This patch adds preemptability specifiers to the IR with the following meaning:

dso_local --> means the compiler may assume the symbol will resolve to a
 definition within the current linkage unit and the symbol may be accessed
 directly even if the definition is not within this compilation unit.

dso_preemptable --> means that the compiler must assume the GlobalValue may be
replaced with a definition from outside the current linkage unit at runtime.

To ease transitioning dso_preemptable is treated as a 'default' in that
low-level codegen will still do the same checks it did previously to see if a
symbol should be accessed indirectly. Eventually when IR producers emit the
specifiers on all Globalvalues we can change dso_preemptable to mean 'always
access indirectly', and remove the current logic.

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

llvm-svn: 316668

7 years agoAMDGPU: Handle s_buffer_load_dword hazard on SI
Marek Olsak [Thu, 26 Oct 2017 14:43:02 +0000 (14:43 +0000)]
AMDGPU: Handle s_buffer_load_dword hazard on SI

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 316666

7 years ago[LSV] Avoid adding vectors of pointers as candidates
Bjorn Pettersson [Thu, 26 Oct 2017 13:59:15 +0000 (13:59 +0000)]
[LSV] Avoid adding vectors of pointers as candidates

Summary:
We no longer add vectors of pointers as candidates for
load/store vectorization. It does not seem to work anyway,
but without this patch we can end up in asserts when trying
to create casts between an integer type and the pointer of
vectors type.

The test case I've added used to assert like this when trying to
cast between i64 and <2 x i16*>:
opt: ../lib/IR/Instructions.cpp:2565: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#0 PrintStackTraceSignalHandler(void*)
#1 SignalHandler(int)
#2 __restore_rt
#3 __GI_raise
#4 __GI_abort
#5 __GI___assert_fail
#6 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
#7 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateBitOrPointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&)
#8 Vectorizer::vectorizeStoreChain(llvm::ArrayRef<llvm::Instruction*>, llvm::SmallPtrSet<llvm::Instruction*, 16u>*)

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: nhaehnle, llvm-commits

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

llvm-svn: 316665

7 years ago[LSV] Skip all non-byte sizes, not only less than eight bits
Bjorn Pettersson [Thu, 26 Oct 2017 13:42:55 +0000 (13:42 +0000)]
[LSV] Skip all non-byte sizes, not only less than eight bits

Summary:
The code comments indicate that no effort has been spent on
handling load/stores when the size isn't a multiple of the
byte size correctly. However, the code only avoided types
smaller than 8 bits. So for example a load of an i28 could
still be considered as a candidate for vectorization.

This patch adjusts the code to behave according to the code
comment.

The test case used to hit the following assert when
trying to use "cast" an i32 to i28 using CreateBitOrPointerCast:

opt: ../lib/IR/Instructions.cpp:2565: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
#0 PrintStackTraceSignalHandler(void*)
#1 SignalHandler(int)
#2 __restore_rt
#3 __GI_raise
#4 __GI_abort
#5 __GI___assert_fail
#6 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*)
#7 llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateBitOrPointerCast(llvm::Value*, llvm::Type*, llvm::Twine const&)
#8 (anonymous namespace)::Vectorizer::vectorizeLoadChain(llvm::ArrayRef<llvm::Instruction*>, llvm::SmallPtrSet<llvm::Instruction*, 16u>*)

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: llvm-commits

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

llvm-svn: 316663

7 years ago[Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.
Roman Lebedev [Thu, 26 Oct 2017 13:18:14 +0000 (13:18 +0000)]
[Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.

Summary:
The warning was initially introduced in D32914 by @thakis,
and the concerns were raised there, and later in rL302247
and PR33771.

I do believe that it makes sense to relax the diagnostic
e.g. in this case, when the expression originates from the
system header, which can not be modified. This prevents
adoption for the diagnostic for codebases which use pthreads
(`PTHREAD_MUTEX_INITIALIZER`), gtest, etc.

As @malcolm.parsons suggests, it *may* make sense to also
not warn for the template types, but it is not obvious to
me how to do that in here.

Though, it still makes sense to complain about `NULL` macro.

While there, add more tests.

Reviewers: dblaikie, thakis, rsmith, rjmccall, aaron.ballman

Reviewed By: thakis

Subscribers: Rakete1111, hans, cfe-commits, thakis, malcolm.parsons

Tags: #clang

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

llvm-svn: 316662

7 years agoTry to fix warnings and windows test failures caused by r316653
Eric Liu [Thu, 26 Oct 2017 13:09:50 +0000 (13:09 +0000)]
Try to fix warnings and windows test failures caused by r316653

llvm-svn: 316661

7 years ago[Simplify] Mark (and sweep) based on latest access relation.
Michael Kruse [Thu, 26 Oct 2017 12:34:36 +0000 (12:34 +0000)]
[Simplify] Mark (and sweep) based on latest access relation.

Previously we marked scalars based on the original access function. However,
when a scalar read access is redirected, the original definition
(or incoming values of a PHI) is not used anymore, and can be deleted
(unless referenced by use that has not been redirected).

llvm-svn: 316660

7 years ago[clangd] Report an error on findDefinitions/signatureHelp on an unopened file instead...
Benjamin Kramer [Thu, 26 Oct 2017 12:28:13 +0000 (12:28 +0000)]
[clangd] Report an error on findDefinitions/signatureHelp on an unopened file instead of crashing.

Found by clangd-fuzzer.

llvm-svn: 316659

7 years agoAdd a new attribute definition spelling, Clang<"attr">, that expands to two attribute...
Aaron Ballman [Thu, 26 Oct 2017 12:19:02 +0000 (12:19 +0000)]
Add a new attribute definition spelling, Clang<"attr">, that expands to two attribute spellings: GNU<"attr"> and CXX11<"clang", "attr">. This is similar to how the GCC spelling works and is intended to be used for attributes introduced for Clang.

Changes all existing attributes that currently use GNU<"attr"> and CXX11<"clang", "attr> spellings to instead use the Clang<"attr"> spelling.

No additional tests are necessary because the existing tests already use both spellings for the attributes converted to the new spelling. No functional changes are expected.

llvm-svn: 316658

7 years ago[libunwind] Always use unwind tables in tests
Peter Smith [Thu, 26 Oct 2017 12:02:03 +0000 (12:02 +0000)]
[libunwind] Always use unwind tables in tests

For many targets setting -fno-exceptions will prevent unwinding tables from
being generated for the test programs. As libunwind depends on the tables to
unwind the stack several tests will fail.

This change always adds -funwind-tables so that even when -fno-exceptions
is set unwind tables are generated.

fixes PR33858

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

llvm-svn: 316657

7 years ago[mips] Fix (dis)assembly of abs.fmt for micromips
Simon Dardis [Thu, 26 Oct 2017 11:36:54 +0000 (11:36 +0000)]
[mips] Fix (dis)assembly of abs.fmt for micromips

These instructions were previously marked as codegen only preventing
them from being assembled as microMIPS or disassembled.

Reviewers: atanasyan, abeserminji

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

llvm-svn: 316656

7 years agoIt's a test to demonstrate wrong disassembler with 0x67 prefix
Andrew V. Tischenko [Thu, 26 Oct 2017 11:14:43 +0000 (11:14 +0000)]
It's a test to demonstrate wrong disassembler with 0x67 prefix

llvm-svn: 316655

7 years ago[mips] Fix PR35071
Simon Dardis [Thu, 26 Oct 2017 10:58:36 +0000 (10:58 +0000)]
[mips] Fix PR35071

PR35071 exposed the fact that MipsInstrInfo::removeBranch did not walk past
debug instructions when removing branches for the control flow optimizer, which
lead to duplicated conditional branches. If the target of the branch was a
removable block, only the conditional branch in the terminating position would
have it's MBB operands updated, leaving the first branch with a dangling MBB
operand. The MIPS long branch pass would then trigger an assertion when
attempting to examine the instruction with dangling MBB operand.

This resolves PR35071.

Thanks to Alex Richardson for reporting the issue!

Reviewers: atanasyan

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

llvm-svn: 316654

7 years ago[Tooling] A new framework for executing clang frontend actions.
Eric Liu [Thu, 26 Oct 2017 10:38:14 +0000 (10:38 +0000)]
[Tooling] A new framework for executing clang frontend actions.

Summary:
This defines a `clang::tooling::ToolExecutor` interface that can be extended to support different execution plans including standalone execution on a given set of TUs or parallel execution on all TUs in a codebase.

In order to enable multiprocessing execution, tool actions are expected to output result into a `ToolResults` interface provided by executors. The `ToolResults` interface abstracts how results are stored e.g. in-memory for standalone executions or on-disk for large-scale execution.

New executors can be registered as `ToolExecutorPlugin`s via the `ToolExecutorPluginRegistry`. CLI tools can use `createExecutorFromCommandLineArgs` to create a specific registered executor according to the command-line arguments.

This patch also implements `StandaloneToolExecutor` which has the same behavior as the current `ClangTool` interface, i.e. execute frontend actions on a given set of TUs. At this point, it's simply a wrapper around `ClangTool` at this point.

This is still experimental but expected to replace the existing `ClangTool` interface so that specific tools would not need to worry about execution.

Reviewers: klimek, arphaman, hokein, sammccall

Reviewed By: klimek

Subscribers: cfe-commits, djasper, mgorny, omtcyfz

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

llvm-svn: 316653

7 years ago[clangd] Don't crash on empty textDocument/didChange.
Benjamin Kramer [Thu, 26 Oct 2017 10:36:20 +0000 (10:36 +0000)]
[clangd] Don't crash on empty textDocument/didChange.

Found by clangd-fuzzer.

llvm-svn: 316652

7 years agoUpdate my email addresses, NFC.
Simon Dardis [Thu, 26 Oct 2017 10:16:54 +0000 (10:16 +0000)]
Update my email addresses, NFC.

llvm-svn: 316651

7 years ago[clangd] Don't use /// for non-doxygen comments.
Benjamin Kramer [Thu, 26 Oct 2017 10:07:04 +0000 (10:07 +0000)]
[clangd] Don't use /// for non-doxygen comments.

llvm-svn: 316650

7 years ago[clangd] Add a simple fuzzer. It crashes a lot :)
Benjamin Kramer [Thu, 26 Oct 2017 10:03:11 +0000 (10:03 +0000)]
[clangd] Add a simple fuzzer. It crashes a lot :)

llvm-svn: 316649

7 years ago[ELF] - Dedupliсate FDEs when sections are ICFed.
George Rimar [Thu, 26 Oct 2017 09:13:19 +0000 (09:13 +0000)]
[ELF] - Dedupliсate FDEs when sections are ICFed.

When LLD do ICF for 2 identical sections it leaves 2 duplicate entries in .eh_frame
pointing to the same address. After that it fixes .eh_frame_header's header,
so that it says it contains single FDE, though section itself contains 2
(it contains garbage data at tail).

As a result excessive entries in .eh_frame and excessive dummy data in .eh_frame_header
emited to output. Patch fixes that. This is PR34518.

Differential revision: https://reviews.llvm.org/D38998

llvm-svn: 316648

7 years ago[PowerPC] Use record-form instruction for Less-or-Equal -1 and Greater-or-Equal 1
Hiroshi Inoue [Thu, 26 Oct 2017 09:01:51 +0000 (09:01 +0000)]
[PowerPC] Use record-form instruction for Less-or-Equal -1 and Greater-or-Equal 1

Currently a record-form instruction is used for comparison of "greater than -1" and "less than 1" by modifying the predicate (e.g. LT 1 into LE 0) in addition to the naive case of comparison against 0.
This patch also enables emitting a record-form instruction for "less than or equal to -1" (i.e. "less than 0") and "greater than or equal to 1" (i.e. "greater than 0") to increase the optimization opportunities.

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

llvm-svn: 316647

7 years agoFix overloaded static functions in SemaCodeComplete
Benjamin Kramer [Thu, 26 Oct 2017 08:41:28 +0000 (08:41 +0000)]
Fix overloaded static functions in SemaCodeComplete

https://bugs.llvm.org/show_bug.cgi?id=33904
Happens when static function is accessed via the class variable. That leads to incorrect overloads number because the variable is considered as the first argument.

struct Bar {
  static void foo(); static void foo(int);
};

int main() {
  Bar b;
  b.foo(/*complete here*/); // did not work before
  Bar::foo(/*complete here*/); // worked fine
}

Patch by Ivan Donchevskii!

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

llvm-svn: 316646

7 years ago[clang-tidy ObjC] [2/3] Support non-C++ files in ClangTidyTest
Haojian Wu [Thu, 26 Oct 2017 08:37:25 +0000 (08:37 +0000)]
[clang-tidy ObjC] [2/3] Support non-C++ files in ClangTidyTest

Summary:
This is part 2 of 3 of a series of changes to improve
Objective-C linting in clang-tidy.

Currently, `clang::tidy::test::runCheckOnCode()` assumes all files
are C++ and unconditionally adds `-std=c++11` to the list of
`clang-tidy` options.

This updates the logic to check the extension of the source file
and only add `-std=c++11` if the extension indicates C++ or
Objective-C++.

Depends On D39188

Test Plan:

  ninja ClangTidyTests && \
  ./tools/clang/tools/extra/unittests/clang-tidy/ClangTidyTests

Patch by Ben Hamilton!

Reviewers: hokein, alexfh

Reviewed By: hokein

Subscribers: Wizard

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

llvm-svn: 316645