summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/ModuleBuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* When we decide to output a deferred decl, remember the llvm GlobalValue.Rafael Espindola2013-12-091-0/+2
| | | | | | | | | We can reuse it to avoid a DenseMap+StringMap lookup to find if it was already emitted or not. This fixes a 2010 TODO. llvm-svn: 196785
* PR16933: Don't try to codegen things after we've seen errors.David Blaikie2013-08-191-0/+12
| | | | | | | | Refactor the underlying code a bit to remove unnecessary calls to "hasErrorOccurred" & make them consistently at all the entry points to the IRGen ASTConsumer. llvm-svn: 188707
* DebugInfo: Unify & optimize the lazy addition of record typesDavid Blaikie2013-08-151-1/+1
| | | | | | | | | | | | | | | Rather than going through the whole getOrCreateType machinery to manifest a type, cut straight to the implementation because we know we have to do work. While the previous implementation was sufficient for the two cases (completeness and required completeness) we have already (the general machinery could inspect the type for those attributes & go down the full definition path), a pending change (to emit info for types when we emit their vtables) won't have that luxury & we'll need to force the creation rather than relying on the general purpose routine. llvm-svn: 188486
* clang-cl: Support the run-time selection options (/MD, /MT et al.)Hans Wennborg2013-08-081-0/+3
| | | | | | | | | | | | These flags set some preprocessor macros and injects a dependency on the runtime library into the object file, which later is picked up by the linker. This also adds a new CC1 flag for adding a dependent library. Differential Revision: http://llvm-reviews.chandlerc.com/D1315 llvm-svn: 187945
* PR16214, PR14467: DebugInfo: use "RequireCompleteType" to decide when to ↵David Blaikie2013-07-131-0/+7
| | | | | | | | | | | | | | | 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/+9
| | | | | | | | | | | | | | | | | | | | | | 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
* Don't propagate around TargetOptions in IR-gen; we don't use it.John McCall2013-04-161-8/+6
| | | | | | Patch by Stephen Lin! llvm-svn: 179639
* Pass the target options through to code generation.Bill Wendling2013-02-141-4/+8
| | | | | | | 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
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-3/+3
| | | | | | | | 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-3/+3
| | | | | | | | | | | | | 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
* Move TargetData to DataLayout.Micah Villmow2012-10-081-3/+3
| | | | llvm-svn: 165395
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-1/+1
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Replace MarkVarRequired with a more genericRafael Espindola2012-03-081-2/+2
| | | | | | HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios. llvm-svn: 152320
* Fix a small difference in sema and codegen views of what needs to be output.Rafael Espindola2012-03-051-0/+4
| | | | | | | | | | | | In the included testcase, soma thinks that we already have a definition after we see the out of line decl. Codegen puts it in a deferred list, to be output if a use is seen. This would break when we saw an explicit template instantiation definition, since codegen would not be notified. This patch adds a method to the consumer interface so that soma can notify codegen that this decl is now required. llvm-svn: 152024
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-3/+3
| | | | llvm-svn: 149798
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+2
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continueArgyrios Kyrtzidis2011-11-181-1/+2
| | | | | | parsing or false to abort parsing. llvm-svn: 144943
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-3/+3
| | | | llvm-svn: 140478
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-3/+3
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Modify some deleted function methods to better reflect reality:Alexis Hunt2011-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | - New isDefined() function checks for deletedness - isThisDeclarationADefinition checks for deletedness - New doesThisDeclarationHaveABody() does what isThisDeclarationADefinition() used to do - The IsDeleted bit is not propagated across redeclarations - isDeleted() now checks the canoncial declaration - New isDeletedAsWritten() does what it says on the tin. - isUserProvided() now correct (thanks Richard!) This fixes the bug that we weren't catching void foo() = delete; void foo() {} as being a redefinition. llvm-svn: 131013
* In addition to in-class member functions marked with the "used"Douglas Gregor2011-02-191-1/+2
| | | | | | | attribute, we also care about those with the "constructor" attribute. Fixes PR6521. llvm-svn: 126055
* Emit in-class member function definitions that are markedDouglas Gregor2011-02-151-0/+12
| | | | | | "used". Fixes <rdar://problem/8684363>. llvm-svn: 125579
* Move CodeGenOptions.h *back* into Frontend. This should have been done when theChandler Carruth2010-06-151-1/+1
| | | | | | dependency edge was reversed such that CodeGen depends on Frontend. llvm-svn: 106065
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "used" (e.g., we will refer to the vtable in the generated code) and when they are defined (i.e., because we've seen the key function definition). Previously, we were effectively tracking "potential definitions" rather than uses, so we were a bit too eager about emitting vtables for classes without key functions. The new scheme: - For every use of a vtable, Sema calls MarkVTableUsed() to indicate the use. For example, this occurs when calling a virtual member function of the class, defining a constructor of that class type, dynamic_cast'ing from that type to a derived class, casting to/through a virtual base class, etc. - For every definition of a vtable, Sema calls MarkVTableUsed() to indicate the definition. This happens at the end of the translation unit for classes whose key function has been defined (so we can delay computation of the key function; see PR6564), and will also occur with explicit template instantiation definitions. - For every vtable defined/used, we mark all of the virtual member functions of that vtable as defined/used, unless we know that the key function is in another translation unit. This instantiates virtual member functions when needed. - At the end of the translation unit, Sema tells CodeGen (via the ASTConsumer) which vtables must be defined (CodeGen will define them) and which may be used (for which CodeGen will define the vtables lazily). From a language perspective, both the old and the new schemes are permissible: we're allowed to instantiate virtual member functions whenever we want per the standard. However, all other C++ compilers were more lazy than we were, and our eagerness was both a performance issue (we instantiated too much) and a portability problem (we broke Boost test cases, which now pass). Notes: (1) There's a ton of churn in the tests, because the order in which vtables get emitted to IR has changed. I've tried to isolate some of the larger tests from these issues. (2) Some diagnostics related to implicitly-instantiated/implicitly-defined virtual member functions have moved to the point of first use/definition. It's better this way. (3) I could use a review of the places where we MarkVTableUsed, to see if I missed any place where the language effectively requires a vtable. Fixes PR7114 and PR6564. llvm-svn: 103718
* Revert changes r97693, r97700, and r97718.John McCall2010-03-041-9/+4
| | | | | | Our testing framework can't deal with disabled targets yet. llvm-svn: 97719
* Create a TargetMachine whenever we create a CodeGenAction. The codegen ofJohn McCall2010-03-041-4/+9
| | | | | | some builtins will rely on target knowledge. llvm-svn: 97693
* Remove ';' after method definition. Noticed by clang++, which one would thinkDaniel Dunbar2009-12-191-1/+1
| | | | | | | would have a higher respect for its own code. This is getting old, is this warning really adding value? llvm-svn: 91779
* Remove remaining VISIBILITY_HIDDEN from anonymous namespaces.Benjamin Kramer2009-11-281-3/+1
| | | | llvm-svn: 90044
* Move CompileOptions -> CodeGenOptions, and sink it into the CodeGen library.Chandler Carruth2009-11-121-7/+7
| | | | | | This resolves the layering violation where CodeGen depended on Frontend. llvm-svn: 86998
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-7/+7
| | | | llvm-svn: 81346
* Switch TargetInfo to store an llvm::Triple.Daniel Dunbar2009-08-241-1/+1
| | | | | | - Primarily to discourage clients form making decisions based on the string. llvm-svn: 79901
* Update for changes in LLVM. Hopefully this is the last one for a while.Owen Anderson2009-07-011-2/+2
| | | | llvm-svn: 74657
* Hold the LLVMContext by reference instead of by pointer.Owen Anderson2009-07-011-2/+2
| | | | llvm-svn: 74642
* Update for LLVMContext+Module change.Owen Anderson2009-07-011-4/+6
| | | | llvm-svn: 74615
* Explictly track tentative definitions within Sema, then hand thoseDouglas Gregor2009-04-211-0/+7
| | | | | | | | | | | | | | | tentative definitions off to the ASTConsumer at the end of the translation unit. Eliminate CodeGen's internal tracking of tentative definitions, and instead hook into ASTConsumer::CompleteTentativeDefinition. Also, tweak the definition-deferal logic for C++, where there are no tentative definitions. Fixes <rdar://problem/6808352>, and will make it much easier for precompiled headers to cope with tentative definitions in the future. llvm-svn: 69681
* Push DeclGroup much farther throughout the compiler. Now the variousChris Lattner2009-03-291-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | productions (except the already broken ObjC cases like @class X,Y;) in the parser that can produce more than one Decl return a DeclGroup instead of a Decl, etc. This allows elimination of the Decl::NextDeclarator field, and exposes various clients that should look at all decls in a group, but which were only looking at one (such as the dumper, printer, etc). These have been fixed. Still TODO: 1) there are some FIXME's in the code about potentially using DeclGroup for better location info. 2) ParseObjCAtDirectives should return a DeclGroup due to @class etc. 3) I'm not sure what is going on with StmtIterator.cpp, or if it can be radically simplified now. 4) I put a truly horrible hack in ParseTemplate.cpp. I plan to bring up #3/4 on the mailing list, but don't plan to tackle #1/2 in the short term. llvm-svn: 68002
* change HandleTranslationUnit to take an ASTContext instead of TranslationUnitChris Lattner2009-03-281-1/+1
| | | | llvm-svn: 67910
* most of this is plumbing to get CompileOptions down into Chris Lattner2009-03-261-17/+10
| | | | | | | CodeGenModule. Once there, add a new NoCommon option to it and implement -fno-common. llvm-svn: 67735
* Remove some redundant Decl -> Decl castings.Argyrios Kyrtzidis2009-02-171-5/+1
| | | | llvm-svn: 64804
* Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor2009-01-201-2/+2
| | | | | | | | | | | | | | | | that every declaration lives inside a DeclContext. Moved several things that don't have names but were ScopedDecls (and, therefore, NamedDecls) to inherit from Decl rather than NamedDecl, including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't store empty DeclarationNames for these things, nor do we try to insert them into DeclContext's lookup structure. The serialization tests are temporarily disabled. We'll re-enable them once we've sorted out the remaining ownership/serialiazation issues between DeclContexts and TranslationUnion, DeclGroups, etc. llvm-svn: 62562
* Add GetModule accessor to ModuleBuilderDaniel Dunbar2008-10-211-0/+4
| | | | llvm-svn: 57924
* Clean up CodeGenModule interface.Daniel Dunbar2008-08-151-54/+6
| | | | | | | | | | | - Add CodeGenModule::EmitTopLevelDecl which uses switch on kind instead of ugly & slow dyn_cast chains. - Drop some simple forwarding methods into the ObjC runtime. - Privatize appropriate methods. llvm-svn: 54827
* Change ObjCRuntime GenerateProtocol[Ref] methods to takeDaniel Dunbar2008-08-131-1/+1
| | | | | | | | | | | ObjCProtocolDecl directly. Implement CodeGen support for forward protocol decls (no-ops are so nice to implement). Also moved CGObjCRuntime.h out of CodeGenModule.h llvm-svn: 54709
* Add LangOptions::NeXTRuntime.Daniel Dunbar2008-08-111-2/+1
| | | | | | | | | - Wired to -fnext-runtime and -fgnu-runtime options. - Defaults to GNU, no autoselection for NeXT. Emit NeXT OBJC_IMAGE_INFO marker. llvm-svn: 54651
* More #include cleaningDaniel Dunbar2008-08-111-3/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* More #include cleaningDaniel Dunbar2008-08-111-0/+2
| | | | | | | | - Drop Expr.h,RecordLayout.h from ASTContext.h (for DeclBase.h and SourceLocation.h) - Move ASTContext constructor into implementation llvm-svn: 54627
* Add dummy Mac Objective-C runtime interface.Daniel Dunbar2008-08-111-1/+2
| | | | | | - Not currently accessible and completely non-functional. llvm-svn: 54624
* 80 colsNico Weber2008-08-091-1/+1
| | | | llvm-svn: 54599
OpenPOWER on IntegriCloud