Commit Graph

41649 Commits

Author SHA1 Message Date
Alexey Bataev f24e7b1f60 [OPENMP 4.1] Codegen for array sections/subscripts in 'reduction' clause.
OpenMP 4.1 adds support for array sections/subscripts in 'reduction' clause. Patch adds codegen for this feature.

llvm-svn: 249672
2015-10-08 09:10:53 +00:00
David Majnemer e4e3e6a5bf [Sema] Tweak incomplete enum types on MSVC ABI targets
Enums without an explicit, fixed, underlying type are implicitly given a
fixed 'int' type for ABI compatibility with MSVC.  However, we can
enforce the standard-mandated rules on these types as-if we didn't know
this fact if the tag is not part of a definition.

llvm-svn: 249667
2015-10-08 07:45:35 +00:00
Douglas Katzman 060f5b4836 Use itostr(), not std::to_string() because of Android.
llvm-svn: 249658
2015-10-08 05:25:03 +00:00
David Majnemer 3f02150d31 [MSVC Compat] Enable ABI impacting non-conforming behavior independently of -fms-compatibility
No ABI for C++ currently makes it possible to implement the standard
100% perfectly.  We wrongly hid some of our compatible behavior behind
-fms-compatibility instead of tying it to the compiler ABI.

llvm-svn: 249656
2015-10-08 04:53:31 +00:00
Douglas Katzman 3459ce2e5e Stop messing with the 'g' group of options in CompilerInvocation.
With this change, most 'g' options are rejected by CompilerInvocation.
They remain only as Driver options. The new way to request debug info
from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}"
and "-dwarf-version={2|3|4}". In the absence of a command-line option
to specify Dwarf version, the Toolchain decides it, rather than placing
Toolchain-specific logic in CompilerInvocation.

Also fix a bug in the Windows compatibility argument parsing
in which the "rightmost argument wins" principle failed.

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

llvm-svn: 249655
2015-10-08 04:24:12 +00:00
Reid Kleckner 129552b375 [WinEH] Remove NewMSEH and enable its behavior by default
Testing has shown that it is at least as reliable as the old landingpad
pattern matching code.

llvm-svn: 249647
2015-10-08 01:13:52 +00:00
Richard Smith e87aeb378d When pretty-printing a C++11 literal operator, don't insert whitespace between
the "" and the suffix; that breaks names such as 'operator""if'. For symmetry,
also remove the space between the 'operator' and the '""'.

llvm-svn: 249641
2015-10-08 00:17:59 +00:00
Reid Kleckner 7c2f9e80f7 Don't emit exceptional stackrestore cleanups around inalloca functions
The backend restores the stack pointer after recovering from an
exception.  This is similar to r245879, but it doesn't try to use the
normal cleanup mechanism, so hopefully it won't cause the same breakage.

llvm-svn: 249640
2015-10-08 00:17:45 +00:00
Reid Kleckner 1f88e93973 [WinEH] Don't use lifetime markers for MS catch parameters
We don't have a good place to put them. Our previous spot was causing us
to optimize loads from the exception object to undef, because it was
after the catchpad instruction that models the write to the catch
object.

llvm-svn: 249616
2015-10-07 21:03:41 +00:00
Daniel Jasper d1ac50ecaa ASTMatchers: Keep AllCallbacks in a set instead of a vector
AllCallbacks is currently only used to call onStartOfTranslationUnit and
onEndOfTranslationUnit on them. In this (and any other scenario I can
come up with), it is important (or at least better) not to have
duplicates in this container. E.g. currently onEndOfTranslationUnit is
called repeatedly on the same callback for every matcher that is
registered with it.

llvm-svn: 249598
2015-10-07 19:56:12 +00:00
Benjamin Kramer d45b205ed1 [VFS] Port driver tool chains to VFS.
There are still some loose ends here but it's sufficient so we can detect
GCC headers that are inside of a VFS.

llvm-svn: 249556
2015-10-07 15:48:01 +00:00
Daniel Jasper 9cb1ac28b9 clang-format: Fixed missing space between Obj-C for/in and a typecast.
Fixes this bug: https://llvm.org/bugs/show_bug.cgi?id=24504

TokenAnnotator::spaceRequiredBetween was handling TT_ForEachMacro but
not TT_ObjCForIn, so lines that look like:

  for (id nextObject in (NSArray *)myArray)

would incorrectly turn into:

  for (id nextObject in(NSArray *)myArray)

Patch by Kent Sutherland, thank you.

llvm-svn: 249553
2015-10-07 15:09:08 +00:00
Daniel Jasper 39828256b0 [clang-format] Stop alignment sequences on open braces and parens when
aligning assignments.

This was done correctly when aligning the declarations, but not when
aligning assignments.

FIXME: The code between assignments and declarations alignment is
roughly duplicated and
would benefit from factorization.

Bug 25090: https://llvm.org/bugs/show_bug.cgi?id=25090

Patch by Beren Minor. Thank you.

llvm-svn: 249552
2015-10-07 15:03:26 +00:00
Alexey Bataev f2440332ca Fix crash in codegen on casting to `bool &`.
Currently codegen crashes trying to emit casting to bool &. It happens because bool type is converted to i1 and later then lvalue for reference is converted to i1*. But when codegen tries to load this lvalue it crashes trying to load value from this i1*.

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

llvm-svn: 249534
2015-10-07 10:22:08 +00:00
Benjamin Kramer dadb58b466 [VFS] Refactor VFSFromYAML a bit.
- Rename it to RedirectingFileSystem. This is what it does, YAML is just a
  serialization format for it.
- Consistently use unique_ptr for memory management.

No functional change intended.

llvm-svn: 249532
2015-10-07 10:05:44 +00:00
Benjamin Kramer d5e0b58ef2 [VFS] Also drop '.' when adding files to an in-memory FS.
Otherwise we won't be able to find them later.

llvm-svn: 249525
2015-10-07 08:32:50 +00:00
Daniel Jasper 55bbe664bd Make clang-format actually respect custom brace wrapping flags.
This fixes llvm.org/PR25073.

llvm-svn: 249519
2015-10-07 04:06:10 +00:00
Daniel Jasper 5af04a4d01 clang-format: Fix false ObjC block detection.
Before:
  inline A operator^(const A &lhs, const A &rhs) {} int i;

After:
  inline A operator^(const A &lhs, const A &rhs) {}
  int i;

llvm-svn: 249517
2015-10-07 03:43:10 +00:00
Daniel Jasper 4bc013e18c clang-format: Understand array reference types.
Before:
  void f(Type(&parameter)[10]) {}
  void f(Type (*parameter)[10]) {}

After:
  void f(Type (&parameter)[10]) {}
  void f(Type (*parameter)[10]) {}

llvm-svn: 249502
2015-10-07 01:41:22 +00:00
Daniel Jasper 0ea4d799e3 clang-format: Fix false positive in pointer/reference detection.
Before:
  return options != nullptr &&operator==(*options);

After:
  return options != nullptr && operator==(*options);

llvm-svn: 249501
2015-10-07 01:41:14 +00:00
Reid Kleckner f8d115338d [SEH] Fix x64 __exception_code in __except blocks
Use llvm.eh.exceptioncode to get the code out of EAX for x64. For
32-bit, the filter is responsible for storing it to memory for us.

llvm-svn: 249497
2015-10-07 01:07:13 +00:00
Hans Wennborg dcfba33481 Fix Clang-tidy modernize-use-nullptr warnings in source directories; other minor cleanups
Patch by Eugene Zelenko!

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

llvm-svn: 249484
2015-10-06 23:40:43 +00:00
Benjamin Kramer fa3dcf278e [Tooling] Don't run a tool invocation without a FileManager.
Fixes a crash regression from r249410.

llvm-svn: 249413
2015-10-06 15:04:13 +00:00
Benjamin Kramer bc632902dc [Tooling] Reuse FileManager in ASTUnit.
ASTUnit was creating multiple FileManagers and throwing them away. Reuse
the one from Tooling. No functionality change now but necessary for
VFSifying tooling.

llvm-svn: 249410
2015-10-06 14:45:20 +00:00
Benjamin Kramer 1b8dbe3738 [VFS] Put the incoming name in the file status to make InMemoryFS behave more like a real FS.
llvm-svn: 249409
2015-10-06 14:45:16 +00:00
Benjamin Kramer cac8fc2329 [Tooling] Remove dead code.
It took me some time to figure out why this is not working as expected:
std:error_code converts to true if there is an error. This means we never
ever took the generated absolute path, which happens to be the right thing
anyways as it properly works with virtual files. Just remove the whole
thing, relative paths are covered by existing tooling tests.

llvm-svn: 249408
2015-10-06 14:45:13 +00:00
Daniel Jasper 8ce1b8df76 clang-format: Make IncludeCategories configurable in .clang-format file.
This was made much easier by introducing an IncludeCategory struct to
replace the previously used std::pair.

Also, cleaned up documentation and added examples.

llvm-svn: 249392
2015-10-06 11:54:18 +00:00
Manuel Klimek 9b30e2b50b Adds a way for tools to deduce the target config from a compiler name.
Adds `addTargetAndModeForProgramName`, a utility function that will add
appropriate `-target foo` and `--driver-mode=g++` tokens to a command
line for driver invocations of the form `a/b/foo-g++`. It is intended to
support tooling: for example, should a compilation database record some
invocation of `foo-g++` without these implicit flags, a Clang tool may
use this function to add them back.

Patch by Luke Zarko.

llvm-svn: 249391
2015-10-06 10:45:03 +00:00
Benjamin Kramer b93511a636 [VFS] Port SimpleFormatContext to InMemoryFileSystem.
llvm-svn: 249389
2015-10-06 10:23:34 +00:00
Benjamin Kramer 9825b7a7c6 [VFS] Port applyAllReplacements to InMemoryFileSystem.
llvm-svn: 249388
2015-10-06 10:23:17 +00:00
Benjamin Kramer 2e2351adce [VFS] Transition clang-format to use an in-memory FS.
Apart from being cleaner this also means that clang-format no longer has
access to the host file system. This isn't necessary because clang-format
never reads includes :)

Includes minor tweaks and bugfixes found in the VFS implementation while
running clang-format tests.

llvm-svn: 249385
2015-10-06 10:04:08 +00:00
Benjamin Kramer 737501c673 Remove duplicated default arguments. NFC.
llvm-svn: 249355
2015-10-05 21:20:19 +00:00
Richard Smith 42fd9efa38 Revert r107690 (for PR7417) and add a testcase that it breaks. The approach of
that change turns out to not be reasonable: mutating the AST of a parsed
template during instantiation is not a sound thing to do, does not work across
chained PCH / modules builds, and is in any case a special-case workaround to a
more general problem that should be solved centrally.

llvm-svn: 249342
2015-10-05 20:05:21 +00:00
Adhemerval Zanella bffb20d0c2 [sanitizer] Enable lsan for AArch64
llvm-svn: 249338
2015-10-05 19:16:42 +00:00
Adrian Prantl 9641ae3746 Re-introduce the unique_ptr removed in r249328 and just make
~CodeGenABITypes out-of-line, which should have the same effect.

Thanks to David Blaikie for pointing this out!

llvm-svn: 249336
2015-10-05 18:54:30 +00:00
Adrian Prantl 83fde4bfc1 Undo the unique_ptr'fication of CodeGenABITypes::CGM introduced in r248762.
include/clang/CodeGenABITypes.h is in meant to be included by external
users, but using a unique_ptr on the private CodeGenModule introduces a
dependency on the type definition that prevents such a use.

NFC

llvm-svn: 249328
2015-10-05 17:41:16 +00:00
Aaron Ballman 3fd6c110be Adding a narrowing AST matcher for FunctionDecl::isVariadic(), plus tests and documentation.
llvm-svn: 249321
2015-10-05 14:41:27 +00:00
Benjamin Kramer d6bbee73ee [VFS] Fix the windows build by including the right headers.
llvm-svn: 249319
2015-10-05 14:06:36 +00:00
Benjamin Kramer 6b61805ebd [VFS] Fix compilation on systems where time_t is not int64_t.
No functional change intended.

llvm-svn: 249318
2015-10-05 14:02:15 +00:00
Benjamin Kramer 7708b2a4b6 [VFS] Add working directories to every virtual file system.
For RealFileSystem this is getcwd()/chdir(), the synthetic file systems can
make up one for themselves. OverlayFileSystem now synchronizes the working
directories when a new FS is added to the overlay or the overlay working
directory is set. This allows purely artificial file systems that have zero
ties to the underlying disks.

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

llvm-svn: 249316
2015-10-05 13:55:20 +00:00
Benjamin Kramer a25dcfd906 [VFS] Add an in-memory file system implementation.
This is a simple file system tree of memory buffers that can be filled by a
client. In conjunction with an OverlayFS it can be used to make virtual
files accessible right next to physical files. This can be used as a
replacement for the virtual file handling in FileManager and which I intend
to remove eventually.

llvm-svn: 249315
2015-10-05 13:55:14 +00:00
Benjamin Kramer 5532ef1a5d [VFS] Move class out of method so it looks less like Java.
No functionality change.

llvm-svn: 249314
2015-10-05 13:55:09 +00:00
Benjamin Kramer 268b51a188 [VFS] Remove setName from the file interface.
This streamlines the interface a bit and makes Status more immutable.
No functional change intended.

llvm-svn: 249310
2015-10-05 13:15:33 +00:00
Alexandros Lamprineas eda554a9b4 The Driver does not set the +strict-align flag when targeting
[ARM] armv6m + netbsd. Tests are misssing for armv6m + darwin as well.

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

llvm-svn: 249308
2015-10-05 12:45:10 +00:00
Daniel Sanders ff9525817b [mips][p5600] Add -mcpu=p5600 option.
Summary:

Reviewers: vkalintiris, atanasyan

Subscribers: cfe-commits

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

llvm-svn: 249306
2015-10-05 12:24:30 +00:00
Rafael Espindola ee4e08ba94 Use llvm::errc instead of std::errc.
llvm-svn: 249302
2015-10-05 11:49:35 +00:00
Anastasia Stulova b02e7835c5 [OpenCL] Fix casting a true boolean to an integer vector.
OpenCL v1.1 s6.2.2: for the boolean value true, every bit in the result vector should be set.

This change treats the i1 value as signed for the purposes of performing the cast to integer,
and therefore sign extend into the result.

Patch by Neil Hickey!

http://reviews.llvm.org/D13349

llvm-svn: 249301
2015-10-05 11:27:41 +00:00
Vasileios Kalintiris fdfc010e84 Remove support for the mips-mti-linux toolchain.
There are two remaining buildbot failures that we'll have to
investigate before submitting this again.

llvm-svn: 249298
2015-10-05 10:34:46 +00:00
Vasileios Kalintiris 6967527441 Re-commit "Add support for the new mips-mti-linux toolchain."
r249137 added support for the new mips-mti-linux toolchain. However,
the new tests of that commit, broke some buildbots because they didn't use
the correct regular expressions to capture the filename of Clang & LLD.

This commit re-applies the changes of r249137 and fixes the tests in
r249137 in order to match the filenames of the Clang and LLD executable.

llvm-svn: 249294
2015-10-05 09:12:36 +00:00
Adrian Prantl f0cd677b17 Module Debugging: Emit (ObjC) function declarations in the module scope
when building a module.

llvm-svn: 249282
2015-10-04 23:23:04 +00:00