]> granicus.if.org Git - clang/log
clang
8 years agoDR259: Demote the pedantic error for an explicit instantiation after an
Richard Smith [Wed, 31 Aug 2016 23:23:25 +0000 (23:23 +0000)]
DR259: Demote the pedantic error for an explicit instantiation after an
explicit specialization to a warning for C++98 mode (this is a defect report
resolution, so per our informal policy it should apply in C++98), and turn
the warning on by default for C++11 and later. In all cases where it fires, the
right thing to do is to remove the pointless explicit instantiation.

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

8 years agoAdd -fprofile-dir= to clang.
Nick Lewycky [Wed, 31 Aug 2016 23:04:32 +0000 (23:04 +0000)]
Add -fprofile-dir= to clang.

-fprofile-dir=path allows the user to specify where .gcda files should be
emitted when the program is run. In particular, this is the first flag that
causes the .gcno and .o files to have different paths, LLVM is extended to
support this. -fprofile-dir= does not change the file name in the .gcno (and
thus where lcov looks for the source) but it does change the name in the .gcda
(and thus where the runtime library writes the .gcda file). It's different from
a GCOV_PREFIX because a user can observe that the GCOV_PREFIX_STRIP will strip
paths off of -fprofile-dir= but not off of a supplied GCOV_PREFIX.

To implement this we split -coverage-file into -coverage-data-file and
-coverage-notes-file to specify the two different names. The !llvm.gcov
metadata node grows from a 2-element form {string coverage-file, node dbg.cu}
to 3-elements, {string coverage-notes-file, string coverage-data-file, node
dbg.cu}. In the 3-element form, the file name is already "mangled" with
.gcno/.gcda suffixes, while the 2-element form left that to the middle end
pass.

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

8 years agoDebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining
David Blaikie [Wed, 31 Aug 2016 20:54:35 +0000 (20:54 +0000)]
DebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining

I tested the cases involving split-dwarf + gmlt +
no-split-dwarf-inlining, but didn't verify the simpler case without
gmlt.

The logic is, admittedly, a little hairy, but seems about as simple as I
could wrangle it.

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

8 years agoDon't diagnoes a mismatch between implicit and explicit exception
Richard Smith [Wed, 31 Aug 2016 20:38:32 +0000 (20:38 +0000)]
Don't diagnoes a mismatch between implicit and explicit exception
specifications under -fno-exceptions, just as we don't diagnose other exception
specification mismatch errors.

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

8 years agoFix mishandling of deletedness for assignment operators of classes with
Richard Smith [Wed, 31 Aug 2016 20:37:39 +0000 (20:37 +0000)]
Fix mishandling of deletedness for assignment operators of classes with
indirect virtual bases. We don't need to be able to invoke such an assignment
operator from the derived class, and we shouldn't delete the derived assignment
op if we can't do so.

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

8 years ago[codeview] Don't emit vshape info for classes without vfptrs
Reid Kleckner [Wed, 31 Aug 2016 20:35:01 +0000 (20:35 +0000)]
[codeview] Don't emit vshape info for classes without vfptrs

Classes with no virtual methods or whose virtual methods were all
inherited from virtual bases don't have a vfptr at offset zero. We were
crashing attempting to get the layout of that non-existent vftable.

We don't need any vshape info in this case because the debugger can
infer it from the base class information. The current class may not
introduce any virtual methods if we are in this situation.

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

8 years agoRevert "Driver: use the canonical static library naming"
Saleem Abdulrasool [Wed, 31 Aug 2016 19:27:07 +0000 (19:27 +0000)]
Revert "Driver: use the canonical static library naming"

This breaks chromium and its unclear if this is actually a modern convention.

This reverts SVN r280169.

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

8 years agoFix a typo in a comment.
George Burgess IV [Wed, 31 Aug 2016 18:14:15 +0000 (18:14 +0000)]
Fix a typo in a comment.

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

8 years agos/static inline/static/ for headers I have changed in r279475. NFC.
Tim Shen [Wed, 31 Aug 2016 16:48:13 +0000 (16:48 +0000)]
s/static inline/static/ for headers I have changed in r279475. NFC.

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

8 years ago[codeview] Pass through vftable shape information
Reid Kleckner [Wed, 31 Aug 2016 16:11:43 +0000 (16:11 +0000)]
[codeview] Pass through vftable shape information

The shape is really just the number of methods in the vftable, since we
don't support 16 bit far calls. All calls are near. Encode this number
in the size of the artificial __vtbl_ptr_type DIDerivedType that we
generate. For DWARF, this will be a normal pointer, but for codeview
this will be a wide pointer that gets pattern matched into a
VFTableShape record. Insert this type into the element list of all
dynamic classes when emitting CodeView, so that the backend can emit the
shape even if the vptr lives in a primary base class.

Fixes PR28150

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

8 years agoclang-format: Set default WebKit style to use C++11.
Daniel Jasper [Wed, 31 Aug 2016 14:05:56 +0000 (14:05 +0000)]
clang-format: Set default WebKit style to use C++11.

The WebKit style page says to use nullptr, so this should be fine:
https://webkit.org/code-style-guidelines/

This fixes: llvm.org/PR30220

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

8 years ago[clang-format-vim] Support vim linked against py3
Luke Drummond [Wed, 31 Aug 2016 13:36:36 +0000 (13:36 +0000)]
[clang-format-vim] Support vim linked against py3

clang-format.py previously only worked in vim compiled against python2.

This patch adds the necessary syntax changes to make this work with vim
linked against python3, which is now shipped by default for at least Ubuntu16 and Arch.

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

Subscribers: cfe-commits

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

8 years agoRevision r280064 adds new options -fdenormal-fp-math and passes through option
Sjoerd Meijer [Wed, 31 Aug 2016 12:31:03 +0000 (12:31 +0000)]
Revision r280064 adds new options -fdenormal-fp-math and passes through option
-ffast-math to CC1, but it included a wrong llvm regression tests which was
removed in r280065.  Although regression test noexceptionsfpmath.c makes sure
-fno-trapping-math ends up as a function attribute, this adds a test that
explicitly checks the driver output for -fno-trapping-math.

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

8 years agoAttempt to pacify buildbots after r280217
James Molloy [Wed, 31 Aug 2016 11:01:41 +0000 (11:01 +0000)]
Attempt to pacify buildbots after r280217

These clang tests check diagnostics from the backend by giving it an unvectorizable loop. This loop is now vectorized :/

Make it really unvectorizable by making it unprofitable to ifconvert.

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

8 years ago[Coverage] Suppress creating a code region if the same area is covered by an expansio...
Igor Kudrin [Wed, 31 Aug 2016 07:04:16 +0000 (07:04 +0000)]
[Coverage] Suppress creating a code region if the same area is covered by an expansion region.

In most cases these code regions are just redundant, but sometimes they
could be assigned to the counter of the parent code region instead of
the counter of the nested block.

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

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

8 years ago[AVX-512] Implement masked floating point logical operations with native IR and remov...
Craig Topper [Wed, 31 Aug 2016 05:38:58 +0000 (05:38 +0000)]
[AVX-512] Implement masked floating point logical operations with native IR and remove the builtins.

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

8 years ago[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.
Craig Topper [Wed, 31 Aug 2016 05:38:55 +0000 (05:38 +0000)]
[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.

These will be reused when removing some builtins from avx512vldqintrin.h and this will make the tests for that change show a better number of vector elements.

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

8 years agoPR12298 et al: don't recursively instantiate a template specialization from
Richard Smith [Wed, 31 Aug 2016 02:15:21 +0000 (02:15 +0000)]
PR12298 et al: don't recursively instantiate a template specialization from
within the instantiation of that same specialization. This could previously
happen for eagerly-instantiated function templates, variable templates,
exception specifications, default arguments, and a handful of other cases.

We still have an issue here for default template arguments that recursively
make use of themselves and likewise for substitution into the type of a
non-type template parameter, but in those cases we're producing a different
entity each time, so they should instead be caught by the instantiation depth
limit. However, currently we will typically run out of stack before we reach
it. :(

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

8 years agoConcatenate two FileCheck lines in a test.
Richard Trieu [Wed, 31 Aug 2016 01:57:12 +0000 (01:57 +0000)]
Concatenate two FileCheck lines in a test.

'cc1' is a valid sequence of hexadecimal and sometimes can occur in the path
when testing.  This can lead to FileCheck matching the incorrect occurance
of the 'cc1' string and causing a test failure.  Join two adjacent flags
together into one check to prevent this.

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

8 years agoclangTooling: Update libdeps: LLVMOptions, since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:32 +0000 (00:46 +0000)]
clangTooling: Update libdeps: LLVMOptions, since r280118.

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

8 years agoclangTooling depends on ClangDriverOptions since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:25 +0000 (00:46 +0000)]
clangTooling depends on ClangDriverOptions since r280118.

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

8 years agoDon't try to run a test that generates code for x86 if it's not a registered target.
Richard Smith [Tue, 30 Aug 2016 23:53:34 +0000 (23:53 +0000)]
Don't try to run a test that generates code for x86 if it's not a registered target.

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

8 years ago[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker
Devin Coughlin [Tue, 30 Aug 2016 23:07:14 +0000 (23:07 +0000)]
[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker

Fix a crash when relexing the underlying memory buffer to find incorrect
arguments to NSLocalizedString(). With precompiled headers, the raw
buffer may be NULL. Instead, use the source manager to get the buffer,
which will lazily create the buffer for precompiled headers.

rdar://problem/27429091

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

8 years agoDriver: use the canonical static library naming
Saleem Abdulrasool [Tue, 30 Aug 2016 22:10:27 +0000 (22:10 +0000)]
Driver: use the canonical static library naming

On Windows, static libraries are named lib<name>.lib while import libraries are
named <name>.lib.  Use the appropriate naming on itanium and msvc environments.
This is setup properly so that if a dynamic builtins is used on Windows, it
would do the right thing, although this is not currently wired through the
driver (i.e. there is no equivalent to -{shared,static}-gcc).

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

8 years agoclang-format: Correctly calculate affected ranges when sorting #includes.
Daniel Jasper [Tue, 30 Aug 2016 21:33:41 +0000 (21:33 +0000)]
clang-format: Correctly calculate affected ranges when sorting #includes.

affectedRanges takes a start and an end offset, not offset and length.

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

8 years ago[Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.
Bruno Cardoso Lopes [Tue, 30 Aug 2016 21:25:42 +0000 (21:25 +0000)]
[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

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

8 years agoFix memory leak by storing returned pointer in std::unique_ptr
Richard Trieu [Tue, 30 Aug 2016 21:12:48 +0000 (21:12 +0000)]
Fix memory leak by storing returned pointer in std::unique_ptr

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

8 years ago[test] Pass a fake libLTO.dylib to a driver test which depends on it
Vedant Kumar [Tue, 30 Aug 2016 20:36:50 +0000 (20:36 +0000)]
[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.

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

8 years agoRevert "[test] Add libLTO as a clang test dependency on Darwin"
Vedant Kumar [Tue, 30 Aug 2016 20:36:48 +0000 (20:36 +0000)]
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...

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

8 years ago[test] Add libLTO as a clang test dependency on Darwin
Vedant Kumar [Tue, 30 Aug 2016 19:57:40 +0000 (19:57 +0000)]
[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

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

8 years agoPR29166: when merging declarations with typedef names for linkage purposes,
Richard Smith [Tue, 30 Aug 2016 19:13:18 +0000 (19:13 +0000)]
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.

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

8 years agoUnrevert r280035 now that the clang-cl bug it exposed has been fixed by
Richard Smith [Tue, 30 Aug 2016 19:06:26 +0000 (19:06 +0000)]
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.

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

8 years agoPR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.
Richard Smith [Tue, 30 Aug 2016 18:55:16 +0000 (18:55 +0000)]
PR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.

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

8 years agotypo + indentation [NFC]
Etienne Bergeron [Tue, 30 Aug 2016 18:38:25 +0000 (18:38 +0000)]
typo + indentation [NFC]

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

8 years agoBasic/Targets.cpp: Add polaris10 and polaris11 gpus
Niels Ole Salscheider [Tue, 30 Aug 2016 18:00:22 +0000 (18:00 +0000)]
Basic/Targets.cpp: Add polaris10 and polaris11 gpus

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

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

8 years agoFix colored diagnostics from tools
Olivier Goffart [Tue, 30 Aug 2016 17:42:29 +0000 (17:42 +0000)]
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

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

8 years agoDisable clang/test/SemaTemplate/instantiation-depth-default.cpp temporarily for targe...
NAKAMURA Takumi [Tue, 30 Aug 2016 15:38:18 +0000 (15:38 +0000)]
Disable clang/test/SemaTemplate/instantiation-depth-default.cpp temporarily for targeting mingw32. It crashes. Investigating.

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

8 years ago[OpenCL] Make is_valid_event, create_user_event overloadable.
Alexey Bader [Tue, 30 Aug 2016 14:42:54 +0000 (14:42 +0000)]
[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

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

8 years agoFix typo in comment
Nico Weber [Tue, 30 Aug 2016 14:24:28 +0000 (14:24 +0000)]
Fix typo in comment

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

8 years ago[Hexagon] Use handleTargetFeaturesGroup to process target-specific features
Krzysztof Parzyszek [Tue, 30 Aug 2016 14:17:10 +0000 (14:17 +0000)]
[Hexagon] Use handleTargetFeaturesGroup to process target-specific features

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

8 years agoRevert r280035 (and followups r280057, r280085), it caused PR30195
Nico Weber [Tue, 30 Aug 2016 14:12:06 +0000 (14:12 +0000)]
Revert r280035 (and followups r280057, r280085), it caused PR30195

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

8 years agoHandle -mlong-calls on Hexagon
Krzysztof Parzyszek [Tue, 30 Aug 2016 13:57:50 +0000 (13:57 +0000)]
Handle -mlong-calls on Hexagon

Differential Revision:://reviews.llvm.org/D22766

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

8 years agoclang/test/Driver/modules-ts.cpp: Satisfy quoted filename.
NAKAMURA Takumi [Tue, 30 Aug 2016 13:07:53 +0000 (13:07 +0000)]
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"

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

8 years agoFix for commit 280064 that break the build.
Sjoerd Meijer [Tue, 30 Aug 2016 08:56:00 +0000 (08:56 +0000)]
Fix for commit 280064 that break the build.

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

8 years agoThis adds new options -fdenormal-fp-math and passes through option -ffast-math
Sjoerd Meijer [Tue, 30 Aug 2016 08:09:45 +0000 (08:09 +0000)]
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

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

8 years agoCombine two FileCheck patterns to prevent overzealous matching of .*
Richard Smith [Tue, 30 Aug 2016 05:14:38 +0000 (05:14 +0000)]
Combine two FileCheck patterns to prevent overzealous matching of .*

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

8 years ago[PowerPC] Update the DWARF register-size table
Hal Finkel [Tue, 30 Aug 2016 02:38:34 +0000 (02:38 +0000)]
[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.

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

8 years ago[sanitizer-coverage] add two more modes of instrumentation: trace-div and trace-gep...
Kostya Serebryany [Tue, 30 Aug 2016 01:27:03 +0000 (01:27 +0000)]
[sanitizer-coverage] add two more modes of instrumentation: trace-div and trace-gep, mostly usaful for value-profile-based fuzzing; clang part

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

8 years ago[PowerPC] Add support for -mlongcall
Hal Finkel [Tue, 30 Aug 2016 01:07:03 +0000 (01:07 +0000)]
[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.

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

8 years agoC++ Modules TS: driver support for building modules.
Richard Smith [Tue, 30 Aug 2016 00:44:54 +0000 (00:44 +0000)]
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.

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

8 years ago[cfi] Export __cfi_check when linking with -fsanitize-cfi-cross-dso.
Evgeniy Stepanov [Mon, 29 Aug 2016 23:42:34 +0000 (23:42 +0000)]
[cfi] Export __cfi_check when linking with -fsanitize-cfi-cross-dso.

Multi-DSO CFI model requires every DSO to export a __cfi_check function.

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

8 years agoFix typo in test.
Evgeniy Stepanov [Mon, 29 Aug 2016 23:15:46 +0000 (23:15 +0000)]
Fix typo in test.

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

8 years agoFix a bug preventing the cause for a module file-not-found from being displayed
Adrian Prantl [Mon, 29 Aug 2016 20:46:59 +0000 (20:46 +0000)]
Fix a bug preventing the cause for a module file-not-found from being displayed

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

8 years agoFix a bug preventing the cause of a module-out-of-date error from being printed
Adrian Prantl [Mon, 29 Aug 2016 20:46:56 +0000 (20:46 +0000)]
Fix a bug preventing the cause of a module-out-of-date error from being printed

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

8 years agoTry to fix clang-offload-bunder.c test once more
Reid Kleckner [Mon, 29 Aug 2016 16:24:57 +0000 (16:24 +0000)]
Try to fix clang-offload-bunder.c test once more

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

8 years ago[Coverage] Prevent creating a redundant counter if a nested body ends with a macro.
Igor Kudrin [Mon, 29 Aug 2016 11:48:50 +0000 (11:48 +0000)]
[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

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

8 years agoAST: improve layout of SimpleTypoCorrector
Saleem Abdulrasool [Sun, 28 Aug 2016 21:33:30 +0000 (21:33 +0000)]
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!

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

8 years agoFix a typo in the doc: overriden -> overridden
Sylvestre Ledru [Sun, 28 Aug 2016 20:22:34 +0000 (20:22 +0000)]
Fix a typo in the doc: overriden -> overridden

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

8 years agoclang-cl: Support MSVC2015's /validate-charset flag.
Nico Weber [Fri, 26 Aug 2016 21:51:14 +0000 (21:51 +0000)]
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

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

8 years agoclang-cl: Accept MSVC2015's '/utf-8' flag.
Nico Weber [Fri, 26 Aug 2016 21:26:29 +0000 (21:26 +0000)]
clang-cl: Accept MSVC2015's '/utf-8' flag.

Clang always behaves as if that's passed, so just ignore the flag.

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

8 years agoclang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.
Nico Weber [Fri, 26 Aug 2016 21:11:43 +0000 (21:11 +0000)]
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

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

8 years agoDon't diagnose non-modular includes when we are not compiling a module.
Manman Ren [Fri, 26 Aug 2016 17:16:46 +0000 (17:16 +0000)]
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

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

8 years agoAdd support for -fdiagnostics-absolute-paths: printing absolute paths in diagnostics
Hans Wennborg [Fri, 26 Aug 2016 15:45:36 +0000 (15:45 +0000)]
Add support for -fdiagnostics-absolute-paths: printing absolute paths in diagnostics

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

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

8 years agoSort list of driver-known file extensions. It was previously approximately
Richard Smith [Fri, 26 Aug 2016 00:41:59 +0000 (00:41 +0000)]
Sort list of driver-known file extensions. It was previously approximately
ordered by length then alphabetically; apply that order consistently.

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

8 years agoC++ Modules TS: add frontend support for building pcm files from module
Richard Smith [Fri, 26 Aug 2016 00:14:38 +0000 (00:14 +0000)]
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.

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

8 years agoWiden type of __offset_flags in RTTI on Mingw64
Reid Kleckner [Thu, 25 Aug 2016 22:16:30 +0000 (22:16 +0000)]
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

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

8 years ago[MS] Win64 va_arg should expect large arguments to be passed indirectly
Reid Kleckner [Thu, 25 Aug 2016 20:42:26 +0000 (20:42 +0000)]
[MS] Win64 va_arg should expect large arguments to be passed indirectly

Fixes PR20569

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

8 years agoFix clang-offload-bundler.c test on Windows
Reid Kleckner [Thu, 25 Aug 2016 20:40:23 +0000 (20:40 +0000)]
Fix clang-offload-bundler.c test on Windows

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

8 years agoRefactor to remove the assumption that we know the name of the module we're emitting...
Richard Smith [Thu, 25 Aug 2016 18:26:30 +0000 (18:26 +0000)]
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).

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

8 years agoOmit column info for CodeView by default
Adrian McCarthy [Thu, 25 Aug 2016 18:24:35 +0000 (18:24 +0000)]
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

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

8 years ago[MS] Pass non-trivially-copyable objects indirectly on Windows ARM
Reid Kleckner [Thu, 25 Aug 2016 18:23:28 +0000 (18:23 +0000)]
[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.

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

8 years ago[Sema][Comments] Add support for TypeAliasTemplate
Bruno Cardoso Lopes [Thu, 25 Aug 2016 17:09:33 +0000 (17:09 +0000)]
[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

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

8 years agoFix offload bundler test to support Windows new lines.
Samuel Antao [Thu, 25 Aug 2016 14:35:20 +0000 (14:35 +0000)]
Fix offload bundler test to support Windows new lines.

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

8 years agoclang-format: [JS] nested and tagged template strings.
Martin Probst [Thu, 25 Aug 2016 10:13:21 +0000 (10:13 +0000)]
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

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

8 years agoFix memory leaks in clang-offload-bundler
Vitaly Buka [Thu, 25 Aug 2016 07:21:34 +0000 (07:21 +0000)]
Fix memory leaks in clang-offload-bundler

Summary:
1. Pair removed from StringMap was not destroyed
2. ObjectFile had no owner

Reviewers: sfantao

Subscribers: llvm-commits

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

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

8 years agoRemove a pointless LLVM_CONSTEXPR. NFC.
George Burgess IV [Thu, 25 Aug 2016 01:54:37 +0000 (01:54 +0000)]
Remove a pointless LLVM_CONSTEXPR. NFC.

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

8 years agoLazily load the ContextDecl for a lambda's DefinitionData, to fix a
Richard Smith [Thu, 25 Aug 2016 00:34:00 +0000 (00:34 +0000)]
Lazily load the ContextDecl for a lambda's DefinitionData, to fix a
deserialization cycle caused by the ContextDecl recursively importing members
of the lambda's closure type.

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

8 years ago[Sema][Comments] Factor out function type loc logic. NFCI
Bruno Cardoso Lopes [Thu, 25 Aug 2016 00:22:08 +0000 (00:22 +0000)]
[Sema][Comments] Factor out function type loc logic. NFCI

This is in prepatation for @param TypeAliasTemplate support.

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

8 years agoDebugInfo: Let -gsplit-dwarf and -gmlt compose if -fno-split-dwarf-inlining is used
David Blaikie [Wed, 24 Aug 2016 23:22:36 +0000 (23:22 +0000)]
DebugInfo: Let -gsplit-dwarf and -gmlt compose if -fno-split-dwarf-inlining is used

If the inline info is not duplicated into the skeleton CU, then there's
value in using -gsplit-dwarf and -gmlt together (to keep all those extra
subprograms out of the skeleton CU, while also producing smaller .dwo
files)

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

8 years ago[Order Files] On Darwin use DTrace's oneshot probe
Chris Bieneman [Wed, 24 Aug 2016 22:09:46 +0000 (22:09 +0000)]
[Order Files] On Darwin use DTrace's oneshot probe

The oneshot probe only gets executed the first time the probe is hit in the process. For order file generation this is really all we care about.

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

8 years agoDisable test under asan: it uses a lot of stack, and asan increases the
Richard Smith [Wed, 24 Aug 2016 21:30:00 +0000 (21:30 +0000)]
Disable test under asan: it uses a lot of stack, and asan increases the
per-frame stack usage enough to cause it to hit our stack limit. This is not
ideal; we should find a better way of dealing with this, such as increasing
our stack allocation when built with ASan.

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

8 years agoPR29097: add an update record when we instantiate the default member
Richard Smith [Wed, 24 Aug 2016 21:25:37 +0000 (21:25 +0000)]
PR29097: add an update record when we instantiate the default member
initializer of an imported field.

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

8 years ago[Sema][Comments] Support @param with c++ 'using' keyword
Bruno Cardoso Lopes [Wed, 24 Aug 2016 21:11:43 +0000 (21:11 +0000)]
[Sema][Comments] Support @param with c++ 'using' keyword

Give appropriate warnings with -Wdocumentation for @param comments
that refer to function aliases defined with 'using'. Very similar
to typedef's behavior. This does not add support for
TypeAliasTemplateDecl yet.

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

rdar://problem/27300695

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

8 years agoFix offload bundler tests so that diagnostic can start with caps.
Samuel Antao [Wed, 24 Aug 2016 18:52:18 +0000 (18:52 +0000)]
Fix offload bundler tests so that diagnostic can start with caps.

Windows require that.

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

8 years agoDebugInfo: Add flag to CU to disable emission of inline debug info into the skeleton CU
David Blaikie [Wed, 24 Aug 2016 18:29:58 +0000 (18:29 +0000)]
DebugInfo: Add flag to CU to disable emission of inline debug info into the skeleton CU

In cases where .dwo/.dwp files are guaranteed to be available, skipping
the extra online (in the .o file) inline info can save a substantial
amount of space - see the original r221306 for more details there.

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

8 years agoclang-offload-bundler: Update libdeps.
NAKAMURA Takumi [Wed, 24 Aug 2016 17:05:48 +0000 (17:05 +0000)]
clang-offload-bundler: Update libdeps.

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

8 years agofix typo "varaible"
Nico Weber [Wed, 24 Aug 2016 16:37:21 +0000 (16:37 +0000)]
fix typo "varaible"

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

8 years agoAdd target REQUIRES directives to offload bundler test.
Samuel Antao [Wed, 24 Aug 2016 15:47:06 +0000 (15:47 +0000)]
Add target REQUIRES directives to offload bundler test.

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

8 years ago[Driver][OpenMP][CUDA] Add capability to bundle object files in sections of the host...
Samuel Antao [Wed, 24 Aug 2016 15:39:07 +0000 (15:39 +0000)]
[Driver][OpenMP][CUDA] Add capability to bundle object files in sections of the host binary format.

Summary:
This patch adds the capability to bundle object files in sections of the host binary using a designated naming convention for these sections. This patch uses the functionality of the object reader already in the LLVM library to read bundled files, and invokes clang with the incremental linking options to create bundle files.

Bundling files involves creating an IR file with the contents of the bundle assigned as initializers of globals binded to the designated sections. This way the bundling implementation is agnostic of the host object format.

The features added by this patch were requested in the RFC discussion in  http://lists.llvm.org/pipermail/cfe-dev/2016-February/047547.html.

Reviewers: echristo, tra, jlebar, hfinkel, ABataev, Hahnfeld

Subscribers: mkuron, whchung, cfe-commits, andreybokhanko, Hahnfeld, arpith-jacob, carlo.bertolli, mehdi_amini, caomhin

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

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

8 years agoclang-offload-bundler - offload files bundling/unbundling tool
Samuel Antao [Wed, 24 Aug 2016 15:21:05 +0000 (15:21 +0000)]
clang-offload-bundler - offload files bundling/unbundling tool

Summary:
One of the goals of programming models that support offloading (e.g. OpenMP) is to enable users to offload with little effort, by annotating the code with a few pragmas. I'd also like to save users the trouble of changing their existent applications' build system. So having the compiler always return a single file instead of one for the host and each target even if the user is doing separate compilation is desirable.

This diff proposes a tool named clang-offload-bundler (happy to change the name if required) that is used to bundle files associated with the same user source file but different targets, or to unbundle a file into separate files associated with different targets.

This tool supports the driver support for OpenMP under review in http://reviews.llvm.org/D9888. The tool is used there to enable separate compilation, so that the very first action on input files that are not source files is a "unbundling action" and the very last non-linking action is a "bundling action".

The format of the bundled files is currently very simple: text formats are concatenated with comments that have a magic string and target identifying triple in between, and binary formats have a header that contains the triple and the offset and size of the code for host and each target.

The goal is to improve this tool in the future to deal with archive files so that each individual file in the archive is properly dealt with. We see that archives are very commonly used in current applications to combine separate compilation results. So I'm convinced users would enjoy this feature.

This tool can be used like this:

`clang-offload-bundler -targets=triple1,triple2 -type=ii -inputs=a.triple1.ii,a.triple2.ii -outputs=a.ii`

or

`clang-offload-bundler -targets=triple1,triple2 -type=ii -outputs=a.triple1.ii,a.triple2.ii -inputs=a.ii -unbundle`

I implemented the tool under clang/tools. Please let me know if something like this should live somewhere else.

This patch is prerequisite for http://reviews.llvm.org/D9888.

Reviewers: hfinkel, rsmith, echristo, chandlerc, tra, jlebar, ABataev, Hahnfeld

Subscribers: whchung, caomhin, andreybokhanko, arpith-jacob, carlo.bertolli, mehdi_amini, guansong, Hahnfeld, cfe-commits

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

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

8 years ago[AST] Make InitListExpr::isExplicit const (NFC)
Vedant Kumar [Wed, 24 Aug 2016 06:44:57 +0000 (06:44 +0000)]
[AST] Make InitListExpr::isExplicit const (NFC)

Patch by Alexander Shaposhnikov!

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

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

8 years ago[Pragma] Clear loop distribution attribute between loops
Adam Nemet [Wed, 24 Aug 2016 04:31:56 +0000 (04:31 +0000)]
[Pragma] Clear loop distribution attribute between loops

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

8 years agoRemove excessive padding from PTHStatData (NFC)
Mehdi Amini [Wed, 24 Aug 2016 04:26:57 +0000 (04:26 +0000)]
Remove excessive padding from PTHStatData (NFC)

This diff reorders the fields and removes excessive padding.
This fixes the following warning:

PTHLexer.cpp:629:7: warning: Excessive padding in 'class (anonymous namespace)::PTHStatData' (14 padding bytes, where 6 is optimal). Optimal fields order: Size, ModTime, UniqueID, HasData, IsDirectory, consider reordering the fields or adding explicit padding members.

Patch by: Alexander Shaposhnikov <shal1t712@gmail.com>

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

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

8 years agoAdding an additional test to ensure the frame pointer is emitted
Douglas Yung [Wed, 24 Aug 2016 02:02:32 +0000 (02:02 +0000)]
Adding an additional test to ensure the frame pointer is emitted
when compiling with optimization when PS4 is the target.

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

8 years agoFix member call on null pointer, found by sanitizer buildbot.
Richard Smith [Tue, 23 Aug 2016 21:12:54 +0000 (21:12 +0000)]
Fix member call on null pointer, found by sanitizer buildbot.

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

8 years agodriver: Support checking for rlimits via cmake (when bootstrapping)
Chris Bieneman [Tue, 23 Aug 2016 20:07:07 +0000 (20:07 +0000)]
driver: Support checking for rlimits via cmake (when bootstrapping)

Summary:
Add a cmake check for sys/resource.h and replace the __has_include() check with its result, in order to make it possible to use rlimits when building with compilers not supporting __has_include() -- i.e. when bootstrapping.

// Please also re-apply dfcd52eb1d8e5d322404b40414cb7331c7380a8c (llvm-config.h fix)

Patch by: Michał Górny

Reviewers: rsmith, beanz

Subscribers: cfe-commits

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

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

8 years agoRemove two dos line endings.
Nico Weber [Tue, 23 Aug 2016 19:59:55 +0000 (19:59 +0000)]
Remove two dos line endings.

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

8 years agoFix regression introduced by r279164: only pass definitions as the PatternDef
Richard Smith [Tue, 23 Aug 2016 19:41:39 +0000 (19:41 +0000)]
Fix regression introduced by r279164: only pass definitions as the PatternDef
to DiagnoseUninstantiableTemplate, teach hasVisibleDefinition to correctly
determine whether a function definition is visible, and mark both the function
and the template as visible when merging function template definitions to
provide hasVisibleDefinition with the relevant information.

The change to always pass the right declaration as the PatternDef to
DiagnoseUninstantiableTemplate also caused those checks to happen before other
diagnostics in InstantiateFunctionDefinition, giving worse diagnostics for the
same situations, so I sunk the relevant diagnostics into
DiagnoseUninstantiableTemplate. Those parts of this patch are based on changes
in reviews.llvm.org/D23492 by Vassil Vassilev.

This reinstates r279486, reverted in r279500, with a fix to
DiagnoseUninstantiableTemplate to only mark uninstantiable explicit
instantiation declarations as invalid if we actually diagnosed them. (When we
trigger an explicit instantiation of a class member from an explicit
instantiation declaration for the class, it's OK if there is no corresponding
definition and we certainly don't want to mark the member invalid in that
case.) This previously caused a build failure during bootstrap.

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

8 years agoclang-cl: Make /Brepro actually work.
Nico Weber [Tue, 23 Aug 2016 19:32:02 +0000 (19:32 +0000)]
clang-cl: Make /Brepro actually work.

/Brepro means we want reproducible builds, i.e. we _don't_ want the timestamp
that's needed to be compatible with the incremental linker.

https://reviews.llvm.org/D23805

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

8 years agoARM-Darwin: ignore and diagnose attempts to omit frame pointer.
Tim Northover [Tue, 23 Aug 2016 18:12:58 +0000 (18:12 +0000)]
ARM-Darwin: ignore and diagnose attempts to omit frame pointer.

iOS (and other 32-bit ARM variants) always require a valid frame pointer to
improve backtraces. Previously the -fomit-frame-pointer and
-momit-leaf-frame-pointer options were being silently discarded via hacks in
the backend. It's better if Clang configures itself to emit the correct IR and
warns about (ignored) attempts to override this.

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