summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenAction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Pass HeaderSearchOptions and PreprocessorOptions into CodeGenModule.Adrian Prantl2015-06-301-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
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-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
* Update for llvm api change.Rafael Espindola2015-06-161-2/+2
| | | | llvm-svn: 239859
* CodeGen: Avoid a reserved name and fix the naming style of some arguments. NFCJustin Bogner2015-05-221-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
* Fixed double-free in case of module loading error.Artem Belevich2015-05-121-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
* Fix BackendConsumer::EmitOptimizationMessage()Diego Novillo2015-05-081-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
* Implemented support for testing the ASTImporter'sSean Callanan2015-04-281-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
* Use raw_pwrite_stream in clang.Rafael Espindola2015-04-141-7/+6
| | | | | | This is a small improvement to -emit-pth and allows llvm to start requiring it. llvm-svn: 234897
* Add InlineAsmDiagnosticHandler for bitcode inputSteven Wu2015-02-121-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
* Make a codegen warning a real warning instead of a getCustomDiagID().Nico Weber2015-01-291-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
* Remove unused parameter, followup to r179639. No behavior change.Nico Weber2015-01-151-2/+1
| | | | llvm-svn: 226128
* Remove ASTConsumer::HandleVTable()'s bool parameter.Nico Weber2015-01-151-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
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-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
* Initialize BackendConsumer::Context in constructor.Yaron Keren2014-12-251-1/+1
| | | | llvm-svn: 224836
* Update for LLVM API change.Rafael Espindola2014-10-281-1/+1
| | | | llvm-svn: 220742
* Use the newer/simple API for passing a diagnostic handler to the IR linker.Rafael Espindola2014-10-271-16/+5
| | | | llvm-svn: 220733
* Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer2014-10-261-6/+3
| | | | | | | This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
* Update for LLVM api change.Rafael Espindola2014-10-251-6/+31
| | | | llvm-svn: 220609
* Unique_ptrify PPCallbacks ownership.Craig Topper2014-09-101-1/+2
| | | | | | Unique_ptr creation stil needs to be moved earlier at some of the call sites. llvm-svn: 217474
* Update for LLVM api change.Rafael Espindola2014-09-031-1/+1
| | | | llvm-svn: 217050
* unique_ptrify SourceManager::createFileIDDavid Blaikie2014-08-291-1/+1
| | | | llvm-svn: 216715
* unique_ptrify clang::BackendConsumer::takeModuleDavid Blaikie2014-08-291-2/+2
| | | | llvm-svn: 216707
* Update for LLVM api change.Rafael Espindola2014-08-271-4/+4
| | | | llvm-svn: 216585
* Update for llvm api change.Rafael Espindola2014-08-261-2/+1
| | | | llvm-svn: 216493
* Update for llvm api changeRafael Espindola2014-08-261-1/+1
| | | | llvm-svn: 216489
* Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola2014-08-261-2/+3
| | | | llvm-svn: 216476
* Update for llvm api change.Rafael Espindola2014-08-261-1/+1
| | | | llvm-svn: 216467
* Move the body out of line to try to fix a buildbot.Rafael Espindola2014-08-191-0/+4
| | | | llvm-svn: 215980
* Update for llvm api change.Rafael Espindola2014-08-191-2/+0
| | | | llvm-svn: 215968
* Revert r215331, "unique_ptrify CompilerInstance::OutputFile(s) and remove a ↵NAKAMURA Takumi2014-08-111-2/+2
| | | | | | | | | | | | | | | | | | | | | unique_ptr around a non-owning raw_ostream in CodeGenAction::CreateASTConsumer" It cannot be compiled on Visual Studio 2012. clang\include\clang/Frontend/CompilerInstance.h(153): error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>' with [ _Ty=llvm::raw_ostream ] D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\memory(1447) : see declaration of 'std::unique_ptr<_Ty>::unique_ptr' with [ _Ty=llvm::raw_ostream ] This diagnostic occurred in the compiler generated function 'clang::CompilerInstance::OutputFile::OutputFile(const clang::CompilerInstance::OutputFile &)' llvm-svn: 215346
* unique_ptrify CompilerInstance::OutputFile(s) and remove a unique_ptr around ↵David Blaikie2014-08-101-2/+2
| | | | | | a non-owning raw_ostream in CodeGenAction::CreateASTConsumer llvm-svn: 215331
* Follow up to r215323 - avoid llvm::make_unique in this particular case ↵David Blaikie2014-08-101-3/+3
| | | | | | that's causing GCC on some buildbots some confusion. llvm-svn: 215327
* Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)David Blaikie2014-08-101-8/+8
| | | | | | | | After post-commit review and community discussion, this seems like a reasonable direction to continue, making ownership semantics explicit in the source using the type system. llvm-svn: 215323
* Add coverage mapping generation.Alex Lorenz2014-08-041-3/+14
| | | | | | | | | | This patch adds the '-fcoverage-mapping' option which allows clang to generate the coverage mapping information that can be used to provide code coverage analysis using the execution counts obtained from the instrumentation based profiling (-fprofile-instr-generate). llvm-svn: 214752
* Recommit: Handle diagnostic warnings in Frontend diagnostic handler.Tyler Nowicki2014-07-181-12/+25
| | | | | | | | | | | | | | | Clang uses a diagnostic handler to grab diagnostic messages so it can print them with the line of source code they refer to. This patch extends this to handle optimization failures that were added to llvm to produce a warning when loop vectorization is explicitly specified (using a pragma clang loop directive) but fails. Update renames warning flag name to avoid indicating the flag's severity and adds a test. Reviewed by Alp Toker llvm-svn: 213400
* Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie2014-07-171-8/+7
| | | | | | | | | This reverts commit r213307. Reverting to have some on-list discussion/confirmation about the ongoing direction of smart pointer usage in the LLVM project. llvm-svn: 213325
* unique_ptr-ify ownership of ASTConsumersDavid Blaikie2014-07-171-7/+8
| | | | | | | | | (after fixing a bug in MultiplexConsumer I noticed the ownership of the nested consumers was implemented with raw pointers - so this fixes that... and follows the source back to its origin pushing unique_ptr ownership up through there too) llvm-svn: 213307
* Revert "Handle diagnostic warnings in Frontend diagnostic handler."Alp Toker2014-07-171-28/+12
| | | | | | | | | | | This commit is missing tests and there are a few points that need to be addressed before a new user-facing option can be added: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140714/110198.html This reverts commit r213112. llvm-svn: 213260
* Handle diagnostic warnings in Frontend diagnostic handler.Tyler Nowicki2014-07-161-13/+29
| | | | | | | | | | | | Clang uses a diagnostic handler to grab diagnostic messages so it can print them with the line of source code they refer to. This patch extends this to handle diagnostic warnings that were added to llvm to produce a warning when loop vectorization is explicitly specified (using a pragma clang loop directive) but fails. Reviewed by: Aaron Ballman llvm-svn: 213112
* CodeGenAction::ExecuteAction(): check for invalid LLVM source locationsAlp Toker2014-06-301-5/+11
| | | | | | | | | | | | | Add sign checks to deal with the fact that IR parser line/column pairs are signed integers and sometimes invalid. The crash path is potentially triggered by corrupt '.bc' files in practice, though I don't have a binary input test case that can be checked-in right now. (Unfortunately the backend itself crashes on various ill-formed '.bc' inputs so this bandage isn't as helpful as it appears yet.) llvm-svn: 212007
* Remove 'const' from MemoryBuffers used through the SourceManagerDavid Blaikie2014-06-271-4/+2
| | | | | | | | | | | | | | This removes a const_cast added in r211884 that occurred due to an inconsistency in how MemoryBuffers are handled between some parts of clang and LLVM. MemoryBuffers are immutable and the general convention in the LLVM project is to omit const from immutable types as it's simply redundant/verbose (see llvm::Type, for example). While this change doesn't remove "const" from /every/ MemoryBuffer, it at least makes this chain of ownership/usage consistent. llvm-svn: 211915
* const_cast the memory MemoryBuffer following LLVM r211883Alp Toker2014-06-271-1/+2
| | | | llvm-svn: 211884
* Add a FIXME for an unfortunate issue in ConvertBackendLocation()Alp Toker2014-06-271-1/+3
| | | | | | | This function is copying the entire file contents into memory repeatedly and allocating new file IDs *each time* a source location is processed. llvm-svn: 211874
* CodeGenAction: don't duplicate entire .ll/.bc files into memoryAlp Toker2014-06-271-6/+1
| | | | | | Requires supporting changes from LLVM r211861. llvm-svn: 211862
* Add new debug kind LocTrackingOnly.Diego Novillo2014-06-241-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This new debug emission kind supports emitting line location information in all instructions, but stops code generation from emitting debug info to the final output. This mode is useful when the backend wants to track source locations during code generation, but it does not want to produce debug info. This is currently used by optimization remarks (-Rpass, -Rpass-missed and -Rpass-analysis). When one of the -Rpass flags is used, the front end will enable location tracking, only if no other debug option is enabled. To prevent debug information from being generated, a new debug info kind LocTrackingOnly causes DIBuilder::createCompileUnit() to not emit the llvm.dbg.cu annotation. This blocks final code generation from generating debug info in the back end. Depends on D4234. Reviewers: echristo, dblaikie Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4235 llvm-svn: 211610
* Prefix another use of error_code.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210832
* Provide fallback locations for backend remarksAlp Toker2014-06-051-8/+15
| | | | | | | | | | | | Instead of disembodied diagnostics when debug info is disabled it's now possible to identify the associated function's location in order to provide some amount of of context. We use the definition's body right brace location to differentiate the fallback from diagnostics that genuinely relate to the function declaration itself (a convention also used by gcc). llvm-svn: 210294
* Implement -Wframe-larger-than backend diagnosticAlp Toker2014-06-051-6/+8
| | | | | | | | | | | | | | | | | | Add driver and frontend support for the GCC -Wframe-larger-than=bytes warning. This is the first GCC-compatible backend diagnostic built around LLVM's reporting feature. This commit adds infrastructure to perform reverse lookup from mangled names emitted after LLVM IR generation. We use that to resolve precise locations and originating AST functions, lambdas or block declarations to produce seamless codegen-guided diagnostics. An associated change, StringMap now maintains unique mangled name strings instead of allocating copies. This is a net memory saving in C++ and a small hit for C where we no longer reuse IdentifierInfo storage, pending further optimisation. llvm-svn: 210293
* When an inline-asm diagnostic is reported by the backend, report it with theJoey Gouly2014-06-051-6/+17
| | | | | | | | correct severity. Previously all inline-asm diagnostics were reported as errors. llvm-svn: 210286
OpenPOWER on IntegriCloud