]> granicus.if.org Git - clang/log
clang
5 years agoRemove redundant FunctionDecl argument from a couple functions.
James Y Knight [Sat, 2 Feb 2019 01:48:23 +0000 (01:48 +0000)]
Remove redundant FunctionDecl argument from a couple functions.

This argument was added in r254554 in order to support the
pass_object_size attribute. However, in r296076, the attribute's
presence is now also represented in FunctionProtoType's
ExtParameterInfo, and thus it's unnecessary to pass along a separate
FunctionDecl.

The functions modified are:
 RequiredArgs::forPrototype{,Plus}, and
 CodeGenTypes::ConvertFunctionType.

After this, it's also (again) unnecessary to have a separate
ConvertFunctionType function ConvertType, so convert callers back to
the latter, leaving the former as an internal helper function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352946 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Hotfix for RetainCountChecker: assert was too strong.
George Karpenkov [Fri, 1 Feb 2019 23:06:44 +0000 (23:06 +0000)]
[analyzer] Hotfix for RetainCountChecker: assert was too strong.

Bridged casts can happen to non-CF objects as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352938 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Fix ImportName's position in this test.
Dan Gohman [Fri, 1 Feb 2019 22:52:29 +0000 (22:52 +0000)]
[WebAssembly] Fix ImportName's position in this test.

This is a follow-up to r352930.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352936 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks"
Roman Lebedev [Fri, 1 Feb 2019 22:43:08 +0000 (22:43 +0000)]
Revert "[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks"

Further reviews (D57594, D57615) have revealed that this was not reviewed,
and that the differential's description was not read during the review,
thus rendering this commit invalid.

This reverts commit r352882.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352933 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Add an import_field function attribute
Dan Gohman [Fri, 1 Feb 2019 22:25:23 +0000 (22:25 +0000)]
[WebAssembly] Add an import_field function attribute

This is similar to import_module, but sets the import field name
instead.

By default, the import field name is the same as the C/asm/.o symbol
name. However, there are situations where it's useful to have it be
different. For example, suppose I have a wasm API with a module named
"pwsix" and a field named "read". There's no risk of namespace
collisions with user code at the wasm level because the generic name
"read" is qualified by the module name "pwsix". However in the C/asm/.o
namespaces, the module name is not used, so if I have a global function
named "read", it is intruding on the user's namespace.

With the import_field module, I can declare my function (in libc) to be
"__read", and then set the wasm import module to be "pwsix" and the wasm
import field to be "read". So at the C/asm/.o levels, my symbol is
outside the user namespace.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352930 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoImprove diagnostic to tell you a type is incomplete.
Eric Fiselier [Fri, 1 Feb 2019 22:06:02 +0000 (22:06 +0000)]
Improve diagnostic to tell you a type is incomplete.

I recently ran into this code:
```
\#include <iostream>
void foo(const std::string &s, const std::string& = "");
\#include <string>
void test() { foo(""); }
```

The diagnostic produced said it can't bind char[1] to std::string
const&. It didn't mention std::string is incomplete. The user had to
infer that.

This patch causes the diagnostic to now say "incomplete type".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352927 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFactor out duplication between ExprIterator and ConstExprIterator.
Richard Smith [Fri, 1 Feb 2019 21:58:17 +0000 (21:58 +0000)]
Factor out duplication between ExprIterator and ConstExprIterator.

This also exposes a more general iterator cast mechanism suitable for
use in http://reviews.llvm.org/D56571.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352925 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDon't use ASTContext in DeclOpenMP.h because it's still incomplete.
Eric Fiselier [Fri, 1 Feb 2019 21:19:20 +0000 (21:19 +0000)]
Don't use ASTContext in DeclOpenMP.h because it's still incomplete.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352919 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.
Michael Kruse [Fri, 1 Feb 2019 20:25:04 +0000 (20:25 +0000)]
[OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.

This patch implements parsing and sema for "omp declare mapper"
directive. User defined mapper, i.e., declare mapper directive, is a new
feature in OpenMP 5.0. It is introduced to extend existing map clauses
for the purpose of simplifying the copy of complex data structures
between host and device (i.e., deep copy). An example is shown below:

    struct S {  int len;  int *d; };
    #pragma omp declare mapper(struct S s) map(s, s.d[0:s.len]) // Memory region that d points to is also mapped using this mapper.

Contributed-by: Lingda Li <lildmh@gmail.com>
Differential Revision: https://reviews.llvm.org/D56326

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352906 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUpdate SanitizerCoverage doc regarding the issue with pc-table and gc-sections.
Max Moroz [Fri, 1 Feb 2019 17:12:35 +0000 (17:12 +0000)]
Update SanitizerCoverage doc regarding the issue with pc-table and gc-sections.

Summary:
There is a bug for this: https://bugs.llvm.org/show_bug.cgi?id=34636
But it would be also helpful to leave a note in the docs to prevent users from
running into issues, e.g. https://crbug.com/926588.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: cfe-commits, llvm-commits, kcc

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352890 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix some sphinx doc errors.
James Y Knight [Fri, 1 Feb 2019 17:06:41 +0000 (17:06 +0000)]
Fix some sphinx doc errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352887 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks
Roman Lebedev [Fri, 1 Feb 2019 15:41:54 +0000 (15:41 +0000)]
[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks

Summary:
I'm working on a clang-tidy check, much like existing [[ http://clang.llvm.org/extra/clang-tidy/checks/bugprone-exception-escape.html | bugprone-exception-escape ]],
to detect when an exception might escape out of an OpenMP construct it isn't supposed to escape from.
For that i will be using the `nothrow` bit of `CapturedDecl`s.

While that bit is already correctly set for some constructs, e.g. `#pragma omp parallel`: https://godbolt.org/z/2La7pv
it isn't set for the `#pragma omp sections`, or `#pragma omp section`: https://godbolt.org/z/qZ-EbP

If i'm reading [[ https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf | `OpenMP Application Programming Interface Version 5.0 November 2018` ]] correctly,
they should be, as per `2.8.1 sections Construct`, starting with page 86:
* The sections construct is a non-iterative worksharing construct that contains a set of **structured blocks**
  that are to be distributed among and executed by the threads in a team. Each **structured block** is executed
  once by one of the threads in the team in the context of its implicit task.
* The syntax of the sections construct is as follows:
  #pragma omp sections [clause[ [,] clause] ... ] new-line
    {
      [#pragma omp section new-line]
        **structured-block**
   ...
* Description
  Each **structured block** in the sections construct is preceded by a section directive except
  possibly **the first block**, for which a preceding section directive is optional.

* Restrictions
  • The code enclosed in a sections construct must be a **structured block**.
  * A throw executed inside a sections region must cause execution to resume within the same
    section of the sections region, and the same thread that threw the exception must catch it.

Reviewers: ABataev, #openmp

Reviewed By: ABataev

Subscribers: guansong, openmp-commits, cfe-commits

Tags: #clang, #openmp

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352882 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake] External compiler-rt-configure requires LLVMTestingSupport when including...
Stefan Granitz [Fri, 1 Feb 2019 15:35:25 +0000 (15:35 +0000)]
[CMake] External compiler-rt-configure requires LLVMTestingSupport when including tests

Summary:
Apparently `LLVMTestingSupport` must be built before `llvm-config` can be asked for it. Symptom with `LLVM_INCLUDE_TESTS=ON` is:
```
$ ./path/to/llvm-build/bin/llvm-config --ldflags --libs testingsupport
-L/path/to/llvm-build/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names
llvm-config: error: component libraries and shared library

llvm-config: error: missing: /path/to/llvm-build/lib/libLLVMTestingSupport.a
```

With `LLVMTestingSupport` as dependency of `compiler-rt-configure` we get the expected behavior:
```
$ ./path/to/llvm-build/bin/llvm-config --ldflags --libs testingsupport
-L/path/to/llvm-build/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names
-lLLVMTestingSupport -lLLVMSupport -lLLVMDemangle
```

Reviewers: ab, beanz

Subscribers: dberris, mgorny, erik.pilkington, llvm-commits, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352881 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libclang] Fix -DBUILD_SHARED_LIBS=on build after rC352803
Fangrui Song [Fri, 1 Feb 2019 14:31:01 +0000 (14:31 +0000)]
[libclang] Fix -DBUILD_SHARED_LIBS=on build after rC352803

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352872 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CUDA] Relax lit test condition after r352798.
Eric Liu [Fri, 1 Feb 2019 11:36:23 +0000 (11:36 +0000)]
[CUDA] Relax lit test condition after r352798.

Clang executable doesn't match clang.* in all test environment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352865 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDisable tidy checks with too many hits
Ilya Biryukov [Fri, 1 Feb 2019 11:20:13 +0000 (11:20 +0000)]
Disable tidy checks with too many hits

Summary:
Some tidy checks have too many hits in the codebase, making it hard to spot
other results from clang-tidy, therefore rendering the tool less useful.

Two checks were disabled:
  - misc-non-private-member-variable-in-classes in the whole LLVM monorepo,
    it is very common to have those in LLVM and the style guide does not forbid
    them.
  - readability-identifier-naming in the clang subtree. There are thousands of
    violations in 'Sema.h' alone.

Before the change, 'Sema.h' had >1000 tidy warnings, after the change the number
dropped to 3 warnings (unterminated namespace comments).

Reviewers: alexfh, hokein

Reviewed By: hokein

Subscribers: llvm-commits, cfe-commits

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352862 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoProvide reason messages for unviable inlining
Yevgeny Rouban [Fri, 1 Feb 2019 10:44:43 +0000 (10:44 +0000)]
Provide reason messages for unviable inlining

InlineCost's isInlineViable() is changed to return InlineResult
instead of bool. This provides messages for failure reasons and
allows to get more specific messages for cases where callsites
are not viable for inlining.

Reviewed By: xbolva00, anemet

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352849 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTest commit: fix typo
Sergi Mateo Bellido [Fri, 1 Feb 2019 08:39:01 +0000 (08:39 +0000)]
Test commit: fix typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352842 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix isInSystemMacro to handle pasted macros
Serge Guelton [Fri, 1 Feb 2019 06:11:44 +0000 (06:11 +0000)]
Fix isInSystemMacro to handle pasted macros

Token pasted by the preprocessor (through ##) have a Spelling pointing to scratch buffer.
As a result they are not recognized at system macro, even though the pasting happened in
a system macro. Fix that by looking into the parent macro if the original lookup finds a
scratch buffer.

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

This effectively fixes https://bugs.llvm.org/show_bug.cgi?id=35268,

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352838 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SemaCXX] Param diagnostic matches overload logic
Brian Gesiak [Fri, 1 Feb 2019 03:30:29 +0000 (03:30 +0000)]
[SemaCXX] Param diagnostic matches overload logic

Summary:
Given the following test program:

```
class C {
public:
  int A(int a, int& b);
};

int C::A(const int a, int b) {
  return a * b;
}
```

Clang would produce an error message that correctly diagnosed the
redeclaration of `C::A` to not match the original declaration (the
parameters to the two declarations do not match -- the original takes an
`int &` as its 2nd parameter, but the redeclaration takes an `int`). However,
it also produced a note diagnostic that inaccurately pointed to the
first parameter, claiming that `const int` in the redeclaration did not
match the unqualified `int` in the original. The diagnostic is
misleading because it has nothing to do with why the program does not
compile.

The logic for checking for a function overload, in
`Sema::FunctionParamTypesAreEqual`, discards cv-qualifiers before
checking whether the types are equal. Do the same when producing the
overload diagnostic.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cpplearner, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352831 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn...
Julian Lettner [Fri, 1 Feb 2019 02:51:00 +0000 (02:51 +0000)]
[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls

Summary:
UBSan wants to detect when unreachable code is actually reached, so it
adds instrumentation before every unreachable instruction. However, the
optimizer will remove code after calls to functions marked with
noreturn. To avoid this UBSan removes noreturn from both the call
instruction as well as from the function itself. Unfortunately, ASan
relies on this annotation to unpoison the stack by inserting calls to
_asan_handle_no_return before noreturn functions. This is important for
functions that do not return but access the the stack memory, e.g.,
unwinder functions *like* longjmp (longjmp itself is actually
"double-proofed" via its interceptor). The result is that when ASan and
UBSan are combined, the noreturn attributes are missing and ASan cannot
unpoison the stack, so it has false positives when stack unwinding is
used.

Changes:
Clang-CodeGen now directly insert calls to `__asan_handle_no_return`
when a call to a noreturn function is encountered and both
UBsan-unreachable and ASan are enabled. This allows UBSan to continue
removing the noreturn attribute from functions without any changes to
the ASan pass.

Previously generated code:
```
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

Generated code (for now):
```
  call void @__asan_handle_no_return
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

rdar://problem/40723397

Reviewers: delcypher, eugenis, vsk

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

llvm-svn: 352690

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352829 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[opaque pointer types] Add a FunctionCallee wrapper type, and use it.
James Y Knight [Fri, 1 Feb 2019 02:28:03 +0000 (02:28 +0000)]
[opaque pointer types] Add a FunctionCallee wrapper type, and use it.

Recommit r352791 after tweaking DerivedTypes.h slightly, so that gcc
doesn't choke on it, hopefully.

Original Message:
The FunctionCallee type is effectively a {FunctionType*,Value*} pair,
and is a useful convenience to enable code to continue passing the
result of getOrInsertFunction() through to EmitCall, even once pointer
types lose their pointee-type.

Then:
- update the CallInst/InvokeInst instruction creation functions to
  take a Callee,
- modify getOrInsertFunction to return FunctionCallee, and
- update all callers appropriately.

One area of particular note is the change to the sanitizer
code. Previously, they had been casting the result of
`getOrInsertFunction` to a `Function*` via
`checkSanitizerInterfaceFunction`, and storing that. That would report
an error if someone had already inserted a function declaraction with
a mismatching signature.

However, in general, LLVM allows for such mismatches, as
`getOrInsertFunction` will automatically insert a bitcast if
needed. As part of this cleanup, cause the sanitizer code to do the
same. (It will call its functions using the expected signature,
however they may have been declared.)

Finally, in a small number of locations, callers of
`getOrInsertFunction` actually were expecting/requiring that a brand
new function was being created. In such cases, I've switched them to
Function::Create instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352827 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] [RetainCountChecker] Fix object type for CF/Obj-C bridged casts
George Karpenkov [Fri, 1 Feb 2019 02:13:02 +0000 (02:13 +0000)]
[analyzer] [RetainCountChecker] Fix object type for CF/Obj-C bridged casts

Having an incorrect type for a cast causes the checker to incorrectly
dismiss the operation under ARC, leading to a false positive
use-after-release on the test.

rdar://47709885

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352824 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed"
Akira Hatanaka [Fri, 1 Feb 2019 00:12:06 +0000 (00:12 +0000)]
Revert "[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed"

This reverts commit r350920 as it is not clear whether we should force a
class to be returned in registers when copy and move constructors are
both deleted.

For more background, see the following discussion:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190128/259907.html

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352822 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[sanitizer-coverage] prune trace-cmp instrumentation for CMP isntructions that feed...
Kostya Serebryany [Thu, 31 Jan 2019 23:43:00 +0000 (23:43 +0000)]
[sanitizer-coverage] prune trace-cmp instrumentation for CMP isntructions that feed into the backedge branch. Instrumenting these CMP instructions is almost always useless (and harmful) for fuzzing

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352818 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRe-disable pch-from-libclang.c after 352803, some buildbots are still unhappy
Nico Weber [Thu, 31 Jan 2019 22:57:52 +0000 (22:57 +0000)]
Re-disable pch-from-libclang.c after 352803, some buildbots are still unhappy

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352809 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTDump] Make template specialization tests more exact
Stephen Kelly [Thu, 31 Jan 2019 22:28:38 +0000 (22:28 +0000)]
[ASTDump] Make template specialization tests more exact

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352804 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMake clang/test/Index/pch-from-libclang.c pass in more places
Nico Weber [Thu, 31 Jan 2019 22:15:32 +0000 (22:15 +0000)]
Make clang/test/Index/pch-from-libclang.c pass in more places

- fixes the test on macOS with LLVM_ENABLE_PIC=OFF
- together with D57343, gets the test to pass on Windows
- makes it run everywhere (it seems to just pass on Linux)

The main change is to pull out the resource directory computation into a
function shared by all 3 places that do it. In CIndexer.cpp, this now works no
matter if libclang is in lib/ or bin/ or statically linked to a binary in bin/.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352803 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDo not copy long double and 128-bit fp format from aux target for AMDGPU
Yaxun Liu [Thu, 31 Jan 2019 21:57:51 +0000 (21:57 +0000)]
Do not copy long double and 128-bit fp format from aux target for AMDGPU

rC352620 caused regressions because it copied floating point format from
aux target.

floating point format decides whether extended long double is supported.
It is x86_fp80 on x86 but IEEE double on amdgcn.

Document usage of long doubel type in HIP programming guide
https://github.com/ROCm-Developer-Tools/HIP/pull/890

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352801 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[opaque pointer types] Add a FunctionCallee wrapper type, and use it."
James Y Knight [Thu, 31 Jan 2019 21:51:58 +0000 (21:51 +0000)]
Revert "[opaque pointer types] Add a FunctionCallee wrapper type, and use it."

This reverts commit f47d6b38c7a61d50db4566b02719de05492dcef1 (r352791).

Seems to run into compilation failures with GCC (but not clang, where
I tested it). Reverting while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352800 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CUDA] add support for the new kernel launch API in CUDA-9.2+.
Artem Belevich [Thu, 31 Jan 2019 21:34:03 +0000 (21:34 +0000)]
[CUDA] add support for the new kernel launch API in CUDA-9.2+.

Instead of calling CUDA runtime to arrange function arguments,
the new API constructs arguments in a local array and the kernels
are launched with __cudaLaunchKernel().

The old API has been deprecated and is expected to go away
in the next CUDA release.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352799 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CUDA] Propagate detected version of CUDA to cc1
Artem Belevich [Thu, 31 Jan 2019 21:32:24 +0000 (21:32 +0000)]
[CUDA] Propagate detected version of CUDA to cc1

..and use it to control that parts of CUDA compilation
that depend on the specific version of CUDA SDK.

This patch has a placeholder for a 'new launch API' support
which is in a separate patch. The list will be further
extended in the upcoming patch to support CUDA-10.1.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352798 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Add bulk memory target feature
Thomas Lively [Thu, 31 Jan 2019 21:02:19 +0000 (21:02 +0000)]
[WebAssembly] Add bulk memory target feature

Summary: Also clean up some preexisting target feature code.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, jfb

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352793 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[opaque pointer types] Add a FunctionCallee wrapper type, and use it.
James Y Knight [Thu, 31 Jan 2019 20:35:56 +0000 (20:35 +0000)]
[opaque pointer types] Add a FunctionCallee wrapper type, and use it.

The FunctionCallee type is effectively a {FunctionType*,Value*} pair,
and is a useful convenience to enable code to continue passing the
result of getOrInsertFunction() through to EmitCall, even once pointer
types lose their pointee-type.

Then:
- update the CallInst/InvokeInst instruction creation functions to
  take a Callee,
- modify getOrInsertFunction to return FunctionCallee, and
- update all callers appropriately.

One area of particular note is the change to the sanitizer
code. Previously, they had been casting the result of
`getOrInsertFunction` to a `Function*` via
`checkSanitizerInterfaceFunction`, and storing that. That would report
an error if someone had already inserted a function declaraction with
a mismatching signature.

However, in general, LLVM allows for such mismatches, as
`getOrInsertFunction` will automatically insert a bitcast if
needed. As part of this cleanup, cause the sanitizer code to do the
same. (It will call its functions using the expected signature,
however they may have been declared.)

Finally, in a small number of locations, callers of
`getOrInsertFunction` actually were expecting/requiring that a brand
new function was being created. In such cases, I've switched them to
Function::Create instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352791 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeComplete] Propagate preferred types through parser in more cases
Ilya Biryukov [Thu, 31 Jan 2019 20:20:32 +0000 (20:20 +0000)]
[CodeComplete] Propagate preferred types through parser in more cases

Preferred types are used by code completion for ranking. This commit
considerably increases the number of points in code where those types
are propagated.

In order to avoid complicating signatures of Parser's methods, a
preferred type is kept as a member variable in the parser and updated
during parsing.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352788 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAccomodate gcc 7.3.0's -Wdangling-else
Nico Weber [Thu, 31 Jan 2019 15:26:03 +0000 (15:26 +0000)]
Accomodate gcc 7.3.0's -Wdangling-else

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352761 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenCL] Fixed addr space manging test.
Anastasia Stulova [Thu, 31 Jan 2019 15:23:48 +0000 (15:23 +0000)]
[OpenCL] Fixed addr space manging test.

Fixed typo in the Filecheck directive and changed the
test to verify output correctly.

Fixes PR40029!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352760 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of...
Eric Liu [Thu, 31 Jan 2019 14:20:02 +0000 (14:20 +0000)]
Revert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls"

This reverts commit r352690. This causes clang to crash. Sent reproducer to the
author in the orginal commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352755 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "Support attribute used in member funcs of class templates"
Rafael Auler [Thu, 31 Jan 2019 13:31:33 +0000 (13:31 +0000)]
Revert "Support attribute used in member funcs of class templates"

This reverts commit 352740: broke swift build

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352748 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSupport attribute used in member funcs of class templates
Rafael Auler [Thu, 31 Jan 2019 09:38:31 +0000 (09:38 +0000)]
Support attribute used in member funcs of class templates

Summary:
As PR17480 describes, clang does not support the used attribute
for member functions of class templates. This means that if the member
function is not used, its definition is never instantiated. This patch
changes clang to emit the definition if it has the used attribute.

Test Plan: Added a testcase

Reviewed By: aaron.ballman

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352740 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[CMake] Unify scripts for generating VCS headers"
Petr Hosek [Thu, 31 Jan 2019 07:12:43 +0000 (07:12 +0000)]
Revert "[CMake] Unify scripts for generating VCS headers"

This reverts commits r352729 and r352731: this broke Sanitizer Windows bots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352733 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake] Unify scripts for generating VCS headers
Petr Hosek [Thu, 31 Jan 2019 06:21:01 +0000 (06:21 +0000)]
[CMake] Unify scripts for generating VCS headers

Previously, there were two different scripts for generating VCS headers:
one used by LLVM and one used by Clang. They were both similar, but
different. They were both broken in their own ways, for example the one
used by Clang didn't properly handle monorepo resulting in an incorrect
version information reported by Clang.

This change unifies two the scripts by introducing a new script that's
used from both LLVM and Clang, ensures that the new script supports both
monorepo and standalone SVN and Git setups, and removes the old scripts.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352729 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Make NullReturnedFromNonnullChecker depend on NullabilityBase
Kristof Umann [Wed, 30 Jan 2019 23:48:37 +0000 (23:48 +0000)]
[analyzer] Make NullReturnedFromNonnullChecker depend on NullabilityBase

Accidentally left this dependency out after D54438.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352693 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn...
Julian Lettner [Wed, 30 Jan 2019 23:42:13 +0000 (23:42 +0000)]
[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls

Summary:
UBSan wants to detect when unreachable code is actually reached, so it
adds instrumentation before every unreachable instruction. However, the
optimizer will remove code after calls to functions marked with
noreturn. To avoid this UBSan removes noreturn from both the call
instruction as well as from the function itself. Unfortunately, ASan
relies on this annotation to unpoison the stack by inserting calls to
_asan_handle_no_return before noreturn functions. This is important for
functions that do not return but access the the stack memory, e.g.,
unwinder functions *like* longjmp (longjmp itself is actually
"double-proofed" via its interceptor). The result is that when ASan and
UBSan are combined, the noreturn attributes are missing and ASan cannot
unpoison the stack, so it has false positives when stack unwinding is
used.

Changes:
Clang-CodeGen now directly insert calls to `__asan_handle_no_return`
when a call to a noreturn function is encountered and both
UBsan-unreachable and ASan are enabled. This allows UBSan to continue
removing the noreturn attribute from functions without any changes to
the ASan pass.

Previously generated code:
```
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

Generated code (for now):
```
  call void @__asan_handle_no_return
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

rdar://problem/40723397

Reviewers: delcypher, eugenis, vsk

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352690 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGenObjC] Handle exceptions when calling objc_alloc or objc_allocWithZone
Erik Pilkington [Wed, 30 Jan 2019 23:17:38 +0000 (23:17 +0000)]
[CodeGenObjC] Handle exceptions when calling objc_alloc or objc_allocWithZone

objc_alloc and objc_allocWithZone may throw exceptions if the
underlying method does. If we're in a @try block, then make sure we
emit an invoke instead of a call.

rdar://47610407

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352687 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTDump] Inline traverse methods into class
Stephen Kelly [Wed, 30 Jan 2019 21:48:32 +0000 (21:48 +0000)]
[ASTDump] Inline traverse methods into class

This API will be extracted into a new template class.  This change will
make the follow-up commit easier to review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352676 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDon't define __has_feature(objc_fixed_enum) in non-objc mode
Erik Pilkington [Wed, 30 Jan 2019 21:14:08 +0000 (21:14 +0000)]
Don't define __has_feature(objc_fixed_enum) in non-objc mode

This is only a formal language feature in ObjC, otherwise its just an
extension. Making this change was also an ABI break.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352672 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Fix PR40536: Do not emit __kmpc_push_target_tripcount if not
Alexey Bataev [Wed, 30 Jan 2019 20:49:52 +0000 (20:49 +0000)]
[OPENMP]Fix PR40536: Do not emit __kmpc_push_target_tripcount if not
required.

Function __kmpc_push_target_tripcount should be emitted only if the
offloading entry is going to be emitted (for use in tgt_target...
functions). Otherwise, it should not be emitted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352669 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd a new builtin: __builtin_dynamic_object_size
Erik Pilkington [Wed, 30 Jan 2019 20:34:53 +0000 (20:34 +0000)]
Add a new builtin: __builtin_dynamic_object_size

This builtin has the same UI as __builtin_object_size, but has the
potential to be evaluated dynamically. It is meant to be used as a
drop-in replacement for libraries that use __builtin_object_size when
a dynamic checking mode is enabled. For instance,
__builtin_object_size fails to provide any extra checking in the
following function:

  void f(size_t alloc) {
    char* p = malloc(alloc);
    strcpy(p, "foobar"); // expands to __builtin___strcpy_chk(p, "foobar", __builtin_object_size(p, 0))
  }

This is an overflow if alloc < 7, but because LLVM can't fold the
object size intrinsic statically, it folds __builtin_object_size to
-1. With __builtin_dynamic_object_size, alloc is passed through to
__builtin___strcpy_chk.

rdar://32212419

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352665 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd a 'dynamic' parameter to the objectsize intrinsic
Erik Pilkington [Wed, 30 Jan 2019 20:34:35 +0000 (20:34 +0000)]
Add a 'dynamic' parameter to the objectsize intrinsic

This is meant to be used with clang's __builtin_dynamic_object_size.
When 'true' is passed to this parameter, the intrinsic has the
potential to be folded into instructions that will be evaluated
at run time. When 'false', the objectsize intrinsic behaviour is
unchanged.

rdar://32212419

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352664 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTDump] Make method definition order matches declaration order
Stephen Kelly [Wed, 30 Jan 2019 20:06:52 +0000 (20:06 +0000)]
[ASTDump] Make method definition order matches declaration order

This will make follow-up changes easier to review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352663 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTDump] Re-arrange method declarations to group Visit together
Stephen Kelly [Wed, 30 Jan 2019 20:03:47 +0000 (20:03 +0000)]
[ASTDump] Re-arrange method declarations to group Visit together

This will make follow-up commits easier to review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352661 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTDump] Rename methods which are conceptually Visits
Stephen Kelly [Wed, 30 Jan 2019 19:49:49 +0000 (19:49 +0000)]
[ASTDump] Rename methods which are conceptually Visits

This is consistent with the TextNodeDumper, and is the appropriate name
for the traverser class which will be extracted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352657 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTDump] NFC: Inline vestigial methods
Stephen Kelly [Wed, 30 Jan 2019 19:41:04 +0000 (19:41 +0000)]
[ASTDump] NFC: Inline vestigial methods

This was a porting aid.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352656 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTDump] Move Decl node dumping to TextNodeDumper
Stephen Kelly [Wed, 30 Jan 2019 19:32:48 +0000 (19:32 +0000)]
[ASTDump] Move Decl node dumping to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: jfb, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352655 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
Roman Lebedev [Wed, 30 Jan 2019 15:41:20 +0000 (15:41 +0000)]
[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

Summary:
Was trying to understand how complicated it would be to write
a clang-tidy `openmp-exception-escape`-ish check once D57100 lands.

Just so it happens, all the data is already there,
it is just conveniently omitted from AST dump.

Reviewers: aaron.ballman, steveire, ABataev

Reviewed By: ABataev

Subscribers: ABataev, guansong, cfe-commits

Tags: #openmp, #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352631 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] Fix line parsing for noexcept lambdas
Ben Hamilton [Wed, 30 Jan 2019 13:54:32 +0000 (13:54 +0000)]
[clang-format] Fix line parsing for noexcept lambdas

Summary:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" |clang-format

```
int c = [b]() mutable noexcept {
  return [&b] { return b++; }();
}
();
```
with patch:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" |bin/clang-format
```
int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();
```

Contributed by hultman.

Reviewers: benhamilton, jolesiak, klimek, Wizard

Reviewed By: benhamilton

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352622 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[HIP] Fix size_t for MSVC environment
Yaxun Liu [Wed, 30 Jan 2019 12:26:54 +0000 (12:26 +0000)]
[HIP] Fix size_t for MSVC environment

In 64 bit MSVC environment size_t is defined as unsigned long long.
In single source language like HIP, data layout should be consistent
in device and host compilation, therefore copy data layout controlling
fields from Aux target for AMDGPU target.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352620 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenGL] Fix test on PPC after r352540
Eric Liu [Wed, 30 Jan 2019 11:24:04 +0000 (11:24 +0000)]
[OpenGL] Fix test on PPC after r352540

Summary:
Specify -triple like test/SemaOpenCL/logical-ops.cl. Otherwise, this test fails
on PPC.

Reviewers: bkramer

Subscribers: Anastasia, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352618 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenCL] Add generic addr space to the return of implicit assignment.
Anastasia Stulova [Wed, 30 Jan 2019 11:18:08 +0000 (11:18 +0000)]
[OpenCL] Add generic addr space to the return of implicit assignment.

When creating the prototype of implicit assignment operators the
returned reference to the class should be qualified with the same
addr space as 'this' (i.e. __generic in OpenCL).

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352617 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
Michal Gorny [Wed, 30 Jan 2019 08:20:24 +0000 (08:20 +0000)]
[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes

Append appropriate -rpath when using shared compiler-rt runtimes,
e.g. '-fsanitize=address -shared-libasan'.  There's already a similar
logic in CommonArgs.cpp but it uses non-standard arch-suffixed
installation directory while we want our driver to work with standard
installation paths.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352610 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ModuleDependencyCollector] Use llvm::sys::fs::real_path (NFC)
Jonas Devlieghere [Wed, 30 Jan 2019 06:26:26 +0000 (06:26 +0000)]
[ModuleDependencyCollector] Use llvm::sys::fs::real_path (NFC)

Use the real_path implementation from llvm::sys::fs::real_path instead
of having a custom implementation in the ModuleDependencyCollector.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352605 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCleanup: replace uses of CallSite with CallBase.
James Y Knight [Wed, 30 Jan 2019 02:54:28 +0000 (02:54 +0000)]
Cleanup: replace uses of CallSite with CallBase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352595 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSimplify and modernize this code a little.
Richard Smith [Wed, 30 Jan 2019 02:23:34 +0000 (02:23 +0000)]
Simplify and modernize this code a little.

No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352593 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] [RetainCountChecker] Bugfix for tracking top-level parameters of Objective...
George Karpenkov [Wed, 30 Jan 2019 02:11:04 +0000 (02:11 +0000)]
[analyzer] [RetainCountChecker] Bugfix for tracking top-level parameters of Objective-C methods

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352588 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake][Fuchsia] Re-enable iOS runtimes for Fuchsia standard
Petr Hosek [Wed, 30 Jan 2019 02:06:06 +0000 (02:06 +0000)]
[CMake][Fuchsia] Re-enable iOS runtimes for Fuchsia standard

Turned out this is used by Flutter which uses Fuchsia Clang toolchain.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352586 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake][Fuchsia] Enable hermetic static libunwind for Fuchsia
Petr Hosek [Wed, 30 Jan 2019 02:02:25 +0000 (02:02 +0000)]
[CMake][Fuchsia] Enable hermetic static libunwind for Fuchsia

In addition to libc++abi and libc++, we also want to use hermetic
static libunwind on Fuchsia.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352584 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix thread safety tests after r352549
Aaron Puchert [Wed, 30 Jan 2019 00:18:24 +0000 (00:18 +0000)]
Fix thread safety tests after r352549

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352574 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] NFC: GenericTaintChecker: Revise rule specification mechanisms.
Artem Dergachev [Wed, 30 Jan 2019 00:06:43 +0000 (00:06 +0000)]
[analyzer] NFC: GenericTaintChecker: Revise rule specification mechanisms.

Provide a more powerful and at the same time more readable way of specifying
taint propagation rules for known functions within the checker.

Now it should be possible to specify an unlimited amount of source and
destination parameters for taint propagation.

No functional change intended just yet.

Patch by Gábor Borsik!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352572 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoNFC: Move GenericSelectionExpr dump to NodeDumper
Stephen Kelly [Tue, 29 Jan 2019 22:58:28 +0000 (22:58 +0000)]
NFC: Move GenericSelectionExpr dump to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352558 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoNFC: Implement GenericSelectionExpr::Association dump with Visitor
Stephen Kelly [Tue, 29 Jan 2019 22:22:55 +0000 (22:22 +0000)]
NFC: Implement GenericSelectionExpr::Association dump with Visitor

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352552 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoThread safety analysis: Improve diagnostics for double locking
Aaron Puchert [Tue, 29 Jan 2019 22:11:42 +0000 (22:11 +0000)]
Thread safety analysis: Improve diagnostics for double locking

Summary:
We use the existing diag::note_locked_here to tell the user where we saw
the first locking.

Reviewers: aaron.ballman, delesley

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352549 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoOpenCL: Try to fix bot test failure
Matt Arsenault [Tue, 29 Jan 2019 21:14:56 +0000 (21:14 +0000)]
OpenCL: Try to fix bot test failure

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352544 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Fix PR40513: lastprivate taskloop counter.
Alexey Bataev [Tue, 29 Jan 2019 21:12:28 +0000 (21:12 +0000)]
[OPENMP]Fix PR40513: lastprivate taskloop counter.

We don't need to use the predetermined data-sharing attributes for the
loop counters if the user explicitly specified correct data-sharing
attributes for such variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352543 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cc1as] Test that -g of empty .s file does something sensible.
Paul Robinson [Tue, 29 Jan 2019 20:57:50 +0000 (20:57 +0000)]
[cc1as] Test that -g of empty .s file does something sensible.

Depends on LLVM r352541.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352542 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoOpenCL: Use length modifier for warning on vector printf arguments
Matt Arsenault [Tue, 29 Jan 2019 20:49:54 +0000 (20:49 +0000)]
OpenCL: Use length modifier for warning on vector printf arguments

Re-enable format string warnings on printf.

The warnings are still incomplete. Apparently it is undefined to use a
vector specifier without a length modifier, which is not currently
warned on. Additionally, type warnings appear to not be working with
the hh modifier, and aren't warning on all of the special restrictions
from c99 printf.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352540 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "OpenCL: Extend argument promotion rules to vector types"
Matt Arsenault [Tue, 29 Jan 2019 20:49:47 +0000 (20:49 +0000)]
Revert "OpenCL: Extend argument promotion rules to vector types"

This reverts r348083. This was based on a misreading of the spec
for printf specifiers.

Also revert r343653, as without a subsequent patch, a correctly
specified format for a vector will incorrectly warn.

Fixes bug 40491.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352539 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix the tests from r350970
Steven Wu [Tue, 29 Jan 2019 20:13:02 +0000 (20:13 +0000)]
Fix the tests from r350970

Relax the tests from r350970 to allow non-standard path for ld.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352537 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix the behavior of clang's -w flag.
James Y Knight [Tue, 29 Jan 2019 19:33:48 +0000 (19:33 +0000)]
Fix the behavior of clang's -w flag.

It is intended to disable _all_ warnings, even those upgraded to
errors via `-Werror=warningname` or `#pragma clang diagnostic error'

Fixes: https://llvm.org/PR38231
Differential Revision: https://reviews.llvm.org/D53199

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352535 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] [RetainCountChecker] Track input parameters to the top-level function
George Karpenkov [Tue, 29 Jan 2019 19:29:59 +0000 (19:29 +0000)]
[analyzer] [RetainCountChecker] Track input parameters to the top-level function

Track them for ISL/OS objects by default, and for NS/CF under a flag.

rdar://47536377

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352534 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] [RetainSummaryManager] [NFC] Split one function into two, as it's really...
George Karpenkov [Tue, 29 Jan 2019 19:29:45 +0000 (19:29 +0000)]
[analyzer] [RetainSummaryManager] [NFC] Split one function into two, as it's really doing two things

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352533 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] [ARCMT] [NFC] Unify entry point into RetainSummaryManager
George Karpenkov [Tue, 29 Jan 2019 19:29:33 +0000 (19:29 +0000)]
[analyzer] [ARCMT] [NFC] Unify entry point into RetainSummaryManager

Just use one single entry point, since we have AnyCall utility now.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352532 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoExtend AnyCall to handle callable declarations without the call expressions
George Karpenkov [Tue, 29 Jan 2019 19:29:19 +0000 (19:29 +0000)]
Extend AnyCall to handle callable declarations without the call expressions

That weakens inner invariants, but allows the class to be more generic,
allowing usage in situations where the call expression is not known (or
should not matter).

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352531 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] [RetainCountChecker] Support 'taggedRetain' and 'taggedRelease'
George Karpenkov [Tue, 29 Jan 2019 19:29:07 +0000 (19:29 +0000)]
[analyzer] [RetainCountChecker] Support 'taggedRetain' and 'taggedRelease'

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352530 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Make the loop with unsigned counter countable.
Alexey Bataev [Tue, 29 Jan 2019 18:51:58 +0000 (18:51 +0000)]
[OPENMP]Make the loop with unsigned counter countable.

According to the report, better to keep the original strict compare
operation as the loop condition with unsigned loop counters to make the
loop countable. This allows further loop transformations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352526 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRollback unwindlib patch.
Sterling Augustine [Tue, 29 Jan 2019 18:27:51 +0000 (18:27 +0000)]
Rollback unwindlib patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352524 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdjust documentation for git migration.
James Y Knight [Tue, 29 Jan 2019 16:37:27 +0000 (16:37 +0000)]
Adjust documentation for git migration.

This fixes most references to the paths:
 llvm.org/svn/
 llvm.org/git/
 llvm.org/viewvc/
 github.com/llvm-mirror/
 github.com/llvm-project/
 reviews.llvm.org/diffusion/

to instead point to https://github.com/llvm/llvm-project.

This is *not* a trivial substitution, because additionally, all the
checkout instructions had to be migrated to instruct users on how to
use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of
checking out various projects into various subdirectories.

I've attempted to not change any scripts here, only documentation. The
scripts will have to be addressed separately.

Additionally, I've deleted one document which appeared to be outdated
and unneeded:
  lldb/docs/building-with-debug-llvm.txt

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352514 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tooling] Handle #pragma once header guard in include insertion.
Eric Liu [Tue, 29 Jan 2019 14:40:01 +0000 (14:40 +0000)]
[Tooling] Handle #pragma once header guard in include insertion.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352503 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CUDA][HIP] Do not diagnose use of _Float16
Yaxun Liu [Tue, 29 Jan 2019 13:20:23 +0000 (13:20 +0000)]
[CUDA][HIP] Do not diagnose use of _Float16

r352221 caused regressions in CUDA/HIP since device function may use _Float16 whereas host does not support it.
In this case host compilation should not diagnose usage of _Float16 in device functions or variables.

For now just do not diagnose _Float16 for CUDA/HIP. In the future we should have more precise check.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352488 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRe-commit "[AST] Introduce GenericSelectionExpr::Association"
Bruno Ricci [Tue, 29 Jan 2019 12:57:11 +0000 (12:57 +0000)]
Re-commit "[AST] Introduce GenericSelectionExpr::Association"

This time with a fix to make gcc 4.8 happy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352486 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Toning down invalidation a bit
Gabor Horvath [Tue, 29 Jan 2019 10:27:14 +0000 (10:27 +0000)]
[analyzer] Toning down invalidation a bit

When a function takes the address of a field the analyzer will no longer
assume that the function will change other fields of the enclosing structs.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352473 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Added a checklist to help checker authors and reviewers
Gabor Horvath [Tue, 29 Jan 2019 10:21:49 +0000 (10:21 +0000)]
[analyzer] Added a checklist to help checker authors and reviewers

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352470 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Fix a typo in docs
Gabor Horvath [Tue, 29 Jan 2019 10:15:52 +0000 (10:15 +0000)]
[analyzer] Fix a typo in docs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352468 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Update int64_t ACLE builtin arguments
Sam Parker [Tue, 29 Jan 2019 09:04:03 +0000 (09:04 +0000)]
[AArch64] Update int64_t ACLE builtin arguments

Re-applying r351740 with fixes (changing LL to W).

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352463 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove unused variable to silence compiler warning
Mikael Holmen [Tue, 29 Jan 2019 06:53:31 +0000 (06:53 +0000)]
Remove unused variable to silence compiler warning

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352456 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake][Fuchsia] Temporarily disable modules for second stage
Petr Hosek [Tue, 29 Jan 2019 03:38:26 +0000 (03:38 +0000)]
[CMake][Fuchsia] Temporarily disable modules for second stage

This is breaking some of builders, disable modules until it's resolved.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352449 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Add ds append/consume builtins
Matt Arsenault [Mon, 28 Jan 2019 23:59:18 +0000 (23:59 +0000)]
AMDGPU: Add ds append/consume builtins

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352443 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter] Fix handling of overriden methods during ASTImport
Shafik Yaghmour [Mon, 28 Jan 2019 21:55:33 +0000 (21:55 +0000)]
[ASTImporter] Fix handling of overriden methods during ASTImport

Summary:
When importing classes we may add a CXXMethodDecl more than once to a CXXRecordDecl when handling overrides. This patch will fix the cases we currently know about and handle the case where we are only dealing with declarations.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352436 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP][NVPTX]Emit service debug variable for NVPTX.
Alexey Bataev [Mon, 28 Jan 2019 20:03:02 +0000 (20:03 +0000)]
[OPENMP][NVPTX]Emit service debug variable for NVPTX.

In case of the empty module, the ptxas tool may emit error message about
empty debug info sections. This patch fixes this bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352421 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCorrect help text for --unwindlib options.
Sterling Augustine [Mon, 28 Jan 2019 18:56:44 +0000 (18:56 +0000)]
Correct help text for --unwindlib options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352405 91177308-0d34-0410-b5e6-96231b3b80d8