Commit Graph

61684 Commits

Author SHA1 Message Date
Richard Smith 0f56118c57 Fix half of PR26048. We don't yet diagnose the case where the anonymous union member is declared first and the tag name is declared second.
llvm-svn: 256979
2016-01-06 21:54:29 +00:00
Krzysztof Parzyszek 4954354666 [Hexagon] Expand -mvN to -mcpu=hexagonvN
llvm-svn: 256978
2016-01-06 21:27:42 +00:00
Krzysztof Parzyszek 972f72c4b5 [Hexagon] Treat -march and -mcpu as equivalent
llvm-svn: 256977
2016-01-06 21:12:03 +00:00
Richard Trieu 43b4c821e1 Improve conditional checking during template instantiation.
When the condition in an if statement, while statement, or for loop is created
during template instantiation, it calls MakeFullExpr with only the condition
expression.  However, when these conditions are created for non-templated
code in the Parser, an additional SourceLocation is passed to MakeFullExpr.
The impact of this was that non-dependent templated code could produce
diagnostics that the same code outside templates would not.  Adding the missing
SourceLocation makes diagnostics consistent between templated and non-templated
code.

llvm-svn: 256976
2016-01-06 21:11:18 +00:00
Nico Weber 337b08d8d6 Add -Wfor-loop-analysis to -Wall.
This warning seems to have 0 false positives and some true positives in
practice, without a measurable compile time cost.  It should be in -Wall, and
possibly even become a default warning at some point.

llvm-svn: 256975
2016-01-06 20:55:00 +00:00
Dan Gohman 1aa5828b79 [WebAssembly] Add --gc-sections to the link line.
This will eventually be accompanied with a change to enable -ffunction-sections
and -fdata-sections by default, which is currently delayed by some development
process issues.

llvm-svn: 256967
2016-01-06 19:43:32 +00:00
Adrian Prantl b2a8b35349 Fix a typo.
llvm-svn: 256963
2016-01-06 19:22:23 +00:00
Adrian Prantl b3b821f1df 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.

llvm-svn: 256962
2016-01-06 19:22:19 +00:00
Nico Weber a2abe8c66b Fix -Wdocumentation warning after r256933
llvm-svn: 256960
2016-01-06 19:13:49 +00:00
Ahmed Bougacha 11a3dad706 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

llvm-svn: 256956
2016-01-06 18:43:14 +00:00
Erik Verbruggen 8f9d180f09 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

llvm-svn: 256939
2016-01-06 15:12:51 +00:00
Chad Rosier 7dbc9cf876 [Driver] Add support for -fno-builtin-foo options.
Addresses PR4941 and rdar://6756912.
http://reviews.llvm.org/D15195

llvm-svn: 256937
2016-01-06 14:35:46 +00:00
Krzysztof Parzyszek f4467cd1cd [Hexagon] Use back_inserter as target iterator in std::copy
llvm-svn: 256934
2016-01-06 14:13:11 +00:00
Samuel Antao ee8fb302f5 [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. 
 

llvm-svn: 256933
2016-01-06 13:42:12 +00:00
Sean Eveson b38c32be18 [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

llvm-svn: 256926
2016-01-06 10:03:58 +00:00
Dimitry Andric 0810739d4c 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

llvm-svn: 256920
2016-01-06 07:42:18 +00:00
Eric Christopher 29a50bccb9 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.

llvm-svn: 256919
2016-01-06 07:24:45 +00:00
Richard Smith 26dfbace82 [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.

llvm-svn: 256907
2016-01-06 03:52:10 +00:00
Douglas Katzman a2ef81fde5 Avoid assert failure on some invalid cc1 options.
Addressing review comment in D13221.

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

llvm-svn: 256897
2016-01-06 01:37:57 +00:00
Anna Zaks 03f483353c [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

llvm-svn: 256887
2016-01-06 00:32:56 +00:00
Anna Zaks ac4c8a639c [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.)

llvm-svn: 256886
2016-01-06 00:32:52 +00:00
Anna Zaks c9f16fe48c [analyzer] Don't report null dereferences on address_space annotated memory
llvm-svn: 256885
2016-01-06 00:32:49 +00:00
Adrian Prantl aac97c93ac Fix a typo in testcase and increase its coverage!
llvm-svn: 256874
2016-01-05 23:54:01 +00:00
Chris Bieneman b2920a779c [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

llvm-svn: 256873
2016-01-05 23:51:42 +00:00
Oleg Ranevskyy cd5163720f [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

llvm-svn: 256865
2016-01-05 19:54:39 +00:00
Samuel Antao 7d5de9a1ee [OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and device codegen.
It was causing two regression, so I'm reverting until the cause is found.

llvm-svn: 256858
2016-01-05 19:16:13 +00:00
Nathan Slingerland e8ddf9e9db [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

llvm-svn: 256855
2016-01-05 18:27:06 +00:00
Samuel Antao 1e06636b32 [OpenMP] Allow file ID to be signed in the offloading metadata.
This fixes a regression introduced by rL256842.

llvm-svn: 256854
2016-01-05 18:02:24 +00:00
Samuel Antao 4d5f0bbea1 [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

llvm-svn: 256842
2016-01-05 16:23:04 +00:00
Daniel Jasper 411af72e8c clang-format: Fix corner case in "if it saves columns"-calculation.
Before:
  aaaa
      .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
	  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

llvm-svn: 256841
2016-01-05 16:10:39 +00:00
Anastasia Stulova cf04d04ccf [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

llvm-svn: 256838
2016-01-05 14:39:27 +00:00
Daniel Jasper 0a589416e8 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.

llvm-svn: 256832
2016-01-05 13:06:27 +00:00
Daniel Jasper 801cdb27e4 clang-format: Avoid creating hanging indents in call sequences.
Before:
  aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaa(
                      aaaaaaaaaaaaaaaaaaaa)
        .aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

llvm-svn: 256831
2016-01-05 13:03:59 +00:00
Daniel Jasper 00492f96bf 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);

llvm-svn: 256830
2016-01-05 13:03:50 +00:00
MinSeong Kim 50d9c156dd [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

llvm-svn: 256829
2016-01-05 12:53:24 +00:00
Alexandros Lamprineas d162b5c8c4 [ARM] [AARCH64] Add CodeGen IR tests for {VS}QRDML{AS}H v8.1a intrinsics.
Differential Revision: http://reviews.llvm.org/D15223

llvm-svn: 256822
2016-01-05 09:58:29 +00:00
Richard Smith 40b14d4893 Avoid walking all the declarations in the TU when a tag is declared in function
prototype scope in a function definition.

llvm-svn: 256803
2016-01-05 01:21:53 +00:00
David Majnemer 758e79858e Remove an unused parameter
No functionality change is intended

llvm-svn: 256797
2016-01-05 00:08:41 +00:00
David Majnemer f8b569c786 [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.

llvm-svn: 256795
2016-01-04 23:51:15 +00:00
Easwaran Raman eed30e5a81 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

llvm-svn: 256793
2016-01-04 23:32:28 +00:00
Paul Robinson 9d6940ba09 Add some overlooked optnone tests, and tighten up an existing test.
Differential Revision: http://reviews.llvm.org/D15704

llvm-svn: 256762
2016-01-04 17:03:58 +00:00
Daniel Jasper 5e27146df7 clang-format: [JS] Support more ES6 default exports.
llvm-svn: 256759
2016-01-04 16:10:36 +00:00
Daniel Jasper b14f6675da clang-format: [JS] Support ES6 exports of array literals.
Before:
  export default[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
		 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb];
  export default[];

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

llvm-svn: 256758
2016-01-04 15:51:56 +00:00
Daniel Jasper ebcb71fb87 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
             [];

llvm-svn: 256753
2016-01-04 13:11:41 +00:00
Daniel Jasper 42011b2106 clang-format: Fix corner case in builder-type call formatting.
Before:
  return aaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa,
						  aaaaaaaaaaaaaaaaa)
      .aaaa(aaaaaaaaaaaaaa);

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

llvm-svn: 256750
2016-01-04 12:41:11 +00:00
Dimitry Andric a091a7db60 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.

llvm-svn: 256742
2016-01-04 10:17:48 +00:00
Daniel Jasper 55582073e4 clang-format: Align long braced init lists even if they are nested in
function calls.

llvm-svn: 256740
2016-01-04 07:30:44 +00:00
Daniel Jasper 9c8a774c48 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; };

llvm-svn: 256739
2016-01-04 07:29:40 +00:00
Daniel Jasper 06a269574c 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 {
  }

llvm-svn: 256738
2016-01-04 07:29:07 +00:00
Daniel Jasper ffbad0e8aa clang-format: [Proto] Basic support for options with <> for repeated fields.
llvm-svn: 256737
2016-01-04 07:28:12 +00:00