summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenAction.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Fix leak from r210059Alp Toker2014-06-031-1/+1
| | | | | | | Also revert r210096 which temporarily disabled the test while this was being investigated. llvm-svn: 210115
* Fix -emit-codegen-only to not generate binariesAlp Toker2014-06-031-0/+1
| | | | llvm-svn: 210059
* Add flags -Rpass-missed and -Rpass-analysis.Diego Novillo2014-05-291-44/+81
| | | | | | | | | | | | | | | | | | | | | | Summary: These two flags are in the same family as -Rpass, but are used in different situations. -Rpass-missed is used by optimizers to inform the user when they tried to apply an optimization but couldn't (or wouldn't). -Rpass-analysis is used by optimizers to report analysis results back to the user (e.g., why the transformation could not be applied). Depends on D3682. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3683 llvm-svn: 209839
* Fix spurious remarks when -Weverything is used.Diego Novillo2014-05-291-0/+6
| | | | | | | | | | | With -Weverything, the backend remarks are enabled. This was causing spurious diagnostics for remarks that we don't yet handle (cf http://reviews.llvm.org/D3683). This will stop being a problem once http://reviews.llvm.org/D3683 is committed. llvm-svn: 209823
* Reverting 209503 - Breaks asan blacklistsWarren Hunt2014-05-281-4/+1
| | | | | | | | I opened a discussion on cfe-commits. Ideally we've got a few things that need to happen. CompilerRT should probably have blacklists tests. Asan should probably not depend on that specific field. llvm-svn: 209766
* Emit used/dllexport inline method definitions in nested classes (PR19743, ↵Hans Wennborg2014-05-231-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR11170) The previous code that was supposed to handle this didn't work since parsing of inline method definitions is delayed to the end of the outer class definition. Thus, when HandleTagDeclDefinition() got called for the inner class, the inline functions in that class had not been parsed yet. Richard suggested that the way to do this is by handling inline method definitions through a new ASTConsumer callback. I really wanted to call ASTContext::DeclMustBeEmitted() instead of checking for attributes, but doing that causes us to compute linkage, and then we fail with "error: unsupported: typedef changes linkage of anonymous type, but linkage was already computed" on tests like this: (from SemaCXX/undefined-internal.cpp) :-/ namespace test7 { typedef struct { void bar(); void foo() { bar(); } } A; } Differential Revision: http://reviews.llvm.org/D3809 llvm-svn: 209549
* Fix '-main-file-name <name>' so that it is used for the ModuleID.Robert Lytton2014-05-231-1/+4
| | | | | | | | | Summary: Previously, you could not specify the original file name when passing a preprocessed file into the compiler Now you can use 'clang -Xclang -main-file-name -Xclang <original file name> ...' Or 'clang -cc1 -main-file-name <original file name> ...' llvm-svn: 209503
* [C++11] Use 'nullptr'. CodeGen edition.Craig Topper2014-05-211-5/+5
| | | | llvm-svn: 209272
* Rename SourceManager::createFileIDForMemBuffer()Alp Toker2014-05-161-1/+1
| | | | | | | | It makes more sense to just overload createFileID(). Gardening only. llvm-svn: 209002
* Fix segmentation fault when mixing -Rpass with #line.Diego Novillo2014-05-081-3/+10
| | | | | | | | | | | | | | | | | | | Summary: When using #line directives, FileManager::getFile() will return a nil entry. This triggers an assert in translateFileLineCol(). This patch handles nil FileEntry instances by emitting a note that the location could not be translated back to a SourceLocation. I don't really like this solution, but we are translating presumed locations, so some information has already been lost. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3625 llvm-svn: 208315
* Small formatting change.Eric Christopher2014-05-021-1/+1
| | | | llvm-svn: 207852
* Use a manipulator to add a value to the current diagnostic flag.Diego Novillo2014-04-221-3/+2
| | | | | | | | | | | | | | Summary: This addresses the feedback to http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140421/103598.html Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3453 llvm-svn: 206920
* Allow adding a value to a flag in diagnostics.Diego Novillo2014-04-211-1/+2
| | | | | | | | | | | | | | | | | Summary: This allows callers of Diags.Report() to append a value to the name of the flag associated with the diagnostic. This is useful in cases like the -Rpass flag, where we want the diagnostic to show the name of the pass that matched the pattern. Instead of showing "... [-Rpass]", this allows us to show "... [-Rpass=passname]". Reviewers: rsmith CC: cfe-commits Differential Revision: http://reviews.llvm.org/D3441 llvm-svn: 206826
* Add support for optimization reports.Diego Novillo2014-04-161-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a new flag -Rpass=. The flag indicates the name of the optimization pass that should emit remarks stating when it made a transformation to the code. This implements the design I proposed in: https://docs.google.com/document/d/1FYUatSjZZO-zmFBxjOiuOzAy9mhHA8hqdvklZv68WuQ/edit?usp=sharing Other changes: - Add DiagnosticIDs::isRemark(). Use it in printDiagnosticOptions to print "-R" instead of "-W" in the diagnostic message. - In BackendConsumer::OptimizationRemarkHandler, get a SourceLocation object out of the file name, line and column number. Use that location in the call to Diags.Report(). - When -Rpass is used without debug info a note is emitted alerting the user that they need to use -gline-tables-only -gcolumn-info to get this information. CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3226 llvm-svn: 206401
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-12/+12
| | | | | | class. llvm-svn: 203643
* [C++11] Replace OwningPtr include with <memory>.Ahmed Charles2014-03-091-1/+1
| | | | llvm-svn: 203389
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-3/+3
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-12/+8
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
* [Layering] Update include of Linker.h to match its move to a LinkerChandler Carruth2014-03-061-1/+1
| | | | | | subdirectory in LLVM r203065. llvm-svn: 203067
* Add 'remark' diagnostic type in 'clang'Tobias Grosser2014-02-281-1/+22
| | | | | | | | | | | | | | | | | | | | | | | A 'remark' is information that is not an error or a warning, but rather some additional information provided to the user. In contrast to a 'note' a 'remark' is an independent diagnostic, whereas a 'note' always depends on another diagnostic. A typical use case for remark nodes is information provided to the user, e.g. information provided by the vectorizer about loops that have been vectorized. This patch provides the initial implementation of 'remarks'. It includes the actual definiton of the remark nodes, their printing as well as basic parameter handling. We are reusing the existing diagnostic parameters which means a remark can be enabled with normal '-Wdiagnostic-name' flags and can be upgraded to an error using '-Werror=diagnostic-name'. '-Werror' alone does not upgrade remarks. This patch is by intention minimal in terms of parameter handling. More experience and more discussions will most likely lead to further enhancements in the parameter handling. llvm-svn: 202475
* Fix typoTobias Grosser2014-02-261-1/+1
| | | | llvm-svn: 202254
* Wired-up the new LLVM diagnostic system into clang diagnostic system.Quentin Colombet2014-02-061-1/+113
| | | | | | | | | The approach is similar to the existing inline-asm reporting, just more general. <rdar://problem/15886278> llvm-svn: 200931
* Update for getLazyBitcodeModule API change.Rafael Espindola2014-01-131-3/+5
| | | | llvm-svn: 199126
* Verify that clang TargetInfo descriptions match DataLayout strings from LLVMAlp Toker2014-01-021-4/+4
| | | | | | | The backend string is only verified when available as it's possible to run clang IRGen for targets that haven't been built or don't exist in LLVM. llvm-svn: 198309
* Fix getCustomDiagID() usage in CodeGen and TextDiagnosticBufferAlp Toker2013-12-211-13/+4
| | | | | | | | | | DiagIDs are a cached resource generally only constructed from compile-time constant or stable format strings. Escaping arbitrary messages and constructing DiagIDs from them didn't make sense. llvm-svn: 197856
* Override the datalayout in a module with -triple.Rafael Espindola2013-12-201-1/+10
| | | | | | | | | This matches llc's behavior. Before this patch clang would create a TargetInfo base on -triple but a llvm CodeGen based on the triple in the module. llvm-svn: 197837
* clang-format parts of the file.Rafael Espindola2013-12-181-18/+9
| | | | | | | I am about to send a patch for review touching these and clang-formating first makes the patch much easier to read. llvm-svn: 197585
* PR16214, PR14467: DebugInfo: use "RequireCompleteType" to decide when to ↵David Blaikie2013-07-131-0/+4
| | | | | | | | | | | | | | | emit the full definition of a type in -flimit-debug-info This simplifies the core benefit of -flimit-debug-info by taking a more systematic approach to avoid emitting debug info definitions for types that only require declarations. The previous ad-hoc approach (3 cases removed in this patch) had many holes. The general approach (adding a bit to TagDecl and callback through ASTConsumer) has been discussed with Richard Smith - though always open to revision. llvm-svn: 186262
* Adding support for MSVC #pragma detect_mismatch functionality by emitting a ↵Aaron Ballman2013-06-041-0/+5
| | | | | | FAILIFMISMATCH linker command into the object file. llvm-svn: 183178
* Forward #pragma comment(lib/linker) through as flags metadataReid Kleckner2013-05-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: Most of this change is wiring the pragma all the way through from the lexer, parser, and sema to codegen. I considered adding a Decl AST node for this, but it seemed too heavyweight. Mach-O already uses a metadata flag called "Linker Options" to do this kind of auto-linking. This change follows that pattern. LLVM knows how to forward the "Linker Options" metadata into the COFF .drectve section where these flags belong. ELF support is not implemented, but possible. This is related to auto-linking, which is http://llvm.org/PR13016. CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D723 llvm-svn: 181426
* The IRReader header is now part of its own library. Update the includeChandler Carruth2013-03-261-1/+1
| | | | | | line and the library dependencies to reflect this. llvm-svn: 177972
* Pass the target options through to code generation.Bill Wendling2013-02-141-1/+1
| | | | | | | The code generation stuff is going to set attributes on the functions it generates. To do that it needs the target options. Pass them through. llvm-svn: 175141
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-2/+2
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-6/+6
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Turn FrontendInputFile into an immutable class and have it also acceptArgyrios Kyrtzidis2012-11-091-1/+1
| | | | | | a memory buffer instead of only a filename. llvm-svn: 167627
* Have the parser initialize Sema before it consumes the firstDouglas Gregor2012-11-051-1/+3
| | | | | | | | token. This is important because the first token could actually be after an #include that triggers a module import, which might use either Sema or the AST consumer before it would have been initialized. llvm-svn: 167423
OpenPOWER on IntegriCloud