aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenAction.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-02-18Avoid double deletion in Clang driver.Serge Pavlov1-21/+8
Llvm module object is shared between CodeGenerator and BackendConsumer, in both classes it is stored as std::unique_ptr, which is not a good design solution and can cause double deletion error. Usually it does not occur because in BackendConsumer::HandleTranslationUnit the ownership of CodeGenerator over the module is taken away. If however this method is not called, the module is deleted twice and compiler crashes. As the module owned by BackendConsumer is always the same as CodeGenerator has, pointer to llvm module can be removed from BackendGenerator. Differential Revision: http://reviews.llvm.org/D15450 llvm-svn: 261222
2016-02-02Add backend dignostic printer for unsupported featuresOliver Stannard1-11/+64
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. llvm-svn: 259499
2016-01-28Revert r259036, it introduces a cyclic library dependencyOliver Stannard1-65/+11
llvm-svn: 259043
2016-01-28Add backend dignostic printer for unsupported featuresOliver Stannard1-11/+65
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 llvm-svn: 259036
2016-01-28Revert r258951 (and r258950), "Refactor backend diagnostics for unsupported ↵NAKAMURA Takumi1-64/+11
features" It broke layering violation in LLVMIR. clang r258950 "Add backend dignostic printer for unsupported features" llvm r258951 "Refactor backend diagnostics for unsupported features" llvm-svn: 259016
2016-01-27Add backend dignostic printer for unsupported featuresOliver Stannard1-11/+64
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 llvm-svn: 258950
2016-01-26[MS ABI] Allow a member pointers' converted type to changeDavid Majnemer1-0/+4
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. llvm-svn: 258839
2016-01-16Introduce -fsanitize-stats flag.Peter Collingbourne1-2/+2
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 llvm-svn: 257971
2016-01-08[ThinLTO] Leverage new in-place renaming supportTeresa Johnson1-35/+1
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. llvm-svn: 257179
2015-12-16Update for llvm api change.Rafael Espindola1-2/+2
llvm-svn: 255843
2015-12-14Update for llvm api change.Rafael Espindola1-33/+27
llvm-svn: 255572
2015-12-07[ThinLTO] Option to invoke ThinLTO backend passes and importingTeresa Johnson1-21/+55
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 llvm-svn: 254927
2015-12-01Update for llvm api change.Rafael Espindola1-1/+1
llvm-svn: 254450
2015-10-27Allow linking multiple bitcode files.Artem Belevich1-53/+61
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 llvm-svn: 251427
2015-09-10[CUDA] Postprocess bitcode linked in during device-side CUDA compilation.Artem Belevich1-1/+6
Link in and internalize the symbols we need from supplied bitcode library. Differential Revision: http://reviews.llvm.org/D11664 llvm-svn: 247317
2015-08-18Initialize the AST consumer as soon as we have both an ASTConsumer and anRichard Smith1-5/+2
ASTContext. Fixes some cases where we could previously initialize the AST consumer more than once. llvm-svn: 245346
2015-08-11Print vectorization analysis when loop hint is specified.Tyler Nowicki1-15/+21
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. llvm-svn: 244556
2015-08-10Append options for vectorization when pointer checking threshold is exceeded.Tyler Nowicki1-0/+19
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. llvm-svn: 244526
2015-08-10Append options for floating-point commutivity when related diagnostics are ↵Tyler Nowicki1-0/+19
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. llvm-svn: 244492
2015-08-05Rename DescriptionString -> DataLayoutString as it matches the actualEric Christopher1-2/+2
use of the string. llvm-svn: 244178
2015-08-01Rangify for loops, NFC.Yaron Keren1-2/+1
llvm-svn: 243841
2015-06-30Pass HeaderSearchOptions and PreprocessorOptions into CodeGenModule.Adrian Prantl1-2/+6
In order to produce debug info for clang modules CGDebugInfo it needs access to macros passed on the command line and the isysroot. llvm-svn: 241035
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-1/+1
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-1/+1
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. llvm-svn: 240270
2015-06-16Update for llvm api change.Rafael Espindola1-2/+2
llvm-svn: 239859
2015-05-22CodeGen: Avoid a reserved name and fix the naming style of some arguments. NFCJustin Bogner1-8/+8
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. llvm-svn: 238058
2015-05-12Fixed double-free in case of module loading error.Artem Belevich1-2/+2
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 llvm-svn: 237159
2015-05-08Fix BackendConsumer::EmitOptimizationMessage()Diego Novillo1-7/+10
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. llvm-svn: 236898
2015-04-28Implemented support for testing the ASTImporter'sSean Callanan1-0/+5
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 llvm-svn: 236011
2015-04-14Use raw_pwrite_stream in clang.Rafael Espindola1-7/+6
This is a small improvement to -emit-pth and allows llvm to start requiring it. llvm-svn: 234897
2015-02-12Add InlineAsmDiagnosticHandler for bitcode inputSteven Wu1-0/+8
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 llvm-svn: 228898
2015-01-29Make a codegen warning a real warning instead of a getCustomDiagID().Nico Weber1-5/+3
Warnings shouldn't use getCustomDiagID(), since then they can't be disabled via a flag, can't be remapped, etc. llvm-svn: 227420
2015-01-15Remove unused parameter, followup to r179639. No behavior change.Nico Weber1-2/+1
llvm-svn: 226128
2015-01-15Remove ASTConsumer::HandleVTable()'s bool parameter.Nico Weber1-2/+2
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. llvm-svn: 226096
2015-01-14[cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth1-3/+3
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. llvm-svn: 225979
2014-12-25Initialize BackendConsumer::Context in constructor.Yaron Keren1-1/+1
llvm-svn: 224836
2014-10-28Update for LLVM API change.Rafael Espindola1-1/+1
llvm-svn: 220742
2014-10-27Use the newer/simple API for passing a diagnostic handler to the IR linker.Rafael Espindola1-16/+5
llvm-svn: 220733
2014-10-26Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer1-6/+3
This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
2014-10-25Update for LLVM api change.Rafael Espindola1-6/+31
llvm-svn: 220609
2014-09-10Unique_ptrify PPCallbacks ownership.Craig Topper1-1/+2
Unique_ptr creation stil needs to be moved earlier at some of the call sites. llvm-svn: 217474
2014-09-03Update for LLVM api change.Rafael Espindola1-1/+1
llvm-svn: 217050
2014-08-29unique_ptrify SourceManager::createFileIDDavid Blaikie1-1/+1
llvm-svn: 216715
2014-08-29unique_ptrify clang::BackendConsumer::takeModuleDavid Blaikie1-2/+2
llvm-svn: 216707
2014-08-27Update for LLVM api change.Rafael Espindola1-4/+4
llvm-svn: 216585
2014-08-26Update for llvm api change.Rafael Espindola1-2/+1
llvm-svn: 216493
2014-08-26Update for llvm api changeRafael Espindola1-1/+1
llvm-svn: 216489
2014-08-26Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola1-2/+3
llvm-svn: 216476
2014-08-26Update for llvm api change.Rafael Espindola1-1/+1
llvm-svn: 216467
2014-08-19Move the body out of line to try to fix a buildbot.Rafael Espindola1-0/+4
llvm-svn: 215980