]> granicus.if.org Git - clang/log
clang
8 years agoModule debugging: Defer emitting tag types until their definition
Adrian Prantl [Wed, 6 Jan 2016 19:22:19 +0000 (19:22 +0000)]
Module debugging: Defer emitting tag types until their definition
was visited and all decls have been merged.

We only get a single chance to emit the types for virtual classes because
CGDebugInfo::completeRequiredType() categorically doesn't complete them.

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

8 years agoFix -Wdocumentation warning after r256933
Nico Weber [Wed, 6 Jan 2016 19:13:49 +0000 (19:13 +0000)]
Fix -Wdocumentation warning after r256933

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

8 years agoBump DiagnosticDriverKinds count; we're close to hitting it.
Ahmed Bougacha [Wed, 6 Jan 2016 18:43:14 +0000 (18:43 +0000)]
Bump DiagnosticDriverKinds count; we're close to hitting it.

 $ grep '= DIAG_START_DRIVER' include/clang/Basic/DiagnosticIDs.h
       DIAG_START_FRONTEND      = DIAG_START_DRIVER          +  100,
 $ grep 'def ' include/clang/Basic/DiagnosticDriverKinds.td | wc -l
       98

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

8 years agoShow inclusions from a preamble in clang_getInclusions.
Erik Verbruggen [Wed, 6 Jan 2016 15:12:51 +0000 (15:12 +0000)]
Show inclusions from a preamble in clang_getInclusions.

When reparsing a translation unit with preamble generation turned on,
no includes are found. This is due to the fact that all SLocs from
AST/PCH files are skipped as they are 'loaded', and inclusions from a
preamble are also 'loaded'. So, in case a file has a preamble, it first
needs to process those loaded inclusions, and then check for any local
inclusions. This latter one is for any includes that are not part of the
preamble, like includes half-way through a file.

This fixes PR24748.

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

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

8 years ago[Driver] Add support for -fno-builtin-foo options.
Chad Rosier [Wed, 6 Jan 2016 14:35:46 +0000 (14:35 +0000)]
[Driver] Add support for -fno-builtin-foo options.

Addresses PR4941 and rdar://6756912.
http://reviews.llvm.org/D15195

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

8 years ago[Hexagon] Use back_inserter as target iterator in std::copy
Krzysztof Parzyszek [Wed, 6 Jan 2016 14:13:11 +0000 (14:13 +0000)]
[Hexagon] Use back_inserter as target iterator in std::copy

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

8 years ago[OpenMP] Reapply rL256842: [OpenMP] Offloading descriptor registration and device...
Samuel Antao [Wed, 6 Jan 2016 13:42:12 +0000 (13:42 +0000)]
[OpenMP] Reapply rL256842: [OpenMP] Offloading descriptor registration and device codegen.

This patch attempts to fix the regressions identified when the patch was committed initially.

Thanks to Michael Liao for identifying the fix in the offloading metadata generation
related with side effects in evaluation of function arguments.

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

8 years ago[Analyzer] Change the default SA checkers for PS4
Sean Eveson [Wed, 6 Jan 2016 10:03:58 +0000 (10:03 +0000)]
[Analyzer] Change the default SA checkers for PS4

Summary: This patch removes security.*, unix.API and unix.Vfork from the default checkers for PS4.

Reviewers: dcoughlin, zaks.anna

Subscribers: cfe-commits

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

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

8 years agoAdd -fno-movt frontend option, to disable movt/movw on ARM
Dimitry Andric [Wed, 6 Jan 2016 07:42:18 +0000 (07:42 +0000)]
Add -fno-movt frontend option, to disable movt/movw on ARM

Summary:
In rL256641, @davide turned off movt generation by default for FreeBSD.
This was because our ld is very old, and did not support the relocations
for it.  However, Ian Lepore added the support very recently, so we
would like to revert rL256641, and replace it with a new `-fno-movt`
frontend option.  This way, it can be turned off when needed.

Reviewers: dexonsmith, echristo, emaste, davide

Subscribers: andrew, aemerson, rengolin, davide, cfe-commits, ahatanak, emaste

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

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

8 years agoChange the set of actions built for external gcc tools.
Eric Christopher [Wed, 6 Jan 2016 07:24:45 +0000 (07:24 +0000)]
Change the set of actions built for external gcc tools.

A gcc tool has an "integrated" assembler (usually gas) that it
will call to produce an object. Let it use that assembler so
that we don't have to deal with assembly syntax incompatibilities.

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

8 years ago[modules] When a tag type that was imported from a module is referenced via an
Richard Smith [Wed, 6 Jan 2016 03:52:10 +0000 (03:52 +0000)]
[modules] When a tag type that was imported from a module is referenced via an
elaborated-type-specifier, create a declaration of it to track that the current
module makes it visible too.

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

8 years agoAvoid assert failure on some invalid cc1 options.
Douglas Katzman [Wed, 6 Jan 2016 01:37:57 +0000 (01:37 +0000)]
Avoid assert failure on some invalid cc1 options.

Addressing review comment in D13221.

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

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

8 years ago[analyzer] Fix false warning about memory leak for QApplication::postEvent
Anna Zaks [Wed, 6 Jan 2016 00:32:56 +0000 (00:32 +0000)]
[analyzer] Fix false warning about memory leak for QApplication::postEvent

According to Qt documentation Qt takes care of memory allocated for QEvent:
http://doc.qt.io/qt-4.8/qcoreapplication.html#postEvent

A patch by Evgeniy Dushistov!

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

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

8 years ago[analyzer] Suppress reports coming from std::__independent_bits_engine
Anna Zaks [Wed, 6 Jan 2016 00:32:52 +0000 (00:32 +0000)]
[analyzer] Suppress reports coming from std::__independent_bits_engine

The analyzer reports a shift by a negative value in the constructor. The bug can
be easily triggered by calling std::random_shuffle on a vector
(<rdar://problem/19658126>).

(The shift by a negative value is reported because __w0_ gets constrained to
63 by the conditions along the path:__w0_ < _WDt && __w0_ >= _WDt-1,
where _WDt is 64. In normal execution, __w0_ is not 63, it is 1 and there is
no overflow. The path is infeasible, but the analyzer does not know about that.)

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

8 years ago[analyzer] Don't report null dereferences on address_space annotated memory
Anna Zaks [Wed, 6 Jan 2016 00:32:49 +0000 (00:32 +0000)]
[analyzer] Don't report null dereferences on address_space annotated memory

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

8 years agoFix a typo in testcase and increase its coverage!
Adrian Prantl [Tue, 5 Jan 2016 23:54:01 +0000 (23:54 +0000)]
Fix a typo in testcase and increase its coverage!

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

8 years ago[CMake] Support a simple case for bootstrap builds to generate PGO data
Chris Bieneman [Tue, 5 Jan 2016 23:51:42 +0000 (23:51 +0000)]
[CMake] Support a simple case for bootstrap builds to generate PGO data

Summary:
This patch adds support for the clang multi-stage bootstrapping to support PGO profdata generation, and can build a 2 or 3 stage compiler.

With this patch applied you can configure your build directory with the following invocation of CMake:

cmake -G <generator> -C <path_to_clang>/cmake/caches/PGO.cmake <source dir>

After configuration the following additional targets will be generated:

stage2-instrumented:
Builds a stage1 x86 compiler, runtime, and required tools (llvm-config, llvm-profdata) then uses that compiler to build an instrumented stage2 compiler.

stage2-instrumented-generate-profdata:
Depends on "stage2-instrumented" and will use the instrumented compiler to generate profdata based on the training files in <clang>/utils/perf-training

stage2:
Depends on "stage2-instrumented-generate-profdata" and will use the stage1 compiler with the stage2 profdata to build a PGO-optimized compiler.

stage2-check-llvm:
Depends on stage2 and runs check-llvm using the stage3 compiler.

stage2-check-clang:
Depends on stage2 and runs check-clang using the stage3 compiler.

stage2-check-all:
Depends on stage2 and runs check-all using the stage3 compiler.

stage2-test-suite:
Depends on stage2 and runs the test-suite using the stage3 compiler (requires in-tree test-suite).

Reviewers: bogner, silvas, chandlerc

Subscribers: cfe-commits

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

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

8 years ago[Clang/Support/Windows/Unix] Command lines created by clang may exceed the command...
Oleg Ranevskyy [Tue, 5 Jan 2016 19:54:39 +0000 (19:54 +0000)]
[Clang/Support/Windows/Unix] Command lines created by clang may exceed the command length limit set by the OS

Summary:
LLVM part of the patch is D15831.

When clang runs an external tool such as a linker it may create a command line that exceeds the length limit.

Clang uses the llvm::sys::argumentsFitWithinSystemLimits function to check if command line length fits the OS

limitation. There are two problems in this function that may cause exceeding of the limit:

1. It ignores the length of the program path in its calculations. On the other hand, clang adds the program

path to the command line when it runs the program.

2. It assumes no space character is inserted after the last argument, which is not true for Windows. The flattenArgs function adds the trailing space for *each* argument. The result of this is that the terminating NULL character is not counted and may be placed beyond the length limit if the command line is exactly 32768 characters long. The WinAPI's CreateProcess does not find the NULL character and fails.

Reviewers: rafael, asl

Subscribers: asl, llvm-commits

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

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

8 years ago[OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and device...
Samuel Antao [Tue, 5 Jan 2016 19:16:13 +0000 (19:16 +0000)]
[OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and device codegen.

It was causing two regression, so I'm reverting until the cause is found.

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

8 years ago[PGO] Enable clang to pass compiler-rt profile support library to linker on Windows
Nathan Slingerland [Tue, 5 Jan 2016 18:27:06 +0000 (18:27 +0000)]
[PGO] Enable clang to pass compiler-rt profile support library to linker on Windows

Summary: This change enables clang to automatically link binaries built with the -fprofile-instr-generate against the clang_rt.profile-i386.lib library.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

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

8 years ago[OpenMP] Allow file ID to be signed in the offloading metadata.
Samuel Antao [Tue, 5 Jan 2016 18:02:24 +0000 (18:02 +0000)]
[OpenMP] Allow file ID to be signed in the offloading metadata.

This fixes a regression introduced by rL256842.

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

8 years ago[OpenMP] Offloading descriptor registration and device codegen.
Samuel Antao [Tue, 5 Jan 2016 16:23:04 +0000 (16:23 +0000)]
[OpenMP] Offloading descriptor registration and device codegen.

Summary:
In order to offloading work properly two things need to be in place:
- a descriptor with all the offloading information (device entry functions, and global variable) has to be created by the host and registered in the OpenMP offloading runtime library.
- all the device functions need to be emitted for the device and a convention has to be in place so that the runtime library can easily map the host ID of an entry point with the actual function in the device.

This patch adds support for these two things. However, only entry functions are being registered given that 'declare target' directive is not yet implemented.

About offloading descriptor:

The details of the descriptor are explained with more detail in http://goo.gl/L1rnKJ. Basically the descriptor will have fields that specify the number of devices, the pointers to where the device images begin and end (that will be defined by the linker), and also pointers to a the begin and end of table whose entries contain information about a specific entry point. Each entry has the type:
```
struct __tgt_offload_entry{
 void *addr;
 char *name;
 int64_t size;
};
```
and will be implemented in a pre determined (ELF) section `.omp_offloading.entries` with 1-byte alignment, so that when all the objects are linked, the table is in that section with no padding in between entries (will be like a C array). The code generation ensures that all `__tgt_offload_entry` entries are emitted in the same order for both host and device so that the runtime can have the corresponding entries in both host and device in same index of the table, and efficiently implement the mapping.

The resulting descriptor is registered/unregistered with the runtime library using the calls `__tgt_register_lib` and `__tgt_unregister_lib`. The registration is implemented in a high priority global initializer so that the registration happens always before any initializer (that can potentially include target regions) is run.

The driver flag -omptargets= was created to specify a comma separated list of devices the user wants to support so that the new functionality can be exercised. Each device is specified with its triple.

About target codegen:

The target codegen is pretty much straightforward as it reuses completely the logic of the host version for the same target region. The tricky part is to identify the meaningful target regions in the device side. Unlike other programming models, like CUDA, there are no already outlined functions with attributes that mark what should be emitted or not. So, the information on what to emit is passed in the form of metadata in host bc file. This requires a new option to pass the host bc to the device frontend. Then everything is similar to what happens in CUDA: the global declarations emission is intercepted to check to see if it is an "interesting" declaration. The difference is that instead of checking an attribute, the metadata information in checked. Right now, there is only a form of metadata to pass information about the device entry points (target regions). A class `OffloadEntriesInfoManagerTy` was created to manage all the information and queries related with the metadata. The metadata looks like this:
```
!omp_offload.info = !{!0, !1, !2, !3, !4, !5, !6}

!0 = !{i32 0, i32 52, i32 77426347, !"_ZN2S12r1Ei", i32 479, i32 13, i32 4}
!1 = !{i32 0, i32 52, i32 77426347, !"_ZL7fstatici", i32 461, i32 11, i32 5}
!2 = !{i32 0, i32 52, i32 77426347, !"_Z9ftemplateIiET_i", i32 444, i32 11, i32 6}
!3 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 99, i32 11, i32 0}
!4 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 272, i32 11, i32 3}
!5 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 127, i32 11, i32 1}
!6 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 159, i32 11, i32 2}
```
The fields in each metadata entry are (in sequence):
Entry 1) an ID of the type of metadata - right now only zero is used meaning "OpenMP target region".
Entry 2) a unique ID of the device where the input source file that contain the target region lives.
Entry 3) a unique ID of the file where the input source file that contain the target region lives.
Entry 4) a mangled name of the function that encloses the target region.
Entries 5) and 6) line and column number where the target region was found.
Entry 7) is the order the entry was emitted.

Entry 2) and 3) are required to distinguish files that have the same function name.
Entry 4) is required to distinguish different instances of the same declaration (usually templated ones)
Entries 5) and 6) are required to distinguish the particular target region in body of the function (it is possible that a given target region is not an entry point - if clause can evaluate always to zero - and therefore we need to identify the "interesting" target regions. )

This patch replaces http://reviews.llvm.org/D12306.

Reviewers: ABataev, hfinkel, tra, rjmccall, sfantao

Subscribers: FBrygidyn, piotr.rak, Hahnfeld, cfe-commits

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

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

8 years agoclang-format: Fix corner case in "if it saves columns"-calculation.
Daniel Jasper [Tue, 5 Jan 2016 16:10:39 +0000 (16:10 +0000)]
clang-format: Fix corner case in "if it saves columns"-calculation.

Before:
  aaaa
      .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  aaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

8 years ago[OpenCL] Disallow taking an address of a function.
Anastasia Stulova [Tue, 5 Jan 2016 14:39:27 +0000 (14:39 +0000)]
[OpenCL] Disallow taking an address of a function.

An undecorated function designator implies taking the address of a function,
which is illegal in OpenCL. Implementing a check for this earlier to allow
the error to be reported even in the presence of other more obvious errors.

Patch by Neil Hickey!

http://reviews.llvm.org/D15691

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

8 years agoclang-format: Handle \n the same way as std::endl with stream operator.
Daniel Jasper [Tue, 5 Jan 2016 13:06:27 +0000 (13:06 +0000)]
clang-format: Handle \n the same way as std::endl with stream operator.

clang-format breaks multi-line streams after std::endl.
It now also break for '\n', the suggested replacement for std::endl:

  http://llvm.org/docs/CodingStandards.html#avoid-std-endl

Before:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaa << '\n' << bbbbbbbbbbbbbbbbbbbbbb
               << '\n';
  llvm::errs() << aaaa << "aaaaaaaaaaaaaaaaaa\n" << bbbb
               << "bbbbbbbbbbbbbbbbbb\n";

After:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaa << '\n'
               << bbbbbbbbbbbbbbbbbbbbbb << '\n';
  llvm::errs() << aaaa << "aaaaaaaaaaaaaaaaaa\n"
               << bbbb << "bbbbbbbbbbbbbbbbbb\n";

This changeset ensure that multiline streams have a line break after:
  - std::endl
  - '\n'
  - "\n"
  - "Some Text\n"

Patch by Jean-Philippe Dufraigne, thank you.

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

8 years agoclang-format: Avoid creating hanging indents in call sequences.
Daniel Jasper [Tue, 5 Jan 2016 13:03:59 +0000 (13:03 +0000)]
clang-format: Avoid creating hanging indents in call sequences.

Before:
  aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaa(
                      aaaaaaaaaaaaaaaaaaaa)
        .aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  aaaaaaaaaaaaaaaa
        .aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa)
        .aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

8 years agoclang-format: Improve line wrapping behavior in call sequences.
Daniel Jasper [Tue, 5 Jan 2016 13:03:50 +0000 (13:03 +0000)]
clang-format: Improve line wrapping behavior in call sequences.

r256750 has been leading to an undesired behavior:

  aaaaaaaaaa
      .aaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

This change increases penalty for wrapping before member accesses that aren't
calls. Thus, this is again formatted as (as it has been before r256750):

  aaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaa.aaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

8 years ago[AArch64] Teaches clang about Samsung Exynos-M1
MinSeong Kim [Tue, 5 Jan 2016 12:53:24 +0000 (12:53 +0000)]
[AArch64] Teaches clang about Samsung Exynos-M1

Adds core tuning support for new Samsung Exynos-M1 core (ARMv8-A).

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

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

8 years ago[ARM] [AARCH64] Add CodeGen IR tests for {VS}QRDML{AS}H v8.1a intrinsics.
Alexandros Lamprineas [Tue, 5 Jan 2016 09:58:29 +0000 (09:58 +0000)]
[ARM] [AARCH64] Add CodeGen IR tests for {VS}QRDML{AS}H v8.1a intrinsics.

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

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

8 years agoAvoid walking all the declarations in the TU when a tag is declared in function
Richard Smith [Tue, 5 Jan 2016 01:21:53 +0000 (01:21 +0000)]
Avoid walking all the declarations in the TU when a tag is declared in function
prototype scope in a function definition.

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

8 years agoRemove an unused parameter
David Majnemer [Tue, 5 Jan 2016 00:08:41 +0000 (00:08 +0000)]
Remove an unused parameter

No functionality change is intended

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

8 years ago[ms-inline-asm] Handle dependent identifiers in inline asm
David Majnemer [Mon, 4 Jan 2016 23:51:15 +0000 (23:51 +0000)]
[ms-inline-asm] Handle dependent identifiers in inline asm

Build up a dependent expression for MS-style inline assembly if the
identifier's type is dependent.

This fixes PR26001.

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

8 years agoRemove setting of inlinehint and cold attributes based on profile data
Easwaran Raman [Mon, 4 Jan 2016 23:32:28 +0000 (23:32 +0000)]
Remove setting of inlinehint and cold attributes based on profile data

NFC. These hints are only used for inlining and the inliner now uses
the same criteria to identify hot and cold callees and set appropriate
thresholds without relying on these hints. Hence this removed code is
superfluous.

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

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

8 years agoAdd some overlooked optnone tests, and tighten up an existing test.
Paul Robinson [Mon, 4 Jan 2016 17:03:58 +0000 (17:03 +0000)]
Add some overlooked optnone tests, and tighten up an existing test.

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

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

8 years agoclang-format: [JS] Support more ES6 default exports.
Daniel Jasper [Mon, 4 Jan 2016 16:10:36 +0000 (16:10 +0000)]
clang-format: [JS] Support more ES6 default exports.

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

8 years agoclang-format: [JS] Support ES6 exports of array literals.
Daniel Jasper [Mon, 4 Jan 2016 15:51:56 +0000 (15:51 +0000)]
clang-format: [JS] Support ES6 exports of array literals.

Before:
  export default[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb];
  export default[];

After:
  export default [
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
    bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
  ];
  export default [];

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

8 years agoclang-format: [JS] Improve empty array literal detection.
Daniel Jasper [Mon, 4 Jan 2016 13:11:41 +0000 (13:11 +0000)]
clang-format: [JS] Improve empty array literal detection.

Previously, the [] in the following example were recognized as an array
subscript leading to weird indentation.

Before:
  var aaaa = aaaaa || // wrap
                          [];

After:
  var aaaa = aaaaa || // wrap
             [];

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

8 years agoclang-format: Fix corner case in builder-type call formatting.
Daniel Jasper [Mon, 4 Jan 2016 12:41:11 +0000 (12:41 +0000)]
clang-format: Fix corner case in builder-type call formatting.

Before:
  return aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa,
  aaaaaaaaaaaaaaaaa)
      .aaaa(aaaaaaaaaaaaaa);

After:
  return aaaaaaaaaaaaaaaa
      .aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      .aaaa(aaaaaaaaaaaaaa);

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

8 years agoConvert test/CXX/lex/lex.literal/lex.string/p4.cpp back to DOS line
Dimitry Andric [Mon, 4 Jan 2016 10:17:48 +0000 (10:17 +0000)]
Convert test/CXX/lex/lex.literal/lex.string/p4.cpp back to DOS line
endings, since the file is supposed to have them, according to its
comments.  Also set its svn:eol-style property.  Noticed by Nico Weber.

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

8 years agoclang-format: Align long braced init lists even if they are nested in
Daniel Jasper [Mon, 4 Jan 2016 07:30:44 +0000 (07:30 +0000)]
clang-format: Align long braced init lists even if they are nested in
function calls.

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

8 years agoclang-format: Fix corner case for lambda assignments.
Daniel Jasper [Mon, 4 Jan 2016 07:29:40 +0000 (07:29 +0000)]
clang-format: Fix corner case for lambda assignments.

Before:
  std::function<std::string(const std::string &)> my_lambda = [](
      const string &s) { return s; };

After:
  std::function<std::string(const std::string &)> my_lambda =
      [](const string &s) { return s; };

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

8 years agoclang-format: Fix corner-case in ObjC method declaration formatting
Daniel Jasper [Mon, 4 Jan 2016 07:29:07 +0000 (07:29 +0000)]
clang-format: Fix corner-case in ObjC method declaration formatting

Before:
  - (void)shortf:(GTMFoo *)theFoo
     longKeyword:(NSRect)theRect
   longerKeyword:(float)theInterval
           error:(NSError **)theError {
  }

After:
  - (void)shortf:(GTMFoo *)theFoo
        longKeyword:(NSRect)theRect
      longerKeyword:(float)theInterval
              error:(NSError **)theError {
  }

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

8 years agoclang-format: [Proto] Basic support for options with <> for repeated fields.
Daniel Jasper [Mon, 4 Jan 2016 07:28:12 +0000 (07:28 +0000)]
clang-format: [Proto] Basic support for options with <> for repeated fields.

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

8 years agoclang-format: [Proto] Improve wrapping of message field attributes.
Daniel Jasper [Mon, 4 Jan 2016 07:27:33 +0000 (07:27 +0000)]
clang-format: [Proto] Improve wrapping of message field attributes.

Before:
  optional AAA aaa = 1 [foo =
    {
      key: "a"  //
    },
bar = {
  key: "a"  //
}];

After:
  optional AAA aaa = 1 [
    foo = {
      key: "a"  //
    },
    bar = {
      key: "a"  //
    }
  ];

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

8 years ago[TableGen] Call llvm_shutdown on exit so that all the ManagedStatic objects in the...
Craig Topper [Mon, 4 Jan 2016 04:51:46 +0000 (04:51 +0000)]
[TableGen] Call llvm_shutdown on exit so that all the ManagedStatic objects in the support library will be deleted.

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

8 years agoArrayRef-ize a function. NFC
Craig Topper [Sun, 3 Jan 2016 19:43:23 +0000 (19:43 +0000)]
ArrayRef-ize a function. NFC

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

8 years agoUse std::is_sorted instead of a manual loop. NFC
Craig Topper [Sun, 3 Jan 2016 19:43:20 +0000 (19:43 +0000)]
Use std::is_sorted instead of a manual loop. NFC

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

8 years ago[PGO] Cleanup: Use covmap header definition in the template file
Xinliang David Li [Sun, 3 Jan 2016 19:25:54 +0000 (19:25 +0000)]
[PGO] Cleanup: Use covmap header definition in the template file

This is one last remaining instrumentatation related structure
that needs to be migrate to use the centralized template
definition.  With this change, instrumentation code
related to coverage module header will be kept in sync
with the coverage mapping reader. The remaining code
which makes implicit assumption about covmap control
structure layout in the the lowering pass will cleaned
up in a different patch. This patch is not intended to
have no functional change.

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

8 years agoFix several accidental DOS line endings in source files
Dimitry Andric [Sun, 3 Jan 2016 15:55:40 +0000 (15:55 +0000)]
Fix several accidental DOS line endings in source files

Summary:
There are a number of files in the tree which have been accidentally checked in with DOS line endings. Convert these to native line endings.

There are also a few files which have DOS line endings on purpose, and I have set the svn:eol-style property to 'CRLF' on those.

Reviewers: joerg, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

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

8 years agoReimplement __readeflags and __writeeflags on top of intrinsics
David Majnemer [Fri, 1 Jan 2016 06:50:08 +0000 (06:50 +0000)]
Reimplement __readeflags and __writeeflags on top of intrinsics

Lean on LLVM to provide this functionality now that it provides the
necessary intrinsics.

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

8 years ago[TrailingObjects] Fix "Convert classes in OpenMPClause.h" for MSVC
James Y Knight [Fri, 1 Jan 2016 01:12:48 +0000 (01:12 +0000)]
[TrailingObjects] Fix "Convert classes in OpenMPClause.h" for MSVC

"friend class OMPVarListClause" -> "friend OMPVarListClause".  It's a
template, not a class.

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

8 years ago[TrailingObjects] Convert classes in OpenMPClause.h
James Y Knight [Fri, 1 Jan 2016 00:38:24 +0000 (00:38 +0000)]
[TrailingObjects] Convert classes in OpenMPClause.h

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

8 years ago[X86][PKU] add clang intrinsic for {RD|WR}PKRU
Asaf Badouh [Thu, 31 Dec 2015 14:14:07 +0000 (14:14 +0000)]
[X86][PKU] add clang intrinsic for {RD|WR}PKRU

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

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

8 years ago[OPENMP 4.5] Codegen for 'schedule' clause with monotonic/nonmonotonic modifiers.
Alexey Bataev [Thu, 31 Dec 2015 06:52:34 +0000 (06:52 +0000)]
[OPENMP 4.5] Codegen for 'schedule' clause with monotonic/nonmonotonic modifiers.
OpenMP 4.5 adds support for monotonic/nonmonotonic modifiers in 'schedule' clause. Add codegen for these modifiers.

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

8 years ago[TrailingObjects] Fix bug in "Convert classes in ExprObjC.h"
James Y Knight [Thu, 31 Dec 2015 06:01:19 +0000 (06:01 +0000)]
[TrailingObjects] Fix bug in "Convert classes in ExprObjC.h"

(Detected by asan)

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

8 years ago[MS ABI] Remove mangleCXXCatchHandlerType
David Majnemer [Thu, 31 Dec 2015 05:36:54 +0000 (05:36 +0000)]
[MS ABI] Remove mangleCXXCatchHandlerType

It's dead code, no functional change is intended.

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

8 years ago[MS ABI] Change the ArgBackRefMap to hold const qualified pointers
David Majnemer [Thu, 31 Dec 2015 05:36:52 +0000 (05:36 +0000)]
[MS ABI] Change the ArgBackRefMap to hold const qualified pointers

Just a cleanup, no functional change is intended.

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

8 years ago[MS ABI] Replace dead code with an assertion
David Majnemer [Thu, 31 Dec 2015 05:36:50 +0000 (05:36 +0000)]
[MS ABI] Replace dead code with an assertion

As per C++ [dcl.ref]p1, cv-qualified references are not valid. As such,
change the mangler to assert that this event does not happen.

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

8 years ago[MSVC Compat] Diagnose multiple default ctors for dllexport'd classes
David Majnemer [Thu, 31 Dec 2015 05:36:46 +0000 (05:36 +0000)]
[MSVC Compat] Diagnose multiple default ctors for dllexport'd classes

The MS ABI emits a special default constructor closure thunk if a
default constructor has a weird calling convention or default arguments.

The MS ABI has a quirk: there can be only one such thunk because the
mangling scheme does not have room for distinct manglings.  We must
raise a diagnostic in this eventuality.

N.B.  MSVC sorta gets this right.  Multiple default constructors result
in the default constructor closure getting emitted but they seem to
get confused by which default constructors are reasonable to reference
from the closure.  We try to be a little more careful which results in
mild differences in behavior.

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

8 years ago[TrailingObjects] Convert classes in ExprObjC.h
James Y Knight [Thu, 31 Dec 2015 04:43:19 +0000 (04:43 +0000)]
[TrailingObjects] Convert classes in ExprObjC.h

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

8 years ago[TrailingObjects] Convert remaining classes in Expr.h and ExprCXX.h
James Y Knight [Thu, 31 Dec 2015 04:18:25 +0000 (04:18 +0000)]
[TrailingObjects] Convert remaining classes in Expr.h and ExprCXX.h

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

8 years agoImprove diagnostic for the case where a function template candidate is rejected
Richard Smith [Thu, 31 Dec 2015 02:02:54 +0000 (02:02 +0000)]
Improve diagnostic for the case where a function template candidate is rejected
by overload resolution because deduction succeeds, but the substituted
parameter type for some parameter (with deduced type) doesn't exactly match the
corresponding adjusted argument type.

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

8 years agoImplement [temp.deduct.type]p6: if the nested-name-specifier of a type is
Richard Smith [Wed, 30 Dec 2015 20:56:05 +0000 (20:56 +0000)]
Implement [temp.deduct.type]p6: if the nested-name-specifier of a type is
dependent, the type is a non-deduced context.

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

8 years agoSilencing a -Wcast-qual warning; NFC.
Aaron Ballman [Wed, 30 Dec 2015 16:02:17 +0000 (16:02 +0000)]
Silencing a -Wcast-qual warning; NFC.

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

8 years agoWhen performing an implicit from float to bool, the floating point value must be...
Aaron Ballman [Wed, 30 Dec 2015 14:26:07 +0000 (14:26 +0000)]
When performing an implicit from float to bool, the floating point value must be *exactly* zero in order for the conversion to result in 0. This does not involve a conversion through an integer value, and so truncation of the value is not performed.

This patch address PR25876.

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

8 years agoDisable generating movt on FreeBSD.
Davide Italiano [Wed, 30 Dec 2015 13:53:25 +0000 (13:53 +0000)]
Disable generating movt on FreeBSD.

It's sort of an hack, but we have no choice.
The linker in the base system doesn't handle that correctly (yet).
Once FreeBSD will import lld, this can be backed out.

Patch by: Andrew Turner!

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

8 years agoclang-format: Slightly row back on r256343 by increasing penalty for
Daniel Jasper [Wed, 30 Dec 2015 12:23:00 +0000 (12:23 +0000)]
clang-format: Slightly row back on r256343 by increasing penalty for
breaking between array subscripts.

Before:
  if (aaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa]
                                                     [aaaaaaaaaaaaa])
After:
  if (aaaaaaaaaaaaaaaaaaaaaaaa &&
      aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa][aaaaaaaaaaaaa])

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

8 years ago[OPENMP 4.5] Allow 'ordered' clause on 'loop simd' constructs.
Alexey Bataev [Wed, 30 Dec 2015 12:06:23 +0000 (12:06 +0000)]
[OPENMP 4.5] Allow 'ordered' clause on 'loop simd' constructs.
OpenMP 4.5 allows to use 'ordered' clause without parameter on 'loop simd' constructs.

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

8 years agoclang-format: [JS] Support TypeScript 1.6 user defined type guards.
Daniel Jasper [Wed, 30 Dec 2015 08:00:58 +0000 (08:00 +0000)]
clang-format: [JS] Support TypeScript 1.6 user defined type guards.

Before:
  function foo(check: Object): check
  is{foo: string, bar: string, baz: string, foobar: string} {
    return 'bar' in check;
  }

After:
  function foo(check: Object):
      check is {foo: string, bar: string, baz: string, foobar: string} {
    return 'bar' in check;
  }

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

8 years ago[ptr-traits] Add another complete type that is necessary for at least
Chandler Carruth [Wed, 30 Dec 2015 06:38:29 +0000 (06:38 +0000)]
[ptr-traits] Add another complete type that is necessary for at least
some of the build bots. Still can't reproduce these failures locally.

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

8 years ago[ptr-traits] Some compilers (older Clang? unsure) on build bots need
Chandler Carruth [Wed, 30 Dec 2015 06:21:02 +0000 (06:21 +0000)]
[ptr-traits] Some compilers (older Clang? unsure) on build bots need
this constructor to be out of line in order to not require the complete
type of TemplateDecl.

Hopefully this will fix the build bots.

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

8 years ago[MS ABI] Add variable templates to the NameBackReferences
David Majnemer [Wed, 30 Dec 2015 05:40:32 +0000 (05:40 +0000)]
[MS ABI] Add variable templates to the NameBackReferences

Only function template specializations are exempt from being added to
the NameBackReferences.  Redundant variable template specializations
should be appropriately substituted.

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

8 years ago[MS ABI] Improve our mangling of pass_object_size
David Majnemer [Wed, 30 Dec 2015 05:13:03 +0000 (05:13 +0000)]
[MS ABI] Improve our mangling of pass_object_size

We didn't add the artificial pass_object_size arguments to the
backreference map which bloated the size of manglings which involved
pass_object_size with duplicate types.

This lets us go from:
?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size1@3@@Z

to:
?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z

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

8 years agoFix alignment issue in CodeGenFunction::PopCleanupBlock.
James Y Knight [Wed, 30 Dec 2015 03:58:33 +0000 (03:58 +0000)]
Fix alignment issue in CodeGenFunction::PopCleanupBlock.

It was copying an EHCleanupStack::Cleanup object into a
SmallVector<char>, with a comment saying that SmallVector's alignment is
always large enough. Unfortunately, that isn't actually true after
r162331 in 2012.

Expand the code (somewhat distastefully) to get a stack allocation with
a correct alignment.

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

8 years ago[ptr-traits] Add #includes of headers rather than forward declarations
Chandler Carruth [Wed, 30 Dec 2015 03:40:23 +0000 (03:40 +0000)]
[ptr-traits] Add #includes of headers rather than forward declarations
for types which are used as pointees in PointerUnions, PointerIntPairs,
and DenseMap pointer keys.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

I think this is the last patch for getting Clang clean here!!!

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

8 years ago[ptr-traits] Move a class definition up to the top of this header so it
Chandler Carruth [Wed, 30 Dec 2015 03:33:22 +0000 (03:33 +0000)]
[ptr-traits] Move a class definition up to the top of this header so it
can be referenced as part of a PointerIntPair.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

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

8 years ago[ptr-traits] Move methods manipulating PointerUnions, DenseMap pointer
Chandler Carruth [Wed, 30 Dec 2015 03:24:14 +0000 (03:24 +0000)]
[ptr-traits] Move methods manipulating PointerUnions, DenseMap pointer
keys, and PointerIntPairs where the pointee types are incomplete
out-of-line to where we have the complete type.

This is the standard pattern used throughout the AST library to address
the inherently mutually cross referenced nature of the AST.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

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

8 years ago[ptr-traits] Switch the Redeclarable template to using a void pointer in
Chandler Carruth [Wed, 30 Dec 2015 03:09:25 +0000 (03:09 +0000)]
[ptr-traits] Switch the Redeclarable template to using a void pointer in
its PointerUnion rather than an ASTContext pointer.

Using pointers with PointerUnion really should be checking the pointee
type's alignment, and we can't do this without the complete type. The
Redeclarable template inherently can't know the complete type of
ASTContext because of its layering, and because it is a template its
methods can't reasonably be out-of-line the way we traditionally solve
circular references within the AST library.

After discussing this with Richard Smith, his suggestion which I have
implemented here was to just drop to a void* for the PointerUnion. This
essentially documents that we're going to completely ignore the type
(including its potential alignment consequences) for this code. There
are still of course dynamic guards that this ended up working correctly,
and because of the way the code is factored this doesn't leak outside of
the very narrow implementation guts of Redeclarable.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

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

8 years ago[ptr-traits] Switch from a really wasteful SmallDenseMap of
Chandler Carruth [Wed, 30 Dec 2015 03:00:23 +0000 (03:00 +0000)]
[ptr-traits] Switch from a really wasteful SmallDenseMap of
SmallVector<.., 16> (16!!!!) objects to a simple SmallVector of pairs.

This no longer de-duplicates the common function pointers used during
deallocation, but this doesn't really seem worth the complexity and
overhead of managing the map-of-vectors. Notably, there is no reason to
assume that functions have the 4-byte alignment that DenseMap relies on,
and indeed this prevents checking the alignment of the DenseMap keys
because we can't even meaningfully query the alignment of functions
using our existing alignment tools.

Generally, function pointers don't seem like a great idea for keys in
a DenseMap. =]

I chatted with Richard Smith about this a bit as well and have written
down a FIXME because this *does* waste some memory and in general seems
a very clumsy memory management strategy. He would like to see a more
fundamental fix eventually here that tries to build a better pattern.

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

8 years ago[ptr-traits] Stop using two bogus types as stand-ins for flags
Chandler Carruth [Wed, 30 Dec 2015 02:51:00 +0000 (02:51 +0000)]
[ptr-traits] Stop using two bogus types as stand-ins for flags
indicating the nature of the default argument in a ParmVarDecl.

Instead, this adds a proper enum stored exclusively in the ParmVarDecl
bits (which we have plenty of) for this. This even allows us to track
a previously unrepresented state in Clang when we parse a function
declaration with a default argument on a parameter but we cannot even
form an invalid expression node (for example, it is an invalid token).
Now, we can model this state in the AST at least, and potentially
improve recovery in this area in the future.

I've also cleaned up the functions managing both variable initializer
expressions and parameter default argument expresssions as much as
possible. I've left some comments about further improvements based on
a discussion with Richard Smith. Lots of credit to him for walking me
through exactly which of the *many* tradeoffs here he felt was the best
fit.

Should be NFC for now. I've tried my best to preserve existing behavior.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

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

8 years ago[TrailingObjects] Convert CastExpr and subclasses.
James Y Knight [Wed, 30 Dec 2015 02:27:28 +0000 (02:27 +0000)]
[TrailingObjects] Convert CastExpr and subclasses.

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

8 years agoClean up this code, NFC.
Richard Smith [Wed, 30 Dec 2015 01:06:52 +0000 (01:06 +0000)]
Clean up this code, NFC.

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

8 years ago[analyzer] Handle another Android assert function.
Devin Coughlin [Wed, 30 Dec 2015 00:08:59 +0000 (00:08 +0000)]
[analyzer] Handle another Android assert function.

Android's assert can call both the __assert and __assert2 functions under the cover, but
the NoReturnFunctionChecker does not handle the latter. This commit fixes that.

A patch by Yury Gribov!

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

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

8 years ago[analyzer] Suppress nullability warning for _Nonnull locals zero-initialized by ObjC...
Devin Coughlin [Tue, 29 Dec 2015 23:44:19 +0000 (23:44 +0000)]
[analyzer] Suppress nullability warning for _Nonnull locals zero-initialized by ObjC ARC.

Prevent the analyzer from warning when a _Nonnnull local variable is implicitly
zero-initialized because of Objective-C automated reference counting. This avoids false
positives in cases where a _Nonnull local variable cannot be initialized with an
initialization expression, such as:
  NSString * _Nonnull s; // no-warning
  @autoreleasepool {
    s = ...;
  }

The nullability checker will still warn when a _Nonnull local variable is explicitly
initialized with nil.

This suppression introduces the potential for false negatives if the local variable
is used before it is assigned a _Nonnull value. Based on a discussion with Anna Zaks,
Jordan Rose, and John McCall, I've added a FIXME to treat implicitly zero-initialized
_Nonnull locals as uninitialized in Sema's UninitializedValues analysis to avoid these
false negatives.

rdar://problem/23522311

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

8 years agoWhen a namespace alias redeclares a using declaration, point the diagnostic at
Richard Smith [Tue, 29 Dec 2015 23:42:34 +0000 (23:42 +0000)]
When a namespace alias redeclares a using declaration, point the diagnostic at
the using declaration not at the thing it's using.

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

8 years agoModel NamespaceAliasDecls as having their nominated namespace as an underlying
Richard Smith [Tue, 29 Dec 2015 23:34:32 +0000 (23:34 +0000)]
Model NamespaceAliasDecls as having their nominated namespace as an underlying
declaration. This fixes an issue where we would reject (due to a claimed
ambiguity) a case where lookup finds multiple NamespaceAliasDecls from
different scopes that nominate the same namespace.

The C++ standard doesn't make it clear that such a case is in fact valid (which
I'm working on fixing), but there are no relevant rules that distinguish using
declarations and namespace alias declarations here, so it makes sense to treat
them the same way.

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

8 years agoAddress review comment on r256595
Nico Weber [Tue, 29 Dec 2015 23:30:42 +0000 (23:30 +0000)]
Address review comment on r256595

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

8 years agoFix test from r256596
Nico Weber [Tue, 29 Dec 2015 23:23:38 +0000 (23:23 +0000)]
Fix test from r256596

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

8 years agoEmit a -Wmicrosoft warning when treating ^Z as EOF in MS mode.
Nico Weber [Tue, 29 Dec 2015 23:17:27 +0000 (23:17 +0000)]
Emit a -Wmicrosoft warning when treating ^Z as EOF in MS mode.

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

8 years agoEmit a -Wmicrosoft warning when pasting /##/ into a comment token in MS mode.
Nico Weber [Tue, 29 Dec 2015 23:06:17 +0000 (23:06 +0000)]
Emit a -Wmicrosoft warning when pasting /##/ into a comment token in MS mode.

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

8 years ago[TrailingObjects] Convert OffsetOfExpr.
James Y Knight [Tue, 29 Dec 2015 22:31:18 +0000 (22:31 +0000)]
[TrailingObjects] Convert OffsetOfExpr.

That necessitated moving the OffsetOfNode class out of OffsetOfExpr.

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

8 years ago[MS ABI] Invent a mangling for reference temporaries
David Majnemer [Tue, 29 Dec 2015 22:25:14 +0000 (22:25 +0000)]
[MS ABI] Invent a mangling for reference temporaries

MSVC is non-conforming and doesn't have a mangling for these.  Invent
our own to unblock folks using clang.

This fixes PR25795.

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

8 years agoUse consistent types for all bit-field members in the same bit-field so that MSVC...
Richard Smith [Tue, 29 Dec 2015 22:19:20 +0000 (22:19 +0000)]
Use consistent types for all bit-field members in the same bit-field so that MSVC's bit-field packing algorithm packs them properly.

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

8 years ago[TrailingObjects] Convert Decl* classes.
James Y Knight [Tue, 29 Dec 2015 22:13:13 +0000 (22:13 +0000)]
[TrailingObjects] Convert Decl* classes.

Also remove now-redundant explicit alignment specification on some of
the classes converted prior to TrailingObjects automatically ensuring
proper alignment.

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

8 years ago[MS ABI] Add a mangling for _Complex
David Majnemer [Tue, 29 Dec 2015 22:02:15 +0000 (22:02 +0000)]
[MS ABI] Add a mangling for _Complex

MSVC doesn't implement a mangling for C99's _Complex so we must invent
our own.

For now, treating it like a class type called _Complex in the __clang
namespace.

This means that 'void f(__Complex int))'
will demangle as: 'void f(struct __clang::_Complex<int>)'

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

8 years ago[MS ABI] Mark an unreachable path appropriately
David Majnemer [Tue, 29 Dec 2015 22:02:10 +0000 (22:02 +0000)]
[MS ABI] Mark an unreachable path appropriately

No functional change is intended, just a small cleanup.

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

8 years agofix typos; NFC
Sanjay Patel [Tue, 29 Dec 2015 20:09:37 +0000 (20:09 +0000)]
fix typos; NFC

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

8 years agoTeach typo correction to properly handle mapping declarations to their
Richard Smith [Tue, 29 Dec 2015 19:43:10 +0000 (19:43 +0000)]
Teach typo correction to properly handle mapping declarations to their
underlying decls. Preserve the found declaration throughout, and only map to
the underlying declaration when we want to check whether it's the right kind.
This allows us to provide the right source location for the found declaration,
and prepares for the possibility of underlying decls with a different name
from the found decl.

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

8 years ago[TrailingObjects] Convert AST classes that had a ASTTemplateKWAndArgsInfo.
James Y Knight [Tue, 29 Dec 2015 18:15:14 +0000 (18:15 +0000)]
[TrailingObjects] Convert AST classes that had a ASTTemplateKWAndArgsInfo.

So, also:

- Moved the TemplateArgumentLoc array out of the
  ASTTemplateKWAndArgsInfo class (making it a simple fixed-size object),
  to avoid needing to have a variable-length object as part of a
  variable-length object. Now the objects that have a
  ASTTemplateKWAndArgsInfo also have some TemplateArgumentLoc objects
  appended directly.

- Removed some internal-use accessors which became simply a wrapper on
  getTrailingObjects.

- Moved MemberNameQualifier out of the MemberExpr class, renamed it
  MemberExprNameQualifier, because the template can't
  refer to a class nested within the class it's defining.

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

8 years ago[analyzer] Nullability: allow cast to _Nonnull to suppress warning about returning...
Devin Coughlin [Tue, 29 Dec 2015 17:40:49 +0000 (17:40 +0000)]
[analyzer] Nullability: allow cast to _Nonnull to suppress warning about returning nil.

The nullability checker currently allows casts to suppress warnings when a nil
literal is passed as an argument to a parameter annotated as _Nonnull:

  foo((NSString * _Nonnull)nil); // no-warning

It does so by suppressing the diagnostic when the *type* of the argument expression
is _Nonnull -- even when the symbolic value returned is known to be nil.

This commit updates the nullability checker to similarly honor such casts in the analogous
scenario when nil is returned from a function with a _Nonnull return type:

  return (NSString * _Nonnull)nil; // no-warning

This commit also normalizes variable naming between the parameter and return cases and
adds several tests demonstrating the limitations of this suppression mechanism (such as
when nil is cast to _Nonnull and then stored into a local variable without a nullability
qualifier). These tests are marked with FIXMEs.

rdar://problem/23176782

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