]> granicus.if.org Git - clang/log
clang
5 years ago[clangd] Print template arguments helper
Kadir Cetinkaya [Fri, 12 Apr 2019 10:09:14 +0000 (10:09 +0000)]
[clangd] Print template arguments helper

Summary:
Prepares ground for printing template arguments as written in the
source code, part of re-landing rC356541 with D59599 applied.

Reviewers: ioeric, ilya-biryukov

Subscribers: mgorny, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

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

5 years agoEnable frame pointer elimination for OpenBSD on x86 and mips64.
Brad Smith [Fri, 12 Apr 2019 01:29:18 +0000 (01:29 +0000)]
Enable frame pointer elimination for OpenBSD on x86 and mips64.

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

5 years agoVariable auto-init: also auto-init alloca
JF Bastien [Fri, 12 Apr 2019 00:11:27 +0000 (00:11 +0000)]
Variable auto-init: also auto-init alloca

Summary:
alloca isn’t auto-init’d right now because it’s a different path in clang that
all the other stuff we support (it’s a builtin, not an expression).
Interestingly, alloca doesn’t have a type (as opposed to even VLA) so we can
really only initialize it with memset.

<rdar://problem/49794007>

Subscribers: jkorous, dexonsmith, cfe-commits, rjmccall, glider, kees, kcc, pcc

Tags: #clang

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

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

5 years agoRevert r357610, it caused PR41471
Nico Weber [Thu, 11 Apr 2019 21:26:34 +0000 (21:26 +0000)]
Revert r357610, it caused PR41471

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

5 years ago[C++20] Implement context-sensitive header-name lexing and pp-import parsing in the...
Richard Smith [Thu, 11 Apr 2019 21:18:23 +0000 (21:18 +0000)]
[C++20] Implement context-sensitive header-name lexing and pp-import parsing in the preprocessor.

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

5 years agoRemove use of lookahead from _Pragma handling and from all other
Richard Smith [Thu, 11 Apr 2019 21:18:22 +0000 (21:18 +0000)]
Remove use of lookahead from _Pragma handling and from all other
internal lexing steps in the preprocessor.

It is not safe to use the preprocessor's token lookahead except when
operating on the final sequence of tokens that would be produced by
phase 4 of translation. Doing so corrupts the token lookahead cache used
by the parser. (See added testcase for an example.) Lookahead should
instead be viewed as a layer on top of the normal lexer.

Added assertions to catch any further incorrect uses of lookahead within
lexing actions.

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

5 years ago[DebugInfo] Combine Trivial and NonTrivial flags
Aaron Smith [Thu, 11 Apr 2019 20:24:54 +0000 (20:24 +0000)]
[DebugInfo] Combine Trivial and NonTrivial flags

Summary:
These flags are used when emitting debug info and needed to initialize subprogram and member function attributes (function options) for Codeview. These function options are used to create an accurate compiler type for UDT symbols (class/struct/union) from PDBs.

The Trivial flag was introduced in https://reviews.llvm.org/D45122

It's been pointed out that Trivial and NonTrivial may imply each other and that seems to be the case in the current tests. This change combines them into a single flag -- NonTrivial -- and updates the corresponding unit tests. There is an additional change to llvm to update the flags.

Reviewers: rnk, zturner, dblaikie, probinson, Hui

Reviewed By: dblaikie

Subscribers: aprantl, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoSupport objc_nonlazy_class attribute on Objective-C implementations
Erik Pilkington [Thu, 11 Apr 2019 17:55:34 +0000 (17:55 +0000)]
Support objc_nonlazy_class attribute on Objective-C implementations

Fixes rdar://49523079

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

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

5 years agoAdd support for attributes on @implementations in Objective-C
Erik Pilkington [Thu, 11 Apr 2019 17:55:30 +0000 (17:55 +0000)]
Add support for attributes on @implementations in Objective-C

We want to make objc_nonlazy_class apply to implementations, but ran into this.
There doesn't seem to be any reason that this isn't supported.

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

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

5 years agoAdd { } to silence compiler warning [NFC]
Mikael Holmen [Thu, 11 Apr 2019 06:57:12 +0000 (06:57 +0000)]
Add { } to silence compiler warning [NFC]

At least clang 3.6 warns on the original code:

../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:829:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 1>({Address(nullptr, CharUnits::Zero())});
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 {                                  }
../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:833:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 2>({Address(nullptr, CharUnits::Zero()),
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

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

5 years ago[OpenCL] Re-fix invalid address space generation for clk_event_t arguments of enqueue...
Alexey Sotkin [Thu, 11 Apr 2019 06:18:17 +0000 (06:18 +0000)]
[OpenCL] Re-fix invalid address space generation for clk_event_t arguments of enqueue_kernel builtin function

Summary:
https://reviews.llvm.org/D53809 fixed wrong address space(assert in debug build)
generated for event_ret argument. But exactly the same problem exists for
event_wait_list argument. This patch should fix both.

Reviewers: Anastasia, yaxunl

Reviewed By:  Anastasia

Subscribers: kristina, ebevhan, cfe-commits

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

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

5 years agoFix a test, NFC
Erik Pilkington [Wed, 10 Apr 2019 21:18:21 +0000 (21:18 +0000)]
Fix a test, NFC

This test was duplicated, and the last declaration had some syntax errors since
the invalid attribute caused the @implementation to be skipped by the parser.

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

5 years agoCheck i < FD->getNumParams() before querying
Dmitri Gribenko [Wed, 10 Apr 2019 20:25:07 +0000 (20:25 +0000)]
Check i < FD->getNumParams() before querying

Summary:
As was already stated in a previous comment, the parameter isn't
necessarily referring to one of the DeclContext's parameter. We
should check the index is within the range to avoid out-of-boundary
access.

Reviewers: gribozavr, rsmith, lebedev.ri

Reviewed By: gribozavr, rsmith

Subscribers: lebedev.ri, cfe-commits

Tags: #clang

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

Patch by Violet.

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

5 years ago[clang][ASTContext] Try to exit early before loading serialized comments from AST...
Jan Korous [Wed, 10 Apr 2019 20:23:33 +0000 (20:23 +0000)]
[clang][ASTContext] Try to exit early before loading serialized comments from AST files

Loading external comments is expensive. This change probably doesn't apply to common cases but is almost for free and would save some work in case none of the declaration needs external comments to be loaded.

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

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

5 years agoAdd IRGen APIs to fetch ctor/dtor helper functions for non-trivial structs.
John McCall [Wed, 10 Apr 2019 19:57:20 +0000 (19:57 +0000)]
Add IRGen APIs to fetch ctor/dtor helper functions for non-trivial structs.

Patch by Tony Allevato!

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

5 years ago[OPENMP]Improve detection of number of teams, threads in target
Alexey Bataev [Wed, 10 Apr 2019 19:11:33 +0000 (19:11 +0000)]
[OPENMP]Improve detection of number of teams, threads in target
regions.

Added more complex analysis for number of teams and number of threads in
the target regions, also merged related common code between CGOpenMPRuntime
and CGOpenMPRuntimeNVPTX classes.

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

5 years agoFix for different build configurations.
John McCall [Wed, 10 Apr 2019 19:11:32 +0000 (19:11 +0000)]
Fix for different build configurations.

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

5 years agoFix an off-by-one mistake in IRGen's copy-construction
John McCall [Wed, 10 Apr 2019 18:07:18 +0000 (18:07 +0000)]
Fix an off-by-one mistake in IRGen's copy-construction
special cases in the presence of zero-length arrays.

Patch by Joran Bigalet!

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

5 years agoDon't emit an unreachable return block.
John McCall [Wed, 10 Apr 2019 17:03:09 +0000 (17:03 +0000)]
Don't emit an unreachable return block.

Patch by Brad Moody.

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

5 years agoclang-cl: Fix parsing of the /F option (PR41405)
Hans Wennborg [Wed, 10 Apr 2019 14:27:47 +0000 (14:27 +0000)]
clang-cl: Fix parsing of the /F option (PR41405)

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

5 years ago[CodeGen][ObjC] Emit the retainRV marker as a module flag instead of
Akira Hatanaka [Wed, 10 Apr 2019 06:20:23 +0000 (06:20 +0000)]
[CodeGen][ObjC] Emit the retainRV marker as a module flag instead of
named metadata.

This fixes a bug where ARC contract wasn't inserting the retainRV
marker when LTO was enabled, which caused objects returned from a
function to be auto-released.

rdar://problem/49464214

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

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

5 years ago[OPENMP]Allow allocate directive on parameters.
Alexey Bataev [Tue, 9 Apr 2019 16:31:37 +0000 (16:31 +0000)]
[OPENMP]Allow allocate directive on parameters.

Patch allows to use allocate directives on the function parameters.

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

5 years agoFixed comment as pointed out by post-commit review of D59845
Raphael Isemann [Tue, 9 Apr 2019 14:18:23 +0000 (14:18 +0000)]
Fixed comment as pointed out by post-commit review of D59845

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

5 years agoAdd support for detection of devtoolset-8
Tom Stellard [Tue, 9 Apr 2019 13:26:10 +0000 (13:26 +0000)]
Add support for detection of devtoolset-8

Summary:
The current llvm/clang et al. project can be built with the latest developer toolset (devtoolset-8) on RHEL, which provides GCC 8.2.1.
However, the result compiler will not identify this toolset itself when compiling programs, which is of course not desirable.

After the patch - which simply adds the name of the developer toolset to the existing list - it gets identified and selected, as shown below:

[bamboo@bamboo llvm-project]$ clang -v
clang version 9.0.0 (https://github.com/llvm/llvm-project.git e5ac385fb1ffa4bd3875ea6a4d24efdbd7814572)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/bamboo/llvm/bin
Found candidate GCC installation: /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1
Found candidate GCC installation: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Found candidate GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

Patch By: Radu-Adrian Popescu

Reviewers: tstellar, fedor.sergeev

Reviewed By: tstellar

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[RISCV] Unbreak test from r357989
Alex Bradbury [Tue, 9 Apr 2019 10:44:47 +0000 (10:44 +0000)]
[RISCV] Unbreak test from r357989

There were some errors in the committed test checks, left in due to a git
stash apply mishap.

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

5 years ago[RISCV][NFC] Minor fixup for r357989
Alex Bradbury [Tue, 9 Apr 2019 10:25:05 +0000 (10:25 +0000)]
[RISCV][NFC] Minor fixup for r357989

One of the tests in riscv64-lp64-lp64f-lp64d would have had a different
lowering for lp64f/lp64d as a float argument was missed.

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

5 years ago[RISCV][NFC] Refactor RISC-V ABI lowering tests in preparation for hard float patches
Alex Bradbury [Tue, 9 Apr 2019 10:12:49 +0000 (10:12 +0000)]
[RISCV][NFC] Refactor RISC-V ABI lowering tests in preparation for hard float patches

Split tests in to files representing the subset of RISC-V ABIs they should
have identical output for.

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

5 years ago[ASTImporter] Fix in ASTImporter::Import_New(const Decl *)
Bjorn Pettersson [Tue, 9 Apr 2019 09:12:32 +0000 (09:12 +0000)]
[ASTImporter] Fix in ASTImporter::Import_New(const Decl *)

Make sure ASTImporter::Import_New(const Decl *) returns
a Expected<const Decl *> and not Expected<Decl *> to
make the clang/unittests/AST/ASTImporterTest.cpp compile
without the warning

 clang/unittests/AST/ASTImporterTest.cpp:117:12: error: no viable conversion from 'Expected<clang::Decl *>' to 'Expected<const clang::Decl *>'
    return Imported;

(I got the above when building with clang 3.6).

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

5 years ago[clang-format] Add AfterCaseLabel to BraceWrapping
Owen Pan [Mon, 8 Apr 2019 23:36:25 +0000 (23:36 +0000)]
[clang-format] Add AfterCaseLabel to BraceWrapping

Fixes PR38686

llvm-svn: 52527

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

5 years agoRevert "[MS] Add metadata for __declspec(allocator)"
Amy Huang [Mon, 8 Apr 2019 22:46:41 +0000 (22:46 +0000)]
Revert "[MS] Add metadata for __declspec(allocator)"

This reverts commit e7bd735bb03a7b8141e32f7d6cb98e8914d8799e.
Reverting because of buildbot failure.

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

5 years agoMove the builtin headers to use the new license file header.
Chandler Carruth [Mon, 8 Apr 2019 20:51:30 +0000 (20:51 +0000)]
Move the builtin headers to use the new license file header.

Summary:
These all had somewhat custom file headers with different text from the
ones I searched for previously, and so I missed them. Thanks to Hal and
Kristina and others who prompted me to fix this, and sorry it took so
long.

Reviewers: hfinkel

Subscribers: mcrosier, javed.absar, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Call to HandleNameConflict in VisitEnumDecl mistakeningly using Name...
Shafik Yaghmour [Mon, 8 Apr 2019 20:50:21 +0000 (20:50 +0000)]
[ASTImporter] Call to HandleNameConflict in VisitEnumDecl mistakeningly using Name instead of SearchName

Summary:
https://reviews.llvm.org/D51633 added error handling to the ASTNodeImporter::VisitEnumDecl(...) for the conflicting names case. This could lead to erroneous return of an error in that case since we should have been using SearchName. Name may be empty in the case where we find the name via getTypedefNameForAnonDecl(...).

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

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

5 years agoClean up ObjCPropertyDecl printing
David Goldman [Mon, 8 Apr 2019 19:52:45 +0000 (19:52 +0000)]
Clean up ObjCPropertyDecl printing

Summary:
- `@property(attr, attr2)` instead of `@property ( attr,attr2 )`.
- Change priority of attributes (see code/comments inline).
- Support for printing weak and unsafe_unretained attributes.

Subscribers: arphaman, jfb, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP] Sync __kmpc_alloc/_kmpc_free function with the runtime.
Alexey Bataev [Mon, 8 Apr 2019 19:06:42 +0000 (19:06 +0000)]
[OPENMP] Sync __kmpc_alloc/_kmpc_free function with the runtime.

Functions __kmpc_alloc/__kmpc_free are updated with the new interfaces.
Patch synchronizes the compiler with the runtime.

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

5 years ago[MS] Add metadata for __declspec(allocator)
Amy Huang [Mon, 8 Apr 2019 17:58:29 +0000 (17:58 +0000)]
[MS] Add metadata for __declspec(allocator)

Summary:
Emit !heapallocsite in the metadata for calls to functions marked with
__declspec(allocator). Eventually this will be emitted as S_HEAPALLOCSITE debug
info in codeview.

Reviewers: rnk

Subscribers: jfb, cfe-commits

Tags: #clang

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

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

5 years ago[X86] Add some fp to integer conversion intrinsics to Sema::CheckX86BuiltinRoundingOr...
Craig Topper [Mon, 8 Apr 2019 17:05:57 +0000 (17:05 +0000)]
[X86] Add some fp to integer conversion intrinsics to Sema::CheckX86BuiltinRoundingOrSAE so their rounding controls will be checked.

If we don't check this in the frontend we'll get an isel error in the backend later. This is far less friendly to users.

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

5 years ago[OPENMP][NVPTX]Fixed processing of memory management directives.
Alexey Bataev [Mon, 8 Apr 2019 16:53:57 +0000 (16:53 +0000)]
[OPENMP][NVPTX]Fixed processing of memory management directives.

Added special processing of the memory management directives/clauses for
NVPTX target. For private locals, omp_default_mem_alloc and
omp_thread_mem_alloc result in allocation in local memory.
omp_const_mem_alloc allocates const memory, omp_teams_mem_alloc
allocates shared memory, and omp_cgroup_mem_alloc and
omp_large_cap_mem_alloc allocate global memory.

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

5 years agoRemove a bogus sed option in test.
Alexander Kornienko [Mon, 8 Apr 2019 16:34:38 +0000 (16:34 +0000)]
Remove a bogus sed option in test.

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

5 years agoRemove a useless assertion in clang-check.
Alexander Kornienko [Mon, 8 Apr 2019 16:29:43 +0000 (16:29 +0000)]
Remove a useless assertion in clang-check.

Re-commit r357915 with a fix for windows.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15

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

5 years agoRevert rL357915 from cfe/trunk: Remove a useless assertion in clang-check.
Simon Pilgrim [Mon, 8 Apr 2019 15:49:19 +0000 (15:49 +0000)]
Revert rL357915 from cfe/trunk: Remove a useless assertion in clang-check.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15
........
Breaks windows buildbots

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

5 years ago[python, tests] Disable Clang Python tests on SPARC
Rainer Orth [Mon, 8 Apr 2019 15:01:06 +0000 (15:01 +0000)]
[python, tests] Disable Clang Python tests on SPARC

Running `make check-all` fails on Solaris 11/SPARC since the clang python
tests FAIL:

  ............................
  ======================================================================
  FAIL: test_extent (tests.cindex.test_location.TestLocation)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/cindex/test_location.py", line 87, in test_extent
      self.assert_location(one.extent.start,line=1,column=1,offset=0)
    File "tests/cindex/test_location.py", line 22, in assert_location
      self.assertEqual(loc.column, column)
  AssertionError: 5 != 1

  ======================================================================
  FAIL: test_get_children (tests.cindex.test_cursor.TestCursor)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/cindex/test_cursor.py", line 70, in test_get_children
      self.assertEqual(tu_nodes[0].is_definition(), True)
  AssertionError: False != True

  ----------------------------------------------------------------------
  Ran 126 tests in 2.123s

  FAILED (failures=2, skipped=6)

Unfortunately, this aborts the rest of `make check-all`, even with `-k`, so
this patch disables the test as is already done on a couple of other
targets.

This allowed the `sparc-sun-solaris2.11` test to finish.

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

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

5 years agoRemove a useless assertion in clang-check.
Alexander Kornienko [Mon, 8 Apr 2019 14:18:26 +0000 (14:18 +0000)]
Remove a useless assertion in clang-check.

The assertion prevents it from applying fixes when used along with compilation
databases with relative paths. Added a test that demonstrates the assertion
failure.

An example of the assertion:
input.cpp:11:14: error: expected ';' after top level declarator
typedef int T
             ^
             ;
input.cpp:11:14: note: FIX-IT applied suggested code changes
clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed.
  #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13
  #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18
  #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1
  #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0)
  #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf)
  #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa)
  #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37)
  #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2)
  #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag)
  #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type)
 #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*)
 #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
 #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0
 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const
 #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const
 #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()
 #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
 #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0
 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const
 #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const
 #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const
 #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0
 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0
 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++()
 #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0
 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33
 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18
 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10
 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11
 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15

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

5 years agoChanged every use of ASTImporter::Import to Import_New
Balazs Keri [Mon, 8 Apr 2019 13:59:15 +0000 (13:59 +0000)]
Changed every use of ASTImporter::Import to Import_New

Reviewers: a.sidorin, shafik, martong, a_sidorin

Reviewed By: a_sidorin

Subscribers: rnkovacs, dkrupp, martong, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] Optionally insert a space after unary ! operator
Reuben Thomas [Mon, 8 Apr 2019 12:54:48 +0000 (12:54 +0000)]
[clang-format] Optionally insert a space after unary ! operator

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

5 years agoIAS is now enabled for all OS on MIPS64
Brad Smith [Mon, 8 Apr 2019 00:03:01 +0000 (00:03 +0000)]
IAS is now enabled for all OS on MIPS64

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

5 years agoEnable IAS for FreeBSD SPARC64.
Brad Smith [Sun, 7 Apr 2019 23:12:31 +0000 (23:12 +0000)]
Enable IAS for FreeBSD SPARC64.

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

5 years ago[clang-format] Fix bug https://bugs.llvm.org/show_bug.cgi?id=41413
Owen Pan [Sun, 7 Apr 2019 21:05:52 +0000 (21:05 +0000)]
[clang-format] Fix bug https://bugs.llvm.org/show_bug.cgi?id=41413

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

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

5 years ago[clang-format] Fix Bug 41407
Owen Pan [Sat, 6 Apr 2019 23:10:11 +0000 (23:10 +0000)]
[clang-format] Fix Bug 41407
Differential Revision: https://reviews.llvm.org/D60359

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

5 years ago[clang-format] BreakAfterReturnType ignored on functions with numeric template parameters
Paul Hoad [Sat, 6 Apr 2019 10:13:04 +0000 (10:13 +0000)]
[clang-format] BreakAfterReturnType ignored on functions with numeric template parameters

Summary:
Addresses PR40696 - https://bugs.llvm.org/show_bug.cgi?id=40696

The BreakAfterReturnType didn't work if it had a single arguments which was a template with an integer template parameter

```
int  foo(A<8> a) { return a; }
```

When run with the Mozilla style. would not break after the `int`

```
int TestFn(A<8> a)
{
  return a;
}

```

This revision resolves this issue by allowing numeric constants to be considered function parameters if if seen inside `<>`

Reviewers: djasper, klimek, JonasToth, krasimir, reuk, alexfh

Reviewed By: klimek

Subscribers: cfe-commits, llvm-commits

Tags: #clang-tools-extra

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

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

5 years agoRevert "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."
Artem Dergachev [Fri, 5 Apr 2019 22:11:28 +0000 (22:11 +0000)]
Revert "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."

This reverts commit r357823.

Was breaking clang-tidy!

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

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

5 years ago[Lexer] NFC: Fix an off-by-one bug in getAsCharRange().
Artem Dergachev [Fri, 5 Apr 2019 21:48:52 +0000 (21:48 +0000)]
[Lexer] NFC: Fix an off-by-one bug in getAsCharRange().

As the unit test demonstrates, subtracting 1 from the offset was unnecessary.

The only user of this function was the plist file emitter (in Static Analyzer
and ARCMigrator). It means that a lot of Static Analyzer's plist arrows
are in fact off by one character. The patch carefully preserves this
completely incorrect behavior and causes no functional change,
i.e. no plist format breakage.

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

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

5 years ago[analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers.
Artem Dergachev [Fri, 5 Apr 2019 20:18:53 +0000 (20:18 +0000)]
[analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers.

The idea behind this heuristic is that normally the visitor is there to
inform the user that a certain function may fail to initialize a certain
out-parameter. For system header functions this is usually dictated by the
contract, and it's unlikely that the header function has accidentally
forgot to put the value into the out-parameter; it's more likely
that the user has intentionally skipped the error check.

Warnings on skipped error checks are more like security warnings;
they aren't necessarily useful for all users, and they should instead
be introduced on a per-API basis.

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

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

5 years ago[clang-fuzzer] Include ExternalProject before using it.
Matt Morehouse [Fri, 5 Apr 2019 19:47:17 +0000 (19:47 +0000)]
[clang-fuzzer] Include ExternalProject before using it.

Some versions of CMake require ExternalProject to be included before we
can use ExternalProject_Add.

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

5 years agoFix error in NamedDeclPrinterTest
David Goldman [Fri, 5 Apr 2019 19:17:24 +0000 (19:17 +0000)]
Fix error in NamedDeclPrinterTest

Caused by D56924, shouldn't use raw string literals in macros.

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

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

5 years ago[docs] Fix rst title in clang langext docs. NFCI
Kristina Brooks [Fri, 5 Apr 2019 18:26:43 +0000 (18:26 +0000)]
[docs] Fix rst title in clang langext docs. NFCI

Fix an odd line in LanguageExtensions.rst which
rendered incorrectly due to an underscore being
mixed in with dashes.

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

5 years ago[AMDGPU] rename vi-insts into gfx8-insts
Stanislav Mekhanoshin [Fri, 5 Apr 2019 18:25:00 +0000 (18:25 +0000)]
[AMDGPU] rename vi-insts into gfx8-insts

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

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

5 years ago[CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with CUDA...
Evgeny Mankov [Fri, 5 Apr 2019 16:51:10 +0000 (16:51 +0000)]
[CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with CUDA-9.x on Windows" (https://bugs.llvm.org/show_bug.cgi?id=38811).

[IMPORTANT]
With that last fix, CUDA has just started being compiling by clang on Windows after nearly a year and two clang’s major releases (7 and 8).
As long as the last LLVM release, in which clang was compiling CUDA on Windows successfully, was 6.0.1, this fix and two previous have to be included into upcoming 7.1.0 and 8.0.1 releases.

[How to repro]
clang++.exe -x cuda "c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\0_Simple\simplePrintf\simplePrintf.cu" -I"c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\common\inc" --cuda-gpu-arch=sm_50 --cuda-path="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0" -L"c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64" -lcudart.lib  -v

[Output]
In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:390:11: error: no matching function for call to '__isinfl'
  return (__isinfl(a) != 0);
          ^~~~~~~~
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2662:14: note: candidate function not viable: call to __host__ function from __device__ function
__func__(int __isinfl(long double a))
             ^
In file included from <built-in>:1:
In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:438:11: error: no matching function for call to '__isnanl'
  return (__isnanl(a) != 0);
          ^~~~~~~~
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2672:14: note: candidate function not viable: call to __host__ function from __device__ function
__func__(int __isnanl(long double a))
             ^
In file included from <built-in>:1:
In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:486:11: error: no matching function for call to '__finitel'
  return (__finitel(a) != 0);
          ^~~~~~~~~
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2652:14: note: candidate function not viable: call to __host__ function from __device__ function
__func__(int __finitel(long double a))
             ^
3 errors generated when compiling for sm_50.

[Solution]
Add missing long double device functions' declarations. Provide only declarations to prevent any use of long double on the device side, because CUDA does not support long double on the device side.

[Testing]
{Windows 10, Ubuntu 16.04.5}/{Visual C++ 2017 15.9.9, gcc+ 5.4.0}/CUDA {8.0, 9.0, 9.1, 9.2, 10.0, 10.1}

Reviewed by: Artem Belevich

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

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

5 years ago[Tooling] add a Heuristic field indicating that a CompileCommand was guessed.
Sam McCall [Fri, 5 Apr 2019 15:22:20 +0000 (15:22 +0000)]
[Tooling] add a Heuristic field indicating that a CompileCommand was guessed.

Summary:
Use cases:
 - a tool that dumps the heuristic used for each header in a project can
   be used to evaluate changes to the heuristic
 - we want to expose this information to users in clangd as it affects
   accuracy/reliability of editor features
 - express interpolation tests more directly

Reviewers: ilya-biryukov, klimek

Subscribers: ioeric, kadircet, cfe-commits

Tags: #clang

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

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

5 years ago[LibTooling] Add Transformer, a library for source-to-source transformations.
Yitzhak Mandelbaum [Fri, 5 Apr 2019 15:14:05 +0000 (15:14 +0000)]
[LibTooling] Add Transformer, a library for source-to-source transformations.

Summary: Adds a basic version of Transformer, a library supporting the concise specification of clang-based source-to-source transformations.  A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling".

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ioeric, ABataev, mgorny, jfb, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[LibTooling] Add "SourceCode" library for functions relating to source-code manipulation.
Yitzhak Mandelbaum [Fri, 5 Apr 2019 14:05:03 +0000 (14:05 +0000)]
[LibTooling] Add "SourceCode" library for functions relating to source-code manipulation.

Summary:
Introduces a utility library in Refactoring/ to collect routines related to
source-code manipulation.  In this change, we move "extended-range" functions
from the FixIt library (in clangTooling) to this new library.

We need to use this functionality in Refactoring/ and cannot access it if it
resides in Tooling/, because that would cause clangToolingRefactor to depend on
clangTooling, which would be a circular dependency.

Reviewers: ilya-biryukov, ioeric

Reviewed By: ilya-biryukov

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[test] Specify an explicit darwin version in a triple in
Alex Lorenz [Fri, 5 Apr 2019 01:48:11 +0000 (01:48 +0000)]
[test] Specify an explicit darwin version in a triple in
`test/Driver/debug-options.c` to ensure that the driver
selects the DWARF 2 version as intended by the test.

Fixes the `test/Driver/debug-options.c` test regression on GreenDragon
on macOS that started failing after r357713.

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

5 years ago[IR] Refactor attribute methods in Function class (NFC)
Evandro Menezes [Thu, 4 Apr 2019 22:40:06 +0000 (22:40 +0000)]
[IR] Refactor attribute methods in Function class (NFC)

Rename the functions that query the optimization kind attributes.

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

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

5 years agoMake SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer*
Nico Weber [Thu, 4 Apr 2019 21:06:41 +0000 (21:06 +0000)]
Make SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer*

Requires making the llvm::MemoryBuffer* stored by SourceManager const,
which in turn requires making the accessors for that return const
llvm::MemoryBuffer*s and updating all call sites.

The original motivation for this was to use it and fix the TODO in
CodeGenAction.cpp's ConvertBackendLocation() by using the UnownedTag
version of createFileID, and since llvm::SourceMgr* hands out a const
llvm::MemoryBuffer* this is required. I'm not sure if fixing the TODO
this way actually works, but this seems like a good change on its own
anyways.

No intended behavior change.

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

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

5 years agoSpecial case ObjCPropertyDecl for printing
David Goldman [Thu, 4 Apr 2019 20:13:22 +0000 (20:13 +0000)]
Special case ObjCPropertyDecl for printing

ObjCPropertyDecl should use the category interface as a context similar to what is done for methods.

Previously category methods would be printed as `::property`; now they are printed as `Class::property`.

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

5 years ago[OPENMP]Add codegen for task reduction vars with allocate clause, NFC.
Alexey Bataev [Thu, 4 Apr 2019 18:58:17 +0000 (18:58 +0000)]
[OPENMP]Add codegen for task reduction vars with allocate clause, NFC.

Added test for the task reduction variables with the allocate clause.

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

5 years agoVerify that Android targets generate DWARF 4 by default.
Stephen Hines [Thu, 4 Apr 2019 18:17:46 +0000 (18:17 +0000)]
Verify that Android targets generate DWARF 4 by default.

Summary:
In the future, Android releases will support DWARF 5, but we need to
ensure that older targets only have DWARF 4 generated for them. This
patch inserts that verification for all Android releases now. The patch
also fixes 2 minor mistakes (a mistakenly moved RUN line, and the
missing G_DWARF2 check label).

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: chh, pirama, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Add codegen for linear vars with allocate clause, NFC.
Alexey Bataev [Thu, 4 Apr 2019 18:06:53 +0000 (18:06 +0000)]
[OPENMP]Add codegen for linear vars with allocate clause, NFC.

Added test for the linear variables with the allocate clause.

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

5 years ago[OPENMP]Fix lookup of the user-defined reductions in C.
Alexey Bataev [Thu, 4 Apr 2019 17:28:22 +0000 (17:28 +0000)]
[OPENMP]Fix lookup of the user-defined reductions in C.

Fixed the regression of the lookup of user-defined reductions for C.

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

5 years ago[RISCV] Fix rL357699 by adding missing zero-length files
Alex Bradbury [Thu, 4 Apr 2019 14:36:07 +0000 (14:36 +0000)]
[RISCV] Fix rL357699 by adding missing zero-length files

svn add doesn't play very nicely here...

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

5 years agoUpdating Chromium's Java import order
Nico Weber [Thu, 4 Apr 2019 14:19:45 +0000 (14:19 +0000)]
Updating Chromium's Java import order

Adding in androidx as another import group.

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

Patch from Sam Maier <smaier@chromium.org>!

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

5 years ago[RISCV] Collect library directories and triples for riscv64 triple too
Alex Bradbury [Thu, 4 Apr 2019 14:18:26 +0000 (14:18 +0000)]
[RISCV] Collect library directories and triples for riscv64 triple too

When setting up library and tools paths when detecting an accompanying GCC
installation only riscv32 was handled. As a consequence when targetting
riscv64 neither the linker nor libraries would be found. This adds handling
and tests for riscv64.

Differential Revision: https://reviews.llvm.org/D53392
Patch by Edward Jones.

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

5 years ago[clang-format] Preserve include blocks in ObjC Google style
Krasimir Georgiev [Thu, 4 Apr 2019 14:04:26 +0000 (14:04 +0000)]
[clang-format] Preserve include blocks in ObjC Google style

Summary:
r357567 started to regroup include block for Google style; it was meant to apply
only for C++. This patch reverts this for ObjC.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: thakis, cfe-commits

Tags: #clang

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

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

5 years ago[RISCV][NFC] s/riscv32-linux-unknown-elf/riscv32-unknown-linux-gnu in test/Driver...
Alex Bradbury [Thu, 4 Apr 2019 13:51:41 +0000 (13:51 +0000)]
[RISCV][NFC] s/riscv32-linux-unknown-elf/riscv32-unknown-linux-gnu in test/Driver/riscv32-toolchain.c

riscv32-linux-unknown-elf was a weird thing to test for as it doesn't match
the triple used in any common RISC-V toolchain distributions (e.g.
riscv-gnu-toolchain scripts produce riscv{32,64}-unknown-linux-gnu).

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

5 years ago[CodeComplete] Fix crash when completing ObjC block parameter with a broken type
Sam McCall [Thu, 4 Apr 2019 11:34:18 +0000 (11:34 +0000)]
[CodeComplete] Fix crash when completing ObjC block parameter with a broken type

Summary:
The fix isn't great, but it's hard to fix properly because the completion
code sensibly uses ParmVarDecl to represent parameters, but the AST-building
code sensibly doesn't synthesize them if the type is broken.
Also this case is apparently really rare, so it's probably not worth bending
over backwards for.

Reviewers: ilya-biryukov

Subscribers: javed.absar, kristof.beyls, arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[PR41157][OpenCL] Prevent implicit init of local addr space var in C++ mode.
Anastasia Stulova [Thu, 4 Apr 2019 11:08:51 +0000 (11:08 +0000)]
[PR41157][OpenCL] Prevent implicit init of local addr space var in C++ mode.

Prevent adding initializers implicitly to variables declared in
local address space. This happens when they get converted into
global variables and therefore theoretically have to be default
initialized in C++.

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

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

5 years ago[PR41276] Fixed incorrect generation of addr space cast for 'this' in C++.
Anastasia Stulova [Thu, 4 Apr 2019 10:48:36 +0000 (10:48 +0000)]
[PR41276] Fixed incorrect generation of addr space cast for 'this' in C++.

Improved classification of address space cast when qualification
conversion is performed - prevent adding addr space cast for
non-pointer and non-reference types. Take address space correctly
from the pointee.

Also pass correct address space from 'this' object using
AggValueSlot when generating addrspacecast in the constructor
call.

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

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

5 years agoRevert r357452 - 'SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function...
David L. Jones [Thu, 4 Apr 2019 02:27:57 +0000 (02:27 +0000)]
Revert r357452 - 'SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)'

This revision causes tests to fail under ASAN. Since the cause of the failures
is not clear (could be ASAN, could be a Clang bug, could be a bug in this
revision), the safest course of action seems to be to revert while investigating.

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

5 years agoadd periods
Amy Huang [Wed, 3 Apr 2019 22:19:07 +0000 (22:19 +0000)]
add periods

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

5 years ago[IR] Create new method in `Function` class (NFC)
Evandro Menezes [Wed, 3 Apr 2019 21:27:03 +0000 (21:27 +0000)]
[IR] Create new method in `Function` class (NFC)

Create method `optForNone()` testing for the function level equivalent of
`-O0` and refactor appropriately.

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

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

5 years ago[OPENMP]Add codegen for reduction vars with allocate clause, NFC.
Alexey Bataev [Wed, 3 Apr 2019 19:59:09 +0000 (19:59 +0000)]
[OPENMP]Add codegen for reduction vars with allocate clause, NFC.

Added test for the reduction variables with the allocate clause.

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

5 years ago[OPENMP]Add codegen for lastprivate vars with allocate clause, NFC.
Alexey Bataev [Wed, 3 Apr 2019 19:12:47 +0000 (19:12 +0000)]
[OPENMP]Add codegen for lastprivate vars with allocate clause, NFC.

Added test for the lastprivatized variables with the allocate clause.

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

5 years agoRevert "[analyzer] Toning down invalidation a bit".
Artem Dergachev [Wed, 3 Apr 2019 18:21:16 +0000 (18:21 +0000)]
Revert "[analyzer] Toning down invalidation a bit".

This reverts commit r352473.

The overall idea is great, but it seems to cause unintented consequences
when not only Region Store invalidation but also pointer escape mechanism
was accidentally affected.

Based on discussions in https://reviews.llvm.org/D58121#1452483
and https://reviews.llvm.org/D57230#1434161

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

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

5 years ago[OPENMP]Add codegen for firstprivate vars with allocate clause.
Alexey Bataev [Wed, 3 Apr 2019 17:57:06 +0000 (17:57 +0000)]
[OPENMP]Add codegen for firstprivate vars with allocate clause.

Added codegen/test for the firstprivatized variables with the allocate
clause.

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

5 years agoRevert "[LibTooling] Add Transformer, a library for source-to-source transformations."
Alexey Bataev [Wed, 3 Apr 2019 17:34:04 +0000 (17:34 +0000)]
Revert "[LibTooling] Add Transformer, a library for source-to-source transformations."

This reverts commit r357576 to fix the problem with the cyclic
dependencies between libTooling and libToolingRefactor.

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

5 years agoBug-40323: MS ABI adding template static member in the linker directive section to...
Jennifer Yu [Wed, 3 Apr 2019 17:21:40 +0000 (17:21 +0000)]
Bug-40323: MS ABI adding template static member in the linker directive section to make sure init function can be called before main.

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

5 years ago[clang-format] Do not emit replacements while regrouping if Cpp includes are OK
Krasimir Georgiev [Wed, 3 Apr 2019 15:16:04 +0000 (15:16 +0000)]
[clang-format] Do not emit replacements while regrouping if Cpp includes are OK

Summary:
Currently clang-format would always emit a replacement for multi-block #include
sections if `IBS_Regroup`, even if the sections are correct:
```
% cat ~/test.h
#include <a.h>

#include "b.h"
% bin/clang-format --output-replacements-xml -style=google ~/test.h
<?xml version='1.0'?>
<replacements xml:space='preserve' incomplete_format='false'>
<replacement offset='0' length='30'>#include &lt;a.h>&#10;&#10;#include "b.h"</replacement>
</replacements>
%
```

This change makes clang-format not emit replacements in this case.
The logic is similar to the one implemented for Java in r354452.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoWhitespace and formatting changes; NFC.
Aaron Ballman [Wed, 3 Apr 2019 14:40:00 +0000 (14:40 +0000)]
Whitespace and formatting changes; NFC.

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

5 years agoAdd a new attribute documentation category for declarations.
Aaron Ballman [Wed, 3 Apr 2019 14:26:32 +0000 (14:26 +0000)]
Add a new attribute documentation category for declarations.

This moves documentation for some attributes into new categories that are hopefully a bit more clear. In general, "Type" documentation should be for attributes that appertain to types while "Declaration" documentation should be for attributes that appertain to declarations other than functions or variables.

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

5 years agoFixing a typo; NFC.
Aaron Ballman [Wed, 3 Apr 2019 13:37:56 +0000 (13:37 +0000)]
Fixing a typo; NFC.

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

5 years agoFix typos in tests. NFC.
Xing GUO [Wed, 3 Apr 2019 13:15:09 +0000 (13:15 +0000)]
Fix typos in tests. NFC.

Reviewers: Higuoxing

Reviewed By: Higuoxing

Subscribers: kubamracek, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

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

5 years ago[LibTooling] Add Transformer, a library for source-to-source transformations.
Yitzhak Mandelbaum [Wed, 3 Apr 2019 13:05:19 +0000 (13:05 +0000)]
[LibTooling] Add Transformer, a library for source-to-source transformations.

Summary: Adds a basic version of Transformer, a library supporting the concise specification of clang-based source-to-source transformations.  A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling".

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, jfb, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] Regroup #includes into blocks for Google style
Eric Liu [Wed, 3 Apr 2019 09:25:16 +0000 (09:25 +0000)]
[clang-format] Regroup #includes into blocks for Google style

Summary:
Regrouping #includes in blocks separated by blank lines when sorting C++ #include
headers was implemented recently, and it has been preferred in Google's C++ style guide:
https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes

Reviewers: sammccall, klimek

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdding 'CLion integration' to clang-format doc
Sylvestre Ledru [Wed, 3 Apr 2019 08:56:30 +0000 (08:56 +0000)]
Adding 'CLion integration' to clang-format doc

Summary:
This commit adds a chapter 'CLion integration' to ClangFormat.rst.
The official announcement of clang-format support in CLion 2019.1: https://blog.jetbrains.com/clion/2019/03/clion-2019-1-embedded-dev-clangformat-memory-view/

Patch by Marina Kalashina

Reviewers: djasper, sylvestre.ledru, krasimir

Reviewed By: sylvestre.ledru

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[libclang][test] Suppress annoying 'LIBCLANG TOOLING ERROR' output
Fangrui Song [Wed, 3 Apr 2019 07:25:04 +0000 (07:25 +0000)]
[libclang][test] Suppress annoying 'LIBCLANG TOOLING ERROR' output

check-all invokes check-clang-python which prints the annoying message:

LIBCLANG TOOLING ERROR: fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory

Let's fix it now with os.dup os.dup2 trick.

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

5 years ago[analyzer] When failing to evaluate a __builtin_constant_p, presume it's false.
Artem Dergachev [Wed, 3 Apr 2019 01:53:40 +0000 (01:53 +0000)]
[analyzer] When failing to evaluate a __builtin_constant_p, presume it's false.

__builtin_constant_p(x) is a compiler builtin that evaluates to 1 when
its argument x is a compile-time constant and to 0 otherwise. In CodeGen
it is simply lowered to the respective LLVM intrinsic. In the Analyzer
we've been trying to delegate modeling to Expr::EvaluateAsInt, which is
allowed to sometimes fail for no apparent reason.

When it fails, let's conservatively return false. Modeling it as false
is pretty much never wrong, and it is only required to return true
on a best-effort basis, which every user should expect.

Fixes VLAChecker false positives on code that tries to emulate
static asserts in C by constructing a VLA of dynamic size -1 under the
assumption that this dynamic size is actually a constant
in the sense of __builtin_constant_p.

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

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

5 years ago[WebAssembly] Add Emscripten OS definition + small_printf
Alon Zakai [Wed, 3 Apr 2019 01:08:35 +0000 (01:08 +0000)]
[WebAssembly] Add Emscripten OS definition + small_printf

The Emscripten OS provides a definition of __EMSCRIPTEN__, and also that it
supports iprintf optimizations.

Also define small_printf optimizations, which is a printf with float support
but not long double (which in wasm can be useful since long doubles are 128
bit and force linking of float128 emulation code). This part is based on
sunfish's https://reviews.llvm.org/D57620 (which can't land yet since
the WASI integration isn't ready yet).

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

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

5 years ago[HIP-Clang] Fat binary should not be produced for non GPU code
Aaron Enye Shi [Tue, 2 Apr 2019 21:54:41 +0000 (21:54 +0000)]
[HIP-Clang] Fat binary should not be produced for non GPU code

clang-format the changes to CUDA and HIP fat binary.

Reviewers: yaxunl, tra

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

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

5 years ago[HIP-Clang] Fat binary should not be produced for non GPU code 2
Aaron Enye Shi [Tue, 2 Apr 2019 20:49:41 +0000 (20:49 +0000)]
[HIP-Clang] Fat binary should not be produced for non GPU code 2

Also for CUDA, we need to disable producing these fat binary functions when there is no GPU code.

Reviewers: yaxunl, tra

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

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

5 years ago[HIP-Clang] Fat binary should not be produced for non GPU code
Aaron Enye Shi [Tue, 2 Apr 2019 20:10:18 +0000 (20:10 +0000)]
[HIP-Clang] Fat binary should not be produced for non GPU code

Skip producing the fat binary functions for HIP when no device code is present.

Reviewers: yaxunl

Differential Review: https://reviews.llvm.org/D60141

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

5 years ago[Sema] Fix a use-after-deallocate of a ParsedAttr
Erik Pilkington [Tue, 2 Apr 2019 19:48:11 +0000 (19:48 +0000)]
[Sema] Fix a use-after-deallocate of a ParsedAttr

moveAttrFromListToList only makes sense when moving an attribute to a list with
a pool that's either equivalent, or has a shorter lifetime. Therefore, using it
to move a ParsedAttr from a declarator to a declaration specifier doesn't make
sense, since the declaration specifier's pool outlives the declarator's. The
patch adds a new function, ParsedAttributes::takeOneFrom, which transfers the
attribute from one pool to another, fixing the use-after-deallocate.

rdar://49175426

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

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