Commit Graph

65170 Commits

Author SHA1 Message Date
Daniel Jasper d6a0078039 clang-format: Correctly calculate affected ranges when sorting #includes.
affectedRanges takes a start and an end offset, not offset and length.

llvm-svn: 280165
2016-08-30 21:33:41 +00:00
Bruno Cardoso Lopes 6736e199c7 [Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.
This adds support for modules that require (no-)gnu-inline-asm
environment, such as the compiler builtin cpuid submodule.

This is the gnu-inline-asm variant of https://reviews.llvm.org/D23871

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

rdar://problem/26931199

llvm-svn: 280159
2016-08-30 21:25:42 +00:00
Richard Trieu 070937a1d4 Fix memory leak by storing returned pointer in std::unique_ptr
llvm-svn: 280157
2016-08-30 21:12:48 +00:00
Vedant Kumar b7df1e2148 [test] Pass a fake libLTO.dylib to a driver test which depends on it
This makes it possible to run 'check-clang' on Darwin without building
libLTO.dylib. See r280142 for more context.

llvm-svn: 280150
2016-08-30 20:36:50 +00:00
Vedant Kumar c56f8ceda8 Revert "[test] Add libLTO as a clang test dependency on Darwin"
This reverts commit r280142. Mehdi suggested a better way to fix up the
test: just create a fake libLTO.dylib and tell the driver where to find
it. Patch incoming...

llvm-svn: 280149
2016-08-30 20:36:48 +00:00
Vedant Kumar 139756308a [test] Add libLTO as a clang test dependency on Darwin
Running 'check-clang' on a stock checkout of llvm+clang doesn't work on
Darwin, because test/Driver/darwin-ld-lto.c can't find libLTO.dylib. Add
libLTO as a clang test dependency on Darwin to fix the problem.

Note: We don't have this issue with check-all because libLTO is in the
test-depends target.

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

llvm-svn: 280142
2016-08-30 19:57:40 +00:00
Richard Smith 3fb1a8554d PR29166: when merging declarations with typedef names for linkage purposes,
don't assume that the anonymous struct will be part of the most recent
declaration of the typedef.

llvm-svn: 280136
2016-08-30 19:13:18 +00:00
Richard Smith dd4ad3d2ad Unrevert r280035 now that the clang-cl bug it exposed has been fixed by
r280133. Original commit message:

C++ Modules TS: driver support for building modules.

This works as follows: we add --precompile to the existing gamut of options for
specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag
specifies that an input is taken to the precompilation step and no further, and
this can be specified when building a .pcm from a module interface or when
building a .pch from a header file.

The .cppm extension (and some related extensions) are implicitly recognized as
C++ module interface files. If --precompile is /not/ specified, the file is
compiled (via a .pcm) to a .o file containing the code for the module (and then
potentially also assembled and linked, if -S, -c, etc. are not specified). We
do not yet suppress the emission of object code for other users of the module
interface, so for now this will only work if everything in the .cppm file has
vague linkage.

As with the existing support for module-map modules, prebuilt modules can be
provided as compiler inputs either via the -fmodule-file= command-line argument
or via files named ModuleName.pcm in one of the directories specified via
-fprebuilt-module-path=.

This also exposes the -fmodules-ts cc1 flag in the driver. This is still
experimental, and in particular, the concrete syntax is subject to change as
the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does
not enable support for implicitly loading module maps nor building modules via
the module cache, but those features can be turned on separately and used in
conjunction with the Modules TS support.

llvm-svn: 280134
2016-08-30 19:06:26 +00:00
Richard Smith 8cd452d471 PR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.
llvm-svn: 280133
2016-08-30 18:55:16 +00:00
Etienne Bergeron 982a3bcc48 typo + indentation [NFC]
llvm-svn: 280127
2016-08-30 18:38:25 +00:00
Niels Ole Salscheider c37d69f1ee Basic/Targets.cpp: Add polaris10 and polaris11 gpus
Differential Revision: https://reviews.llvm.org/D23746

llvm-svn: 280120
2016-08-30 18:00:22 +00:00
Olivier Goffart b37a5e3a71 Fix colored diagnostics from tools
r271042 changed the way the diagnostic arguments are parsed. It assumes that
the diagnostics options were already parsed by the "Driver".
For tools using clang::Tooling, the diagnostics argument were not parsed.

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

llvm-svn: 280118
2016-08-30 17:42:29 +00:00
NAKAMURA Takumi c37dc82d0b Disable clang/test/SemaTemplate/instantiation-depth-default.cpp temporarily for targeting mingw32. It crashes. Investigating.
llvm-svn: 280104
2016-08-30 15:38:18 +00:00
Alexey Bader b5d90e57dc [OpenCL] Make is_valid_event, create_user_event overloadable.
Summary: Make is_valid_event and create_user_event overloadable like other built-ins.

Patch by Evgeniy Tyurin.

Reviewers: bader, yaxunl

Subscribers: Anastasia, cfe-commits

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

llvm-svn: 280097
2016-08-30 14:42:54 +00:00
Nico Weber 39dc744f19 Fix typo in comment
llvm-svn: 280094
2016-08-30 14:24:28 +00:00
Krzysztof Parzyszek 7cd30bd7e6 [Hexagon] Use handleTargetFeaturesGroup to process target-specific features
llvm-svn: 280093
2016-08-30 14:17:10 +00:00
Nico Weber e36ab4a0a4 Revert r280035 (and followups r280057, r280085), it caused PR30195
llvm-svn: 280091
2016-08-30 14:12:06 +00:00
Krzysztof Parzyszek 1f26912e4c Handle -mlong-calls on Hexagon
Differential Revision:://reviews.llvm.org/D22766 

llvm-svn: 280089
2016-08-30 13:57:50 +00:00
NAKAMURA Takumi e992269199 clang/test/Driver/modules-ts.cpp: Satisfy quoted filename.
On win32, backslashed filename is emitted like;

  -o "C:\\bb-win\\ninja-clang-i686-msc19-R\\build\\tools\\clang\\test\\Driver\\Output\\modules-ts.cpp.tmp.o"

llvm-svn: 280085
2016-08-30 13:07:53 +00:00
Sjoerd Meijer e9e988e163 Fix for commit 280064 that break the build.
llvm-svn: 280065
2016-08-30 08:56:00 +00:00
Sjoerd Meijer 0a8d4216ad This adds new options -fdenormal-fp-math and passes through option -ffast-math
to CC1, which are translated to function attributes and can e.g. be mapped on
build attributes FP_exceptions and FP_denormal. Setting these build attributes
allows better selection of floating point libraries.

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

llvm-svn: 280064
2016-08-30 08:09:45 +00:00
Richard Smith 4bcf6b6de2 Combine two FileCheck patterns to prevent overzealous matching of .*
llvm-svn: 280057
2016-08-30 05:14:38 +00:00
Hal Finkel 84832a7a79 [PowerPC] Update the DWARF register-size table
The PPC64 DWARF register-size table did not match the ABI specification (or
GCC, for that matter). Fix that, and add a regression test.

Fixes PR27931.

llvm-svn: 280053
2016-08-30 02:38:34 +00:00
Kostya Serebryany 3b41971763 [sanitizer-coverage] add two more modes of instrumentation: trace-div and trace-gep, mostly usaful for value-profile-based fuzzing; clang part
llvm-svn: 280044
2016-08-30 01:27:03 +00:00
Hal Finkel 5fe93df78c [PowerPC] Add support for -mlongcall
Add support for GCC's PowerPC -mlongcall option; the backend supports the
corresponding target feature as of r280040.

Fixes PR19098.

llvm-svn: 280041
2016-08-30 01:07:03 +00:00
Richard Smith 88c52e0f0a C++ Modules TS: driver support for building modules.
This works as follows: we add --precompile to the existing gamut of options for
specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag
specifies that an input is taken to the precompilation step and no further, and
this can be specified when building a .pcm from a module interface or when
building a .pch from a header file.

The .cppm extension (and some related extensions) are implicitly recognized as
C++ module interface files. If --precompile is /not/ specified, the file is
compiled (via a .pcm) to a .o file containing the code for the module (and then
potentially also assembled and linked, if -S, -c, etc. are not specified). We
do not yet suppress the emission of object code for other users of the module
interface, so for now this will only work if everything in the .cppm file has
vague linkage.

As with the existing support for module-map modules, prebuilt modules can be
provided as compiler inputs either via the -fmodule-file= command-line argument
or via files named ModuleName.pcm in one of the directories specified via
-fprebuilt-module-path=.

This also exposes the -fmodules-ts cc1 flag in the driver. This is still
experimental, and in particular, the concrete syntax is subject to change as
the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does
not enable support for implicitly loading module maps nor building modules via
the module cache, but those features can be turned on separately and used in
conjunction with the Modules TS support.

llvm-svn: 280035
2016-08-30 00:44:54 +00:00
Evgeniy Stepanov 8dbbf56aa1 [cfi] Export __cfi_check when linking with -fsanitize-cfi-cross-dso.
Multi-DSO CFI model requires every DSO to export a __cfi_check function.

llvm-svn: 280031
2016-08-29 23:42:34 +00:00
Evgeniy Stepanov 9848c3656c Fix typo in test.
llvm-svn: 280028
2016-08-29 23:15:46 +00:00
Adrian Prantl b3b5a7362c Fix a bug preventing the cause for a module file-not-found from being displayed
llvm-svn: 280010
2016-08-29 20:46:59 +00:00
Adrian Prantl 9a06a882bc Fix a bug preventing the cause of a module-out-of-date error from being printed
llvm-svn: 280009
2016-08-29 20:46:56 +00:00
Reid Kleckner 609067491b Try to fix clang-offload-bunder.c test once more
llvm-svn: 279978
2016-08-29 16:24:57 +00:00
Igor Kudrin 8545dae226 [Coverage] Prevent creating a redundant counter if a nested body ends with a macro.
If there were several nested statements arranged in a way that all of them
end up with the same macro, then the expansion of this macro was assigned
with all the corresponding counters of these statements.
As a result, the wrong counter value was shown for the macro in llvm-cov.

This patch fixes the issue by preventing adding a counter for an expanded
source range if it already has an assigned counter, which is expected
to come from the most specific statement.

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

llvm-svn: 279962
2016-08-29 11:48:50 +00:00
Saleem Abdulrasool 61c0b0c32a AST: improve layout of SimpleTypoCorrector
Add the "explicit" specifier to the single-argument constructor of
SimpleTypoCorrector.  Reorder the fields to remove excessive padding (8 bytes).

Patch by Alexander Shaposhnikov!

llvm-svn: 279946
2016-08-28 21:33:30 +00:00
Sylvestre Ledru 61122c4fd0 Fix a typo in the doc: overriden -> overridden
llvm-svn: 279942
2016-08-28 20:22:34 +00:00
Nico Weber 9084adc290 clang-cl: Support MSVC2015's /validate-charset flag.
Clang always assumes that files are utf-8. If an invalidly encoded character is
used in an identifier, clang always errors. If it's used in a character
literal, clang warns Winvalid-source-encoding (on by default). Clang never
checks the encoding of things in comments (adding this seems like a nice
feature if it doesn't impact performance).

For cl.exe /utf-8 (which enables /validate-charset), if a bad character is used
in an identifier, it emits both an error and a warning. If it's used in a
literal or a comment, it emits a warning.

So mapping /validate-charset to -Winvalid-source-encoding seems like a fairly
decent fit.

https://reviews.llvm.org/D23945

llvm-svn: 279872
2016-08-26 21:51:14 +00:00
Nico Weber 66a1cbce30 clang-cl: Accept MSVC2015's '/utf-8' flag.
Clang always behaves as if that's passed, so just ignore the flag.

llvm-svn: 279869
2016-08-26 21:26:29 +00:00
Nico Weber ebe8d627c1 clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.
Also makes -fexec-charset accept utf-8 case-insensitively.
Like https://reviews.llvm.org/D23807, but for execution-charset.
Also replace a few .lower() comparisons with equals_lower().

https://reviews.llvm.org/D23938

llvm-svn: 279866
2016-08-26 21:11:43 +00:00
Manman Ren a67e4d3254 Don't diagnose non-modular includes when we are not compiling a module.
This is triggered when we are compiling an implementation of a module,
it has relative includes to a VFS-mapped module with umbrella headers.
Currently we will find the real path to headers under the umbrella directory,
but the umbrella directories are using virtual path.

rdar://27951255

Thanks Ben and Richard for reviewing the patch!
Differential Revision: http://reviews.llvm.org/D23858

llvm-svn: 279838
2016-08-26 17:16:46 +00:00
Hans Wennborg b30f4370a5 Add support for -fdiagnostics-absolute-paths: printing absolute paths in diagnostics
Differential Revision: https://reviews.llvm.org/D23816

llvm-svn: 279827
2016-08-26 15:45:36 +00:00
Richard Smith 03e8e60e36 Sort list of driver-known file extensions. It was previously approximately
ordered by length then alphabetically; apply that order consistently.

llvm-svn: 279799
2016-08-26 00:41:59 +00:00
Richard Smith bbcc9f0462 C++ Modules TS: add frontend support for building pcm files from module
interface files. At the moment, all declarations (and no macros) are exported,
and 'export' declarations are not supported yet.

llvm-svn: 279794
2016-08-26 00:14:38 +00:00
Reid Kleckner d8b0466e19 Widen type of __offset_flags in RTTI on Mingw64
Otherwise we can't handle secondary base classes at offsets greater than
2**24. This agrees with libstdc++abi.

We could extend this change to other LLP64 platforms, but then we would
want to update libc++abi and it would require additional review.

Fixes PR29116

llvm-svn: 279786
2016-08-25 22:16:30 +00:00
Reid Kleckner b04449d97a [MS] Win64 va_arg should expect large arguments to be passed indirectly
Fixes PR20569

llvm-svn: 279774
2016-08-25 20:42:26 +00:00
Reid Kleckner f2308b31a0 Fix clang-offload-bundler.c test on Windows
llvm-svn: 279772
2016-08-25 20:40:23 +00:00
Richard Smith bd97f35339 Refactor to remove the assumption that we know the name of the module we're emitting at the point when we create a PCHGenerator (with the C++ modules TS, we find that out part way through parsing the input).
llvm-svn: 279766
2016-08-25 18:26:30 +00:00
Adrian McCarthy 084148fcc3 Omit column info for CodeView by default
Clang tracks only start columns, not start-end ranges. CodeView allows for that, but the VS debugger doesn't handle anything less than a complete range well--it either highlights the wrong part of a statement or truncates source lines in the assembly view. It's better to have no column information at all.

So by default, we'll omit the column information for CodeView targeting Windows.

Since the column info is still useful for sanitizers, I've promoted -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple tests to make sure that works for clang-cl.

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

llvm-svn: 279765
2016-08-25 18:24:35 +00:00
Reid Kleckner 44051e63de [MS] Pass non-trivially-copyable objects indirectly on Windows ARM
This isn't exactly what MSVC does, unfortunately. MSVC does not pass
objects with destructors but no copy constructors by address. More ARM
expertise is required to really understand what should be done here.

Fixes PR29136.

llvm-svn: 279764
2016-08-25 18:23:28 +00:00
Bruno Cardoso Lopes 6080bdbec3 [Sema][Comments] Add support for TypeAliasTemplate
Emit proper diagnostics when -Wdocumentation is used with constructs such as:

  template<typename T>
  using fn = int(T aaa, int ccc);

Previously clang wouldn't recognize the function and complain with
'comment that is not attached to a function declaration'.

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

rdar://problem/27300695

llvm-svn: 279754
2016-08-25 17:09:33 +00:00
Samuel Antao fbf158ce26 Fix offload bundler test to support Windows new lines.
llvm-svn: 279741
2016-08-25 14:35:20 +00:00
Martin Probst 6181da4796 clang-format: [JS] nested and tagged template strings.
JavaScript template strings can be nested arbitrarily:

    foo = `text ${es.map(e => { return `<${e}>`; })} text`;

This change lexes nested template strings using a stack of lexer states to
correctly switch back to template string lexing on closing braces.

Also, reuse the same stack for the token-stashed logic.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 279727
2016-08-25 10:13:21 +00:00