Commit Graph

135 Commits

Author SHA1 Message Date
Oliver Stannard c3152179b5 Add backend dignostic printer for unsupported features
Re-commit of r258950 after fixing layering violation.

The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259499 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02 13:52:52 +00:00
Oliver Stannard ebd2c75411 Revert r259036, it introduces a cyclic library dependency
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259043 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 13:09:49 +00:00
Oliver Stannard f1c941a94e Add backend dignostic printer for unsupported features
Re-commit of r258950 after fixing layering violation.

Add backend dignostic printer for unsupported features

The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259036 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 10:07:34 +00:00
NAKAMURA Takumi 257517ab0b Revert r258951 (and r258950), "Refactor backend diagnostics for unsupported features"
It broke layering violation in LLVMIR.

clang r258950 "Add backend dignostic printer for unsupported features"
llvm  r258951 "Refactor backend diagnostics for unsupported features"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259016 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 04:41:32 +00:00
Oliver Stannard 9909f323ce Add backend dignostic printer for unsupported features
The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258950 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 17:30:28 +00:00
David Majnemer 202433cccd [MS ABI] Allow a member pointers' converted type to change
Member pointers in the MS ABI are tricky for a variety of reasons.
The size of a member pointer is indeterminate until the program reaches
a point where the representation is required to be known.  However,
*pointers* to member pointers may exist without knowing the pointee
type's representation.  In these cases, we synthesize an opaque LLVM
type for the pointee type.

However, we can be in a situation where the underlying member pointer's
representation became known mid-way through the program.  To account for
this, we attempted to manicure CodeGen's type-cache so that we can
replace the opaque member pointer type with the real deal while leaving
the pointer types unperturbed.  This, unfortunately, is a problematic
approach to take as we will violate CodeGen's invariants.

These violations are mostly harmless but let's do the right thing
instead: invalidate the type-cache if a member pointer's LLVM
representation changes.

This fixes PR26313.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258839 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 19:30:26 +00:00
Peter Collingbourne f2ac4da6f7 Introduce -fsanitize-stats flag.
This is part of a new statistics gathering feature for the sanitizers.
See clang/docs/SanitizerStats.rst for further info and docs.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257971 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-16 00:31:22 +00:00
Teresa Johnson 32429cb676 [ThinLTO] Leverage new in-place renaming support
Due to the new in-place renaming support added in r257174, we no
longer need to invoke ThinLTO global renaming from clang. It will be
invoked on the module in the FunctionImport pass (by an immediately
following llvm commit).

As a result, we don't need to load the FunctionInfoIndex as early,
so that is moved down into EmitAssemblyHelper::EmitAssembly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257179 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-08 17:04:29 +00:00
Rafael Espindola 9c50f8737b Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255843 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16 23:16:37 +00:00
Rafael Espindola 500daa7a7c Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255572 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14 23:17:07 +00:00
Teresa Johnson f735405854 [ThinLTO] Option to invoke ThinLTO backend passes and importing
Summary:
Adds new option -fthinlto-index=<file> to invoke the LTO pipeline
along with function importing via clang using the supplied function
summary index file. This supports invoking the parallel ThinLTO
backend processes in a distributed build environment via clang.

Additionally, this causes the module linker to be invoked on the bitcode
file being compiled to perform any necessary promotion and renaming of
locals that are exported via the function summary index file.

Add a couple tests that confirm we get expected errors when we try to
use the new option on a file that isn't bitcode, or specify an invalid
index file. The tests also confirm that we trigger the expected function
import pass.

Depends on D15024

Reviewers: joker.eph, dexonsmith

Subscribers: joker.eph, davidxl, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254927 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-07 19:21:34 +00:00
Rafael Espindola 2c1df8830d Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254450 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 19:51:03 +00:00
Artem Belevich d40c9d5c5a Allow linking multiple bitcode files.
Linking options for particular file depend on the option that specifies the file.
Currently there are two:

* -mlink-bitcode-file links in complete content of the specified file.
* -mlink-cuda-bitcode links in only the symbols needed by current TU.
   Linked symbols are internalized. This bitcode linking mode is used to
   link device-specific bitcode provided by CUDA.

Files are linked in order they are specified on command line.

-mlink-cuda-bitcode replaces -fcuda-uses-libdevice flag.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251427 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 17:56:59 +00:00
Artem Belevich 4298cae656 [CUDA] Postprocess bitcode linked in during device-side CUDA compilation.
Link in and internalize the symbols we need from supplied bitcode library.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247317 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:24:23 +00:00
Richard Smith 7537674b90 Initialize the AST consumer as soon as we have both an ASTConsumer and an
ASTContext. Fixes some cases where we could previously initialize the AST
consumer more than once.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245346 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 20:39:29 +00:00
Tyler Nowicki ff2037212d Print vectorization analysis when loop hint is specified.
This patche and a related llvm patch solve the problem of having to explicitly enable analysis when specifying a loop hint pragma to get the diagnostics. Passing AlwasyPrint as the pass name (see below) causes the front-end to print the diagnostic if the user has specified '-Rpass-analysis' without an '=<target-pass>’. Users of loop hints can pass that compiler option without having to specify the pass and they will get diagnostics for only those loops with loop hints.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244556 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 01:10:08 +00:00
Tyler Nowicki cb3bf9371c Append options for vectorization when pointer checking threshold is exceeded.
Following one of the appended options will allow the loop to be vectorized. We do not include a command line option for modifying the pointer checking threshold because there is no clang-level interface for this currently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244526 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 23:05:16 +00:00
Tyler Nowicki 8ed7e23a3a Append options for floating-point commutivity when related diagnostics are produced.
With this patch clang appends the command line options that would allow vectorization when floating-point commutativity is required. Specifically those are enabling fast-math or specifying a loop hint. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 19:56:40 +00:00
Eric Christopher b88f708037 Rename DescriptionString -> DataLayoutString as it matches the actual
use of the string.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244178 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 23:48:05 +00:00
Yaron Keren bc96e5803a Rangify for loops, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243841 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-01 19:11:36 +00:00
Adrian Prantl c849102cd2 Pass HeaderSearchOptions and PreprocessorOptions into CodeGenModule.
In order to produce debug info for clang modules CGDebugInfo it needs
access to macros passed on the command line and the isysroot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241035 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-30 02:26:03 +00:00
Alexander Kornienko 8ca7705aa3 Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 23:07:51 +00:00
Alexander Kornienko ac58acc7f2 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

  $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
      -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
      work/llvm/tools/clang

To reduce churn, not touching namespaces spanning less than 10 lines.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 09:47:44 +00:00
Rafael Espindola dbc8c32dde Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239859 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 22:32:44 +00:00
Justin Bogner 6faf95b061 CodeGen: Avoid a reserved name and fix the naming style of some arguments. NFC
It's undefined to use reserved names like _Diags. Fix up the other
parameter names to consistently use a modern style while I'm here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238058 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 22:16:55 +00:00
Artem Belevich 4eac4cf5a9 Fixed double-free in case of module loading error.
GetOutputStream() owns the stream it returns pointer to and the
pointer should never be freed by us. When we fail to load and exit
early, unique_ptr still holds the pointer and frees it which leads to
compiler crash when CompilerInstance attempts to free it again.

Added regression test for failed bitcode linking.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237159 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 17:44:15 +00:00
Diego Novillo 09e9f31e46 Fix BackendConsumer::EmitOptimizationMessage()
Patch from Geoff Berry <gberry@codeaurora.org>

Fix BackendConsumer::EmitOptimizationMessage() to check if the
DiagnosticInfoOptimizationBase object has a valid location before
calling getLocation() to avoid dereferencing a null pointer inside
getLocation() when no debug info is present.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236898 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-08 20:59:56 +00:00
Sean Callanan 11167bf275 Implemented support for testing the ASTImporter's
ability to generate code that CodeGen likes.  Test
cases can use this functionality by calling

// RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236011 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 18:24:12 +00:00
Rafael Espindola 23ddbddd09 Use raw_pwrite_stream in clang.
This is a small improvement to -emit-pth and allows llvm to start requiring it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234897 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 15:15:49 +00:00
Steven Wu 476ded5185 Add InlineAsmDiagnosticHandler for bitcode input
Summary:
This patch installs an InlineAsmDiagnosticsHandler to avoid the crash
report when the input is bitcode and the bitcode contains invalid inline
assembly. The handler will simply print the same error message that will
print from the backend.

Add CHECK in test-case

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rafael, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228898 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-12 02:06:55 +00:00
Nico Weber 3a1dc05037 Make a codegen warning a real warning instead of a getCustomDiagID().
Warnings shouldn't use getCustomDiagID(), since then they can't be disabled
via a flag, can't be remapped, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227420 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 06:25:59 +00:00
Nico Weber 0222ff3c1c Remove unused parameter, followup to r179639. No behavior change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226128 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 06:00:15 +00:00
Nico Weber 9b0d355372 Remove ASTConsumer::HandleVTable()'s bool parameter.
Sema calls HandleVTable() with a bool parameter which is then threaded through
three layers.  The only effect of this bool is an early return at the last
layer.

Instead, remove this parameter and call HandleVTable() only if the bool is
true.  No intended behavior change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226096 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 04:07:35 +00:00
Chandler Carruth 6c1b926674 [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.py
Sorry for the noise, I managed to miss a bunch of recent regressions of
include orderings here. This should actually sort all the includes for
Clang. Again, no functionality changed, this is just a mechanical
cleanup that I try to run periodically to keep the #include lines as
regular as possible across the project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225979 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 11:29:14 +00:00
Yaron Keren 391ac2a055 Initialize BackendConsumer::Context in constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224836 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-25 12:21:56 +00:00
Rafael Espindola b775f9b9a5 Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220742 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-28 00:29:51 +00:00
Rafael Espindola e58d9a54e4 Use the newer/simple API for passing a diagnostic handler to the IR linker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220733 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 23:02:34 +00:00
Benjamin Kramer 0273eb0d7a Make VFS and FileManager match the current MemoryBuffer API.
This eliminates converting back and forth between the 3 formats and
gives us a more homogeneous interface.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220657 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-26 22:44:13 +00:00
Rafael Espindola 26951a4cd3 Update for LLVM api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220609 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-25 04:06:14 +00:00
Craig Topper c6da4d1d6c Unique_ptrify PPCallbacks ownership.
Unique_ptr creation stil needs to be moved earlier at some of the call sites.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217474 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10 04:53:53 +00:00
Rafael Espindola c5de8c6270 Update for LLVM api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217050 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 17:31:52 +00:00
David Blaikie f6983668b4 unique_ptrify SourceManager::createFileID
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216715 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 07:59:55 +00:00
David Blaikie 6b75de1ed2 unique_ptrify clang::BackendConsumer::takeModule
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216707 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 05:08:19 +00:00
Rafael Espindola d92e74d96e Update for LLVM api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216585 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 20:03:29 +00:00
Rafael Espindola 1b4975f967 Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216493 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 22:00:14 +00:00
Rafael Espindola cfa7a9e88c Update for llvm api change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216489 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 21:49:29 +00:00
Rafael Espindola 490fd36bd1 Return a std::unique_ptr from getBufferForFile. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216476 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 19:54:40 +00:00
Rafael Espindola 3755e2728c Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216467 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 17:29:49 +00:00
Rafael Espindola 9a90ce5fae Move the body out of line to try to fix a buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215980 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 14:36:35 +00:00
Rafael Espindola 82abc1025d Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215968 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 04:04:30 +00:00