Commit Graph

30740 Commits

Author SHA1 Message Date
NAKAMURA Takumi a7416358ba clang/test/SemaOpenCL/overload_addrspace_resolution.cl: Appease MS mangler to specify triple=x86_64-unknown.
llvm-svn: 297530
2017-03-10 23:06:34 +00:00
Galina Kistanova a135649f42 Attempt to fix Windows buildbot.
llvm-svn: 297497
2017-03-10 19:34:15 +00:00
Petar Jovanovic bc97ab28a4 [mips][msa] Remove range checks for non-immediate sld.[bhwd] instructions
Removes immediate range checks for these instructions, since they have GPR
rt as their input operand.

Patch by Stefan Maksimovic.

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

llvm-svn: 297485
2017-03-10 17:51:01 +00:00
Anastasia Stulova 81a25e352f [OpenCL] Fix type compatibility check and generic AS mangling.
1. Reimplemented conditional operator so that it checks
compatibility of unqualified pointees of the 2nd and
the 3rd operands (C99, OpenCL v2.0 6.5.15).

Define QualTypes compatibility for OpenCL as following:

   - corresponding types are compatible (C99 6.7.3)
   - CVR-qualifiers are equal (C99 6.7.3)
   - address spaces are equal (implementation defined)

2. Added generic address space to Itanium mangling.

Review: D30037

Patch by Dmitry Borisenkov!

llvm-svn: 297468
2017-03-10 15:23:07 +00:00
Alex Lorenz 76377dcf99 Print nested name specifiers for typedefs and type aliases
Printing typedefs or type aliases using clang_getTypeSpelling() is missing the
namespace they are defined in. This is in contrast to other types that always
yield the full typename including namespaces.

Patch by Michael Reiher!

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

llvm-svn: 297465
2017-03-10 15:04:58 +00:00
Gabor Horvath 829c6bc04a [analyzer] Extend block in critical section check with C11 and Pthread APIs.
Patch by Zoltan Daniel Torok!

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

llvm-svn: 297461
2017-03-10 14:50:12 +00:00
Yaxun Liu 4d86799219 [AMDGPU] Add builtin functions readlane ds_permute mov_dpp
Differential Revision: https://reviews.llvm.org/D30551

llvm-svn: 297436
2017-03-10 01:30:46 +00:00
Anna Zaks ae4772140f [analyzer] Turn suppress-c++-stdlib on by default
We have several reports of false positives coming from libc++. For example,
there are reports of false positives in std::regex, std::wcout, and also
a bunch of issues are reported in https://reviews.llvm.org/D30593. In many
cases, the analyzer trips over the complex libc++ code invariants. Let's turn
off the reports coming from these headers until we can re-evalate the support.

We can turn this back on once we individually suppress all known false
positives and perform deeper evaluation on large codebases that use libc++.
We'd also need to commit to doing these evaluations regularly as libc++
headers change.

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

llvm-svn: 297429
2017-03-10 00:33:19 +00:00
Konstantin Zhuravlyov 2b4917fcc9 [DebugInfo] Append extended dereferencing mechanism to variables' DIExpression for targets that support more than one address space
Differential Revision: https://reviews.llvm.org/D29673

llvm-svn: 297397
2017-03-09 18:06:23 +00:00
Vedant Kumar 129edab125 Retry: [ubsan] Detect UB loads from bitfields
It's possible to load out-of-range values from bitfields backed by a
boolean or an enum. Check for UB loads from bitfields.

This is the motivating example:

  struct S {
    BOOL b : 1; // Signed ObjC BOOL.
  };

  S s;
  s.b = 1; // This is actually stored as -1.
  if (s.b == 1) // Evaluates to false, -1 != 1.
    ...

Changes since the original commit:

- Single-bit bools are a special case (see CGF::EmitFromMemory), and we
  can't avoid dealing with them when loading from a bitfield. Don't try to
  insert a check in this case.

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

llvm-svn: 297389
2017-03-09 16:06:27 +00:00
Eric Fiselier 8d409e810a [coroutines] Fix assertion in DependentCoawaitExpr when the argument is non-dependent.
Summary:
A `co_await arg` expression has a dependent type whenever the promise type is still dependent, even if the argument to co_await is not. This is because we cannot attempt the `await_transform(<arg>)` until after we know the promise type.

This patch fixes an assertion in the constructor of `DependentCoawaitExpr` that asserted that `arg` must also be dependent.

Reviewers: rsmith, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 297358
2017-03-09 05:01:31 +00:00
Gor Nishanov 6dcb0eb301 [coroutines] Build and pass coroutine_handle to await_suspend
Summary:
This patch adds passing a coroutine_handle object to await_suspend calls.
It builds the coroutine_handle using coroutine_handle<PromiseType>::from_address(__builtin_coro_frame()).

(a revision of https://reviews.llvm.org/D26316 that for some reason refuses to apply via arc patch)

Reviewers: GorNishanov

Subscribers: mehdi_amini, cfe-commits, EricWF

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

llvm-svn: 297356
2017-03-09 03:09:43 +00:00
Richard Smith 3f57cff1e8 Fix handling of -fmodule-map-file=X where X has no directory component.
llvm-svn: 297349
2017-03-09 00:58:22 +00:00
Vedant Kumar 3dea91fec6 Revert "[ubsan] Detect UB loads from bitfields"
This reverts commit r297298. It breaks the self-host on this bot:

  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/962/steps/build%20clang%2Fubsan/logs/stdio

llvm-svn: 297331
2017-03-09 00:18:53 +00:00
Anna Zaks 12d0c8d662 [analyzer] Extend taint propagation and checking to support LazyCompoundVal
A patch by Vlad Tsyrklevich!

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

llvm-svn: 297326
2017-03-09 00:01:16 +00:00
Anna Zaks 37faed97c1 [analyzer] Improve usability of ExprInspectionChecker
Some of the magic functions take arguments of arbitrary type. However,
for semantic correctness, the compiler still requires a declaration
of these functions with the correct type. Since C does not have
argument-type-overloaded function, this made those functions hard to
use in C code. Improve this situation by allowing arbitrary suffixes
in the affected magic functions' names, thus allowing the user to
create different declarations for different types.

A patch by Keno Fischer!

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

llvm-svn: 297325
2017-03-09 00:01:10 +00:00
Anna Zaks d4e43ae22a [analyzer] Add bug visitor for taint checker.
Add a bug visitor to the taint checker to make it easy to distinguish where
the tainted value originated. This is especially useful when the original
taint source is obscured by complex data flow.

A patch by Vlad Tsyrklevich!

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

llvm-svn: 297324
2017-03-09 00:01:07 +00:00
Anna Zaks bbec97ca2c [analyzer] Teach the MallocChecker about about Glib API
A patch by Leslie Zhai!

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

llvm-svn: 297323
2017-03-09 00:01:01 +00:00
Konstantin Zhuravlyov d1ba16e762 [DebugInfo] Add address space when creating DIDerivedTypes
Differential Revision: https://reviews.llvm.org/D29671

llvm-svn: 297321
2017-03-08 23:56:48 +00:00
Richard Smith a54d32404c Take into account C++17's noexcept function types during merging -- it should
be possible to merge a declaration with an unresolved function type against one
with a resolved function type.

llvm-svn: 297316
2017-03-08 23:00:26 +00:00
Vedant Kumar 5c13623a69 [ubsan] Detect UB loads from bitfields
It's possible to load out-of-range values from bitfields backed by a
boolean or an enum. Check for UB loads from bitfields.

This is the motivating example:

  struct S {
    BOOL b : 1; // Signed ObjC BOOL.
  };

  S s;
  s.b = 1; // This is actually stored as -1.
  if (s.b == 1) // Evaluates to false, -1 != 1.
    ...

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

llvm-svn: 297298
2017-03-08 17:38:57 +00:00
Daniel Marjamaki 3d8d6ed01f [analyzer] Clarify 'uninitialized function argument' messages
Differential Revision: https://reviews.llvm.org/D30341

llvm-svn: 297283
2017-03-08 15:22:24 +00:00
Roger Ferrer Ibanez 3fa38a14ac Honor __unaligned in codegen for declarations and expressions
This patch honors the unaligned type qualifier (currently available through he
keyword __unaligned and -fms-extensions) in CodeGen. In the current form the
patch affects declarations and expressions. It does not affect fields of
classes.

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

llvm-svn: 297276
2017-03-08 14:00:44 +00:00
Jonas Hahnfeld bf5061b18c [test] Unbreak OpenMP/linking.c with arch-specific libdir
After rL296927, -rpath gets added after linking the OpenMP runtime.
That's why -lgcc does not immediately follow -lomp or -lgomp.

llvm-svn: 297264
2017-03-08 09:07:33 +00:00
Richard Trieu 33562c2dcc [ODRHash] Hash typedefs and usings statements in classes.
llvm-svn: 297246
2017-03-08 00:13:19 +00:00
Joel Jones 15467df982 [AArch64] Vulcan is now ThunderXT99
Broadcom Vulcan is now Cavium ThunderX2T99.

LLVM Bugzilla: http://bugs.llvm.org/show_bug.cgi?id=32113
Corresponding LLVM change: https://reviews.llvm.org/rL297190

Changes to clang to support the change.

Patch by Joel Jones

llvm-svn: 297227
2017-03-07 21:24:53 +00:00
Gor Nishanov c611ab251b [coroutines] update coro_end builtin to match llvm
Summary: llvm.coro.end intrinsic now returns bool. Updating clang to match it.

Reviewers: GorNishanov, rsmith

Reviewed By: rsmith

Subscribers: mehdi_amini, cfe-commits, EricWF

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

llvm-svn: 297224
2017-03-07 21:01:08 +00:00
Taewook Oh 06b1af5bf1 Use filename in linemarker when compiling preprocessed source (Revised)
Summary:
This is a revised version of D28796. Included test is changed to
resolve the target compatibility issue reported (rL293032).

Reviewers: inglorion, dblaikie, echristo, aprantl, probinson

Reviewed By: inglorion

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 297194
2017-03-07 20:20:23 +00:00
Sanjay Patel 3a8ec02743 fix test to not check optimized IR; NFCI
This test broke with an LLVM instcombine patch (r297166).
I changed the RUN line to only run -mem2reg (to save time checking this large chunk of tests)
and updated the checks using the script attached to D17999:
https://reviews.llvm.org/D17999

The goal is to make this test immune to optimizer changes. If there's something in these
tests that was checking for an IR optimization, that should be tested in LLVM, not Clang.

llvm-svn: 297189
2017-03-07 19:24:54 +00:00
Daniel Marjamaki cf715bd330 [analyzer] Fix crashes in CastToStruct checker for undefined structs
This crash was reported in https://bugs.llvm.org//show_bug.cgi?id=31173

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

llvm-svn: 297187
2017-03-07 19:20:48 +00:00
Gabor Horvath dbf2790a1f [analyzer] Improve valist checks and move it out from alpha state.
This patch makes the valist check more robust to the different AST variants on
different platforms and also fixes a FIXME.

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

llvm-svn: 297153
2017-03-07 16:04:23 +00:00
Argyrios Kyrtzidis a9706998f2 [index] Mark categories of test classes with the 'UnitTest' symbol property as well.
llvm-svn: 297133
2017-03-07 09:38:08 +00:00
Argyrios Kyrtzidis a166a2b633 [AST/ObjC] Make ObjCCategoryImplDecl consistent with ObjCCategoryDecl and use the category name as its DeclName
This also addresses the badness in ObjCCategoryImplDecl's API, which was hiding NamedDecl's APIs with different meaning.

llvm-svn: 297131
2017-03-07 09:26:07 +00:00
Reid Kleckner ef23e9574e Relax stmtexpr.cpp checks for PPC64
llvm-svn: 297099
2017-03-06 23:49:18 +00:00
Brad Smith 8e55bd5bbd Set the Int64Type / IntMaxType types correctly for OpenBSD/mips64
llvm-svn: 297098
2017-03-06 23:48:31 +00:00
Eric Fiselier 20f25cb6df [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.
Summary:
The changes contained in this patch are:

1. Defines a new AST node `CoawaitDependentExpr` for representing co_await expressions while the promise type is still dependent.
2. Correctly detect and transform the 'co_await' operand to  `p.await_transform(<expr>)`  when possible.
3. Change the initial/final suspend points to build during the initial parse, so they have the correct operator co_await lookup results.
4.  Fix transformation of the CoroutineBodyStmt so that it doesn't re-build the final/initial suspends.


@rsmith: This change is a little big, but it's not trivial for me to split it up. Please let me know if you would prefer this submitted as multiple patches.



Reviewers: rsmith, GorNishanov

Reviewed By: rsmith

Subscribers: ABataev, rsmith, mehdi_amini, cfe-commits

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

llvm-svn: 297093
2017-03-06 23:38:15 +00:00
Eric Fiselier 89bf0e725f [coroutines] Improve diagnostics when building implicit constructs.
Previously when a coroutine was building the implicit setup/destroy
constructs it would emit diagostics about failures on the first co_await/co_return/co_yield
it encountered. This was confusing because that construct may not itself be ill-formed.

This patch moves the diagnostics to the function start instead.

llvm-svn: 297089
2017-03-06 22:52:28 +00:00
Reid Kleckner 092d065265 Don't assume cleanup emission preserves dominance in expr evaluation
Summary:
Because of the existence branches out of GNU statement expressions, it
is possible that emitting cleanups for a full expression may cause the
new insertion point to not be dominated by the result of the inner
expression. Consider this example:

  struct Foo { Foo(); ~Foo(); int x; };
  int g(Foo, int);
  int f(bool cond) {
    int n = g(Foo(), ({ if (cond) return 0; 42; }));
    return n;
  }

Before this change, result of the call to 'g' did not dominate its use
in the store to 'n'. The early return exit from the statement expression
branches to a shared cleanup block, which ends in a switch between the
fallthrough destination (the assignment to 'n') or the function exit
block.

This change solves the problem by spilling and reloading expression
evaluation results when any of the active cleanups have branches.

I audited the other call sites of enterFullExpression, and they don't
appear to keep and Values live across the site of the cleanup, except in
ARC code. I wasn't able to create a test case for ARC that exhibits this
problem, though.

Reviewers: rjmccall, rsmith

Subscribers: cfe-commits

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

llvm-svn: 297084
2017-03-06 22:18:34 +00:00
Gor Nishanov 90be1213d2 [coroutines] Add co_return statement emission
Summary:
Added co_return statement emission.

Tweaked coro-alloc.cpp test to use co_return to trigger coroutine processing instead of co_await, since this change starts emitting the body of the coroutine and await expression handling has not been upstreamed yet.

Reviewers: rsmith, majnemer, EricWF, aaron.ballman

Reviewed By: rsmith

Subscribers: majnemer, llvm-commits, mehdi_amini

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

llvm-svn: 297076
2017-03-06 21:12:54 +00:00
Reid Kleckner b04cb9ab7a [MS] Add support for __ud2 and __int2c MSVC intrinsics
This was requested in PR31958 and elsewhere.

llvm-svn: 297057
2017-03-06 19:43:16 +00:00
Vassil Vassilev cccdd330f2 [modules] Add missing test from r297030.
llvm-svn: 297037
2017-03-06 17:47:57 +00:00
Alex Lorenz 0e23c61c87 [Sema][ObjC] Warn about 'performSelector' calls with selectors
that return record or vector types

The performSelector family of methods from Foundation use objc_msgSend to
dispatch the selector invocations to objects. However, method calls to methods
that return record types might have to use the objc_msgSend_stret as the return
value won't find into the register. This is also supported by this sentence from
performSelector documentation: "The method should not have a significant return
value and should take a single argument of type id, or no arguments". This
commit adds a new warning that warns when a selector which corresponds to a
method that returns a record type is passed into performSelector.

rdar://12056271

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

llvm-svn: 297019
2017-03-06 15:58:34 +00:00
Anton Korobeynikov 3bf6fc2490 Do not include GCC "resource" directory into the set of built-in include paths on MingW.
Patch by Mateusz Mikuła.

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

llvm-svn: 297005
2017-03-06 09:32:56 +00:00
Dean Michael Berris 418da3fe80 [XRay] [clang] Allow logging the first argument of a function call.
Summary:
Functions with the "xray_log_args" attribute will tell LLVM to emit a special
XRay sled for compiler-rt to copy any call arguments to your logging handler.

Reviewers: dberris

Reviewed By: dberris

Subscribers: cfe-commits

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

llvm-svn: 296999
2017-03-06 07:08:21 +00:00
Vedant Kumar ed00ea084e [ubsan] Extend the nonnull arg check to ObjC
UBSan's nonnull argument check applies when a parameter has the
"nonnull" attribute. The check currently works for FunctionDecls, but
not for ObjCMethodDecls. This patch extends the check to work for ObjC.

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

llvm-svn: 296996
2017-03-06 05:28:22 +00:00
Argyrios Kyrtzidis 898c241b26 [index] C++: Improve handling of typedefs as base names in C++ class declarations
Report the typedef as reference, and desugar it to report the underlying class as an
implicit 'base' reference.
Reporting the underlying base class for 'base' relations matches the ObjC handling and
leads to a simpler model.

llvm-svn: 296975
2017-03-04 17:54:56 +00:00
Argyrios Kyrtzidis 266cfa30dc [index] ObjC: Improve handling of typedefs as base names in ObjC interface declarations
- Report the typedef reference occurrence
- Mark super or protocol references as 'implicit' when they come from a typedef.

llvm-svn: 296974
2017-03-04 17:54:53 +00:00
Richard Trieu f4b54fe64b [ODRHash] Try again to fix build bot.
llvm-svn: 296958
2017-03-04 03:04:15 +00:00
Richard Trieu 054c35c0c1 [ODRHash] Change test to try to appease buildbot.
llvm-svn: 296953
2017-03-04 02:05:13 +00:00
Richard Trieu 583e2c175a [ODRHash] Add support for detecting different method properties.
Now print diagnostics for static, virtual, inline, volatile, and const
differences in methods.  Also use DeclarationName instead of IdentifierInfo
for additional robustness in diagnostic printing.

llvm-svn: 296932
2017-03-04 00:08:58 +00:00