aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ModuleBuilder.cpp
AgeCommit message (Collapse)AuthorFilesLines
2013-08-19PR16933: Don't try to codegen things after we've seen errors.David Blaikie1-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
2013-08-15DebugInfo: Unify & optimize the lazy addition of record typesDavid Blaikie1-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
2013-08-08clang-cl: Support the run-time selection options (/MD, /MT et al.)Hans Wennborg1-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
2013-07-13PR16214, PR14467: DebugInfo: use "RequireCompleteType" to decide when to ↵David Blaikie1-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
2013-06-04Adding support for MSVC #pragma detect_mismatch functionality by emitting a ↵Aaron Ballman1-0/+5
FAILIFMISMATCH linker command into the object file. llvm-svn: 183178
2013-05-08Forward #pragma comment(lib/linker) through as flags metadataReid Kleckner1-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
2013-04-16Don't propagate around TargetOptions in IR-gen; we don't use it.John McCall1-8/+6
Patch by Stephen Lin! llvm-svn: 179639
2013-02-14Pass the target options through to code generation.Bill Wendling1-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
2013-01-02Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth1-3/+3
reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-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
2012-10-08Move TargetData to DataLayout.Micah Villmow1-3/+3
llvm-svn: 165395
2012-03-11Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie1-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
2012-03-08Replace MarkVarRequired with a more genericRafael Espindola1-2/+2
HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios. llvm-svn: 152320
2012-03-05Fix a small difference in sema and codegen views of what needs to be output.Rafael Espindola1-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
2012-02-05Basic: import OwningPtr<> into clang namespaceDylan Noblesmith1-3/+3
llvm-svn: 149798
2011-12-20Unweaken vtables as per ↵David Blaikie1-0/+2
http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
2011-11-18Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continueArgyrios Kyrtzidis1-1/+2
parsing or false to abort parsing. llvm-svn: 144943
2011-09-25Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie1-3/+3
llvm-svn: 140478
2011-09-02Extend the ASTContext constructor to delay the initialization ofDouglas Gregor1-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
2011-05-06Modify some deleted function methods to better reflect reality:Alexis Hunt1-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
2011-02-19In addition to in-class member functions marked with the "used"Douglas Gregor1-1/+2
attribute, we also care about those with the "constructor" attribute. Fixes PR6521. llvm-svn: 126055
2011-02-15Emit in-class member function definitions that are markedDouglas Gregor1-0/+12
"used". Fixes <rdar://problem/8684363>. llvm-svn: 125579
2010-06-15Move CodeGenOptions.h *back* into Frontend. This should have been done when theChandler Carruth1-1/+1
dependency edge was reversed such that CodeGen depends on Frontend. llvm-svn: 106065
2010-05-13Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor1-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
2010-03-04Revert changes r97693, r97700, and r97718.John McCall1-9/+4
Our testing framework can't deal with disabled targets yet. llvm-svn: 97719
2010-03-04Create a TargetMachine whenever we create a CodeGenAction. The codegen ofJohn McCall1-4/+9
some builtins will rely on target knowledge. llvm-svn: 97693
2009-12-19Remove ';' after method definition. Noticed by clang++, which one would thinkDaniel Dunbar1-1/+1
would have a higher respect for its own code. This is getting old, is this warning really adding value? llvm-svn: 91779
2009-11-28Remove remaining VISIBILITY_HIDDEN from anonymous namespaces.Benjamin Kramer1-3/+1
llvm-svn: 90044
2009-11-12Move CompileOptions -> CodeGenOptions, and sink it into the CodeGen library.Chandler Carruth1-7/+7
This resolves the layering violation where CodeGen depended on Frontend. llvm-svn: 86998
2009-09-09Remove tabs, and whitespace cleanups.Mike Stump1-7/+7
llvm-svn: 81346
2009-08-24Switch TargetInfo to store an llvm::Triple.Daniel Dunbar1-1/+1
- Primarily to discourage clients form making decisions based on the string. llvm-svn: 79901
2009-07-01Update for changes in LLVM. Hopefully this is the last one for a while.Owen Anderson1-2/+2
llvm-svn: 74657
2009-07-01Hold the LLVMContext by reference instead of by pointer.Owen Anderson1-2/+2
llvm-svn: 74642
2009-07-01Update for LLVMContext+Module change.Owen Anderson1-4/+6
llvm-svn: 74615
2009-04-21Explictly track tentative definitions within Sema, then hand thoseDouglas Gregor1-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
2009-03-29Push DeclGroup much farther throughout the compiler. Now the variousChris Lattner1-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
2009-03-28change HandleTranslationUnit to take an ASTContext instead of TranslationUnitChris Lattner1-1/+1
llvm-svn: 67910
2009-03-26most of this is plumbing to get CompileOptions down into Chris Lattner1-17/+10
CodeGenModule. Once there, add a new NoCommon option to it and implement -fno-common. llvm-svn: 67735
2009-02-17Remove some redundant Decl -> Decl castings.Argyrios Kyrtzidis1-5/+1
llvm-svn: 64804
2009-01-20Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor1-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
2008-10-21Add GetModule accessor to ModuleBuilderDaniel Dunbar1-0/+4
llvm-svn: 57924
2008-08-15Clean up CodeGenModule interface.Daniel Dunbar1-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
2008-08-13Change ObjCRuntime GenerateProtocol[Ref] methods to takeDaniel Dunbar1-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
2008-08-11Add LangOptions::NeXTRuntime.Daniel Dunbar1-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
2008-08-11More #include cleaningDaniel Dunbar1-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
2008-08-11More #include cleaningDaniel Dunbar1-0/+2
- Drop Expr.h,RecordLayout.h from ASTContext.h (for DeclBase.h and SourceLocation.h) - Move ASTContext constructor into implementation llvm-svn: 54627
2008-08-11Add dummy Mac Objective-C runtime interface.Daniel Dunbar1-1/+2
- Not currently accessible and completely non-functional. llvm-svn: 54624
2008-08-0980 colsNico Weber1-1/+1
llvm-svn: 54599
2008-08-07ParseAST now conditionally deletes the passed ASTConsumer.Ted Kremenek1-8/+11
ModuleBuilder now performs llvmgen in HandleTranslationUnit. This patch follows from the discussion on the following thread on cfe-commits: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080804/006849.html llvm-svn: 54486
2008-08-05Refactored driver logic for CodeGen into LLVMCodeGenWriter. This ↵Ted Kremenek1-20/+29
ASTConsumer layers on top of LLVMCodeGen (another existing ASTConsumer) to emit bitcode files to disk. This layering takes this logic out of clang.cpp and puts it directly into the ASTConsumer interface. The benefit is that now --emit-llvm works with both serialized ASTs and regular source files. llvm-svn: 54364