Commit Graph

63120 Commits

Author SHA1 Message Date
Justin Lebar 25c36fd61b [CUDA] Tweak math forward declares so we're compatible with libstdc++4.9.
Summary:
See comments in patch; we were assuming that some stdlib math functions
would be defined in namespace std, when in fact the spec says they
should be defined in the global namespace.  libstdc++4.9 became more
conforming and broke us.

This new implementation seems to cover the known knowns.

Reviewers: rsmith

Subscribers: cfe-commits, tra

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

llvm-svn: 265751
2016-04-07 23:55:53 +00:00
Richard Smith 351241c83e Replace Sema-level implementation of -fassume-sane-operator-new with a
CodeGen-level implementation. Instead of adding an attribute to clang's
FunctionDecl, add the IR attribute directly. This means a module built with
this flag is now compatible with code built without it and vice versa.

This change also results in the 'noalias' attribute no longer being added to
calls to operator new in the IR; it's now only added to the declaration. It
also fixes a bug where we failed to add the attribute to the 'nothrow' versions
(because we didn't implicitly declare them, there was no good time to inject a
fake attribute).

llvm-svn: 265728
2016-04-07 21:46:12 +00:00
Richard Smith a1ddf5e744 [modules] Allow differences in flags that only affect preprocessor predefines
(and __has_feature checks) between explicitly-specified module files and the
current compilation.

llvm-svn: 265718
2016-04-07 20:47:37 +00:00
Manman Ren 7ed4f988c1 [ObjC kindof] Use type bound to filter out the candidate methods.
rdar://21306753

llvm-svn: 265712
2016-04-07 19:32:24 +00:00
Manman Ren d2a3cd7261 NFC: simplify code in BuildInstanceMessage.
Instead of searching the global pool multiple times: in
LookupFactoryMethodInGlobalPool, LookupInstanceMethodInGlobalPool,
CollectMultipleMethodsInGlobalPool, and AreMultipleMethodsInGlobalPool,
we now collect the method candidates in CollectMultipleMethodsInGlobalPool
only, and other functions will use the collected method set.

This commit adds parameter "Methods" to AreMultipleMethodsInGlobalPool,
and SelectBestMethod. It also changes the implementation of
CollectMultipleMethodsInGlobalPool to collect the desired kind first, if none is
found, to collect the other kind. This avoids the need to call both
LookupFactoryMethodInGlobalPool and LookupInstanceMethodInGlobalPool.

llvm-svn: 265711
2016-04-07 19:30:20 +00:00
Saleem Abdulrasool 94cfc603d1 Basic: move CodeGenOptions from Frontend
This is a mechanical move of CodeGenOptions from libFrontend to libBasic.  This
fixes the layering violation introduced earlier by threading CodeGenOptions into
TargetInfo.  It should also fix the modules based self-hosting builds.  NFC.

llvm-svn: 265702
2016-04-07 17:49:44 +00:00
Simon Pilgrim 112776dc66 Minor Wdocumentation fix. NFCI.
llvm-svn: 265700
2016-04-07 17:38:24 +00:00
Michael Zuckerman 5ae71243c2 Fixing duplicate declaration "_mm256 _mm_set_epi32" in revision 262177
Differential Revision: http://reviews.llvm.org/D17685

llvm-svn: 265677
2016-04-07 14:44:08 +00:00
Sanjay Patel ae7a9df7bf make __builtin_isfinite more efficient (PR27145)
isinf (is infinite) and isfinite should be implemented with the same function
except we change the comparison operator.

See PR27145 for more details:
https://llvm.org/bugs/show_bug.cgi?id=27145

Ref: forked off of the discussion in D18513.

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

llvm-svn: 265675
2016-04-07 14:29:05 +00:00
Alexey Bataev 2af33e3d3f [OPENMP 4.0] Parsing/sema analysis for 'simdlen' clause in 'declare simd'
construct.

OpenMP 4.0 defines '#pragma omp declare simd' construct that may have
associated 'simdlen' clause with constant positive expression as an
argument:
simdlen(<const_expr>)
Patch adds parsin and semantic analysis for simdlen clause.

llvm-svn: 265668
2016-04-07 12:45:37 +00:00
Benjamin Kramer 5d28c7f9a2 Move class into an anonymous namespace. NFC.
llvm-svn: 265654
2016-04-07 10:14:54 +00:00
Saleem Abdulrasool 724275ba5f Basic: thread CodeGenOptions into TargetInfo
This threads CodeGenOptions into the TargetInfo hierarchy.  This is motivated by
ARM which can change some target information based on the EABI selected
(-meabi).  Similar options exist for other platforms (e.g. MIPS) and thus is
generally useful.  NFC.

llvm-svn: 265640
2016-04-07 05:41:11 +00:00
Sean Silva 72af472523 Don't use PATH_MAX.
This is a SmallVector anyway, and so the exact size doesn't matter.

clang\lib\Frontend\ModuleDependencyCollector.cpp(83) : error C2065: 'PATH_MAX' : undeclared identifier
clang\lib\Frontend\ModuleDependencyCollector.cpp(83) : error C2975: 'InternalLen' : invalid template argument for 'llvm::SmallString', expected compile-time constant expression
        llvm\include\llvm/ADT/SmallString.h(24) : see declaration of 'InternalLen'

llvm-svn: 265634
2016-04-07 01:58:14 +00:00
Bruno Cardoso Lopes 4775fcfa4e [CrashReproducer] Use toUppercase from include/clang/Basic/CharInfo.h
Use toUppercase instead of ::toupper()

llvm-svn: 265632
2016-04-07 01:12:18 +00:00
Bruno Cardoso Lopes 49acebea07 [CrashReproducer] Change std::toupper to ::toupper
Attempt to fix windows bots

llvm-svn: 265630
2016-04-07 01:04:09 +00:00
Bruno Cardoso Lopes 4c20bef1ef [CrashReproducer] Setup 'case-sensitive' in YAML files.
The crash reproducer was not setting up case sensitivity in the
VFS yaml files, which defaults to true. Make the crash reproducer
explicitly set that flag based on the case sensitivity of the .cache
path where vfs and modules are dumped.

llvm-svn: 265622
2016-04-07 00:00:57 +00:00
Bruno Cardoso Lopes 7caebc182a [CrashReproducer] Move ModuleDependencyCollector method around. NFC
llvm-svn: 265621
2016-04-07 00:00:42 +00:00
JF Bastien dd11ee7452 NFC: use AtomicOrdering isStrongerThan
Summary: As discussed in D18775.

Reviewers: jyknight

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

llvm-svn: 265617
2016-04-06 23:37:36 +00:00
Manman Ren 8f42e69b18 Keep -fmodule-implementation-of as an alias of -fmodule-name.
This helps us transitioning to -fmodule-name. Once the transitioning is done,
we can remove this alias.

rdar://24800983

llvm-svn: 265616
2016-04-06 23:28:26 +00:00
Sean Silva 31994e2eb6 Revert "Set the default C standard to C99 when targeting the PS4."
This reverts r265359.

It breaks
- llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast
- llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast

Failing Tests (5):
    Clang :: FixIt/fixit-errors.c
    Clang :: Preprocessor/init.c
    Clang :: Sema/attr-deprecated.c
    Clang :: Sema/nullability.c
    Clang :: SemaObjC/objcbridge-attribute-arc.m

llvm-svn: 265601
2016-04-06 21:06:52 +00:00
Vassil Vassilev 59f6586da0 [modules] Add forgotten test case to r265597.
llvm-svn: 265599
2016-04-06 20:58:12 +00:00
Richard Smith b41ddae3a2 Fix order-of-evaluation bug (causing GCC buildbots to fail).
llvm-svn: 265598
2016-04-06 20:57:53 +00:00
Vassil Vassilev 71eafded89 [modules] Don't try to add lookup results to non-lookup contexts.
Fixes https://llvm.org/bugs/show_bug.cgi?id=27186

Patch reviewed by Richard Smith.

llvm-svn: 265597
2016-04-06 20:56:03 +00:00
Richard Smith f50422aa44 Minor simplifications.
llvm-svn: 265594
2016-04-06 20:12:34 +00:00
Tim Northover 1390b4479e Restore slightly less dodgy diagnostic handler for inline asm
Turns out it was there mostly to prevent Clang asking people to report a bug.
This time we report something to Clang's real diagnostics handler so that it
exits with something approximating a real error and tidies up after itself.

llvm-svn: 265592
2016-04-06 19:58:07 +00:00
Richard Smith 882593f8f0 Diagnose template alias declarations in local classes.
Patch by Erik Pilkington!

llvm-svn: 265571
2016-04-06 17:38:58 +00:00
JF Bastien 92f4ef1017 NFC: make AtomicOrdering an enum class
Summary: See LLVM change D18775 for details, this change depends on it.

Reviewers: jyknight, reames

Subscribers: cfe-commits

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

llvm-svn: 265569
2016-04-06 17:26:42 +00:00
Richard Smith 290d801916 Re-commit r265518 ("[modules] Continue factoring encoding of AST records out of
ASTWriter."), reverted in r265526, with a fix for an iterator invalidation bug
(thanks, MSan!).

llvm-svn: 265564
2016-04-06 17:06:00 +00:00
Daniel Jasper 2cce7b728b clang-format: Fix label-in-if statement in macros where it is actually used.
Before:
  #define A \
    if (a)  \
    label:  \
    f()

After:
  #define A \
    if (a)  \
    label:  \
      f()

llvm-svn: 265557
2016-04-06 16:41:39 +00:00
Ed Schouten 506f295a10 Enable PIE for CloudABI.
As we're currently working on making CloudABI executables easier to
emulate in userspace (e.g., on OS X and Windows), it makes a whole lot
of sense to build these using PIE. By using PIE, they can simply be
loaded into the existing process address space without clashes.

PIE support got added to CloudABI's C library and seems to work pretty
well. CloudABI does not make use of an ld.so, so the binary's _start()
has all the logic in it to do the relocations.

Now that all but one bug in LLD relating to PIE support have been
squashed (and a patch for that is already in code review), I'd like to
go ahead and force the use of PIE for Clang 3.9. When released, we'll
also switch over to using LLD exclusively.

llvm-svn: 265546
2016-04-06 15:37:06 +00:00
Daniel Jasper 4060947289 clang-format: Support labels in brace-less ifs.
While I am not personally convinced about the usefulness of this
construct, we should break it.

Before:
  if (a) label:
  f();

After:
  if (a)
  label:
    f();

llvm-svn: 265545
2016-04-06 15:02:46 +00:00
Daniel Jasper 19bc1d007a clang-format: Fix incorrect function annotation detection.
Before:
  MACRO(
      abc).function() // wrap
      << abc;

After:
  MACRO(abc).function() // wrap
      << abc;

llvm-svn: 265540
2016-04-06 13:58:09 +00:00
Dmitry Polukhin 0b0da296e6 [OPENMP] Parsing and Sema support for 'omp declare target' directive
Add parsing, sema analysis for 'declare target' construct for OpenMP 4.0
(4.5 support will be added in separate patch).

The declare target directive specifies that variables, functions (C, C++
and Fortran), and subroutines (Fortran) are mapped to a device. The declare
target directive is a declarative directive. In Clang declare target is
implemented as implicit attribute for the declaration.

The syntax of the declare target directive is as follows:

 #pragma omp declare target
 declarations-definition-seq
 #pragma omp end declare target

Based on patch from Michael Wong http://reviews.llvm.org/D15321

llvm-svn: 265530
2016-04-06 11:38:59 +00:00
Dmitry Polukhin 790b540099 Revert "[modules] Continue factoring encoding of AST records out of ASTWriter."
This reverts commit r265518.

llvm-svn: 265526
2016-04-06 10:01:46 +00:00
Richard Smith 5811c40bb3 [modules] Continue factoring encoding of AST records out of ASTWriter.
llvm-svn: 265518
2016-04-06 06:26:08 +00:00
Manman Ren 29be7e10ca Update testing cases after backend changes.
llvm-svn: 265488
2016-04-05 23:27:51 +00:00
Richard Trieu 265c344ef8 Fix a crash on invalid with template handling
This is a fix for https://llvm.org/bugs/show_bug.cgi?id=25561 which was a
crash on invalid.  Change the handling of invalid decls to have a catch-all
case to prevent unexpecting decls from triggering an assertion.

llvm-svn: 265467
2016-04-05 21:13:54 +00:00
Nirav Dave e585b5c52b Fix broken tests from no-jump-table commit
Summary: Fix failing tests from no-jump-table flag addition

Reviewers: jyknight

Subscribers: llvm-commits

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

llvm-svn: 265439
2016-04-05 18:59:37 +00:00
Justin Lebar 19dafbd211 [CUDA] Show --cuda-gpu-arch option in clang --help.
For some reason it was hidden.

llvm-svn: 265436
2016-04-05 18:26:25 +00:00
Justin Lebar d3a44f6885 [CUDA] Add -fcuda-flush-denormals-to-zero.
Summary:
Setting this flag causes all functions are annotated with the
"nvvm-f32ftz" = "true" attribute.

In addition, we annotate the module with "nvvm-reflect-ftz" set
to 0 or 1, depending on whether -cuda-flush-denormals-to-zero is set.
This is read by the NVVMReflect pass.

Reviewers: tra, rnk

Subscribers: cfe-commits

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

llvm-svn: 265435
2016-04-05 18:26:20 +00:00
Nirav Dave 99d607b63e Fix missing period in no-jump-table flag comment. NFC.
llvm-svn: 265432
2016-04-05 18:11:01 +00:00
Nirav Dave d2f44d8de0 Add -fno-jump-tables and-fjump-tables flags
Add no-jump-tables flag to disable use of jump tables when lowering
switch statements

Reviewers: echristo, hans

Subscribers: llvm-commits

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

llvm-svn: 265425
2016-04-05 17:50:43 +00:00
Andrey Turetskiy fd259ff9c4 [X86] Introduction of -march=lakemont.
Differential Revision: http://reviews.llvm.org/D18651

llvm-svn: 265405
2016-04-05 15:04:26 +00:00
Daniel Jasper 94b1bdf91a clang-format: Fix cast detection on "this".
Before:
  auto x = (X) this;

After:
  auto x = (X)this;

This fixes llvm.org/PR27198.

llvm-svn: 265385
2016-04-05 11:46:06 +00:00
Andy Gibbs 50b6ceff1f Consolidate and improve the handling of built-in feature-like macros
Summary:
The parsing logic has been separated out from the macro implementation logic, leading to a number of improvements:

* Gracefully handle unexpected/invalid tokens, too few, too many and nested parameters
* Provide consistent behaviour between all built-in feature-like macros
* Simplify the implementation of macro logic
* Fix __is_identifier to correctly return '0' for non-identifiers

Reviewers: doug.gregor, rsmith

Subscribers: rsmith, cfe-commits

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

llvm-svn: 265381
2016-04-05 08:36:47 +00:00
Richard Smith 8921007090 Move local helper class into anonymous namespace.
llvm-svn: 265364
2016-04-04 23:29:43 +00:00
Reid Kleckner 2ed6beac71 Fix test failure from r265361
llvm-svn: 265362
2016-04-04 23:14:14 +00:00
Sunil Srivastava 0e15a77d40 Set the default C standard to C99 when targeting the PS4.
Patch by Douglas Yung!

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

llvm-svn: 265359
2016-04-04 22:56:05 +00:00
James Y Knight e635215009 Fix "suggest parentheses" warning.
llvm-svn: 265355
2016-04-04 22:35:56 +00:00
John McCall 8cde42c400 Fix an unused-variable warning by using the variable in the place
it was supposed to have been used.

llvm-svn: 265344
2016-04-04 20:39:50 +00:00