summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix array initialization test.Anders Carlsson2010-02-051-1/+2
| | | | llvm-svn: 95375
* If a global initializer has a non-trivial destructor it can't be emitted as ↵Anders Carlsson2010-02-051-1/+10
| | | | | | a constant (even if it has a trivial constructor). llvm-svn: 95363
* Always start tag definitions before completing them. Assert same.John McCall2010-02-051-2/+2
| | | | | | Fixes latent and not-so-latent objc++ and blocks++ bugs. llvm-svn: 95340
* Extract a common structure for holding information about the definitionJohn McCall2010-02-042-14/+17
| | | | | | | | of a C++ record. Exposed a lot of problems where various routines were silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order) when presented with a non-definition. Also cuts down on memory usage. llvm-svn: 95330
* When binding an lvalue to a reference, we always need to pop temporaries.Anders Carlsson2010-02-041-1/+9
| | | | | | | | | | | | | With this fix, and the other fixes committed today a make check-all with a clang-built LLVM now gives: Expected Passes : 6933 Expected Failures : 46 Unsupported Tests : 40 Unexpected Failures: 27 which means that we pass 99.96% of all tests :) The resulting 27 tests are all LLVMC tests and seem to be because of differences in the clang and gcc drivers. llvm-svn: 95313
* Fix a bug where we would not mark temporaries as conditional when emitting a ↵Anders Carlsson2010-02-041-1/+7
| | | | | | conditional operator as an lvalue. llvm-svn: 95311
* Rename StartConditionalBranch/FinishConditionalBranch to ↵Anders Carlsson2010-02-044-20/+20
| | | | | | BeginConditionalBranch/EndConditionalBranch. llvm-svn: 95308
* Fix another pointer-to-member function miscompile, this time when trying to ↵Anders Carlsson2010-02-041-11/+11
| | | | | | call a virtual member function. llvm-svn: 95307
* Calculate offset correctly when taking the address of a virtual member function.Anders Carlsson2010-02-042-3/+10
| | | | llvm-svn: 95305
* Mangle member expressions. Also invented.John McCall2010-02-041-1/+57
| | | | llvm-svn: 95284
* Add a cautionary note about the mangling I just invented.John McCall2010-02-041-0/+3
| | | | llvm-svn: 95275
* Add mangling support for calls, sizeof/alignof, constructor calls,John McCall2010-02-041-29/+151
| | | | | | float literals, and unresolved lookups (which required hand-wavey extensions). llvm-svn: 95273
* Revert "Numerous changes to selector handling:", this breaks a whole bunch ofDaniel Dunbar2010-02-035-63/+26
| | | | | | working code, for no apparent reason. llvm-svn: 95244
* Handle reference binding in aggregate initializers. Fixes another 47 tests.Anders Carlsson2010-02-031-5/+5
| | | | llvm-svn: 95235
* Add a band-aid fix for clang self-hosting. A better fix will follow shortly.Anders Carlsson2010-02-031-0/+3
| | | | llvm-svn: 95232
* More cleanup.Anders Carlsson2010-02-031-10/+14
| | | | llvm-svn: 95226
* Revert the new reference binding code; I came up with a way simpler solution ↵Anders Carlsson2010-02-036-41/+6
| | | | | | for the reference binding bug that is preventing self-hosting. llvm-svn: 95223
* First pass at adding GC support for GNU runtime. GC ivar maps not yet ↵David Chisnall2010-02-031-6/+97
| | | | | | | | constructed, GC flag not set. Please don't try using this yet - the runtime support is still very immature and your code will almost certainly crash if you do. llvm-svn: 95222
* When a function or variable somehow depends on a type or declarationDouglas Gregor2010-02-032-34/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that is in an anonymous namespace, give that function or variable internal linkage. This change models an oddity of the C++ standard, where names declared in an anonymous namespace have external linkage but, because anonymous namespace are really "uniquely-named" namespaces, the names cannot be referenced from other translation units. That means that they have external linkage for semantic analysis, but the only sensible implementation for code generation is to give them internal linkage. We now model this notion via the UniqueExternalLinkage linkage type. There are several changes here: - Extended NamedDecl::getLinkage() to produce UniqueExternalLinkage when the declaration is in an anonymous namespace. - Added Type::getLinkage() to determine the linkage of a type, which is defined as the minimum linkage of the types (when we're dealing with a compound type that is not a struct/class/union). - Extended NamedDecl::getLinkage() to consider the linkage of the template arguments and template parameters of function template specializations and class template specializations. - Taught code generation to rely on NamedDecl::getLinkage() when determining the linkage of variables and functions, also considering the linkage of the types of those variables and functions (C++ only). Map UniqueExternalLinkage to internal linkage, taking out the explicit checks for isInAnonymousNamespace(). This fixes much of PR5792, which, as discovered by Anders Carlsson, is actually the reason behind the pass-manager assertion that causes the majority of clang-on-clang regression test failures. With this fix, Clang-built-Clang+LLVM passes 88% of its regression tests (up from 67%). The specific numbers are: LLVM: Expected Passes : 4006 Expected Failures : 32 Unsupported Tests : 40 Unexpected Failures: 736 Clang: Expected Passes : 1903 Expected Failures : 14 Unexpected Failures: 75 Overall: Expected Passes : 5909 Expected Failures : 46 Unsupported Tests : 40 Unexpected Failures: 811 Still to do: - Improve testing - Check whether we should allow the presence of types with InternalLinkage (in addition to UniqueExternalLinkage) given variables/functions internal linkage in C++, as mentioned in PR5792. - Determine how expensive the getLinkage() calls are in practice; consider caching the result in NamedDecl. - Assess the feasibility of Chris's idea in comment #1 of PR5792. llvm-svn: 95216
* remove a big chunk of #if 0 code.Chris Lattner2010-02-031-58/+0
| | | | llvm-svn: 95201
* Provide a real fix for PR6199, reverting the old workaround. Here, weDouglas Gregor2010-02-031-3/+1
| | | | | | | | realize that CXXConstructExpr is always implicit, so we should just return its argument (if there is only one) rather than directly invoking the constructor. llvm-svn: 95192
* Numerous changes to selector handling:David Chisnall2010-02-035-26/+63
| | | | | | | | | | | | | | | | | | | | | | | - Don't use GlobalAliases with non-0 GEPs (GNU runtime) - this was unsupported and LLVM will be generating errors if you do it soon. This also simplifies the code generated by the GNU runtime a bit. - Make GetSelector() return a constant (GNU runtime), not a load of a store of a constant. - Recognise @selector() expressions as valid static initialisers (as GCC does). - Add methods to GCObjCRuntime to emit selectors as constants (needed for using @selector() expressions as constants. These need implementing for the Mac runtimes - I couldn't figure out how to do this, they seem to require a load. - Store an ObjCMethodDecl in an ObjCSelectorExpr so that we can get at the type information for the selector. This is needed for generating typed selectors from @selector() expressions (as GCC does). Ideally, this information should be stored in the Selector, but that would be an invasive change. We should eventually add checks for common uses of @selector() expressions. Possibly adding an attribute that can be applied to method args providing the types of a selector so, for example, you'd do something like this: - (id)performSelector: __attribute__((selector_types(id, SEL, id)))(SEL) withObject: (id)object; Then, any @selector() expressions passed to the method will be check to ensure that it conforms to this signature. We do this at run time on the GNU runtime already, but it would be nice to do it at compile time on all runtimes. - Made @selector() expressions emit type info if available and the runtime supports it. Someone more familiar with the Mac runtime needs to implement the GetConstantSelector() function in CGObjCMac. This currently just assert()s. llvm-svn: 95189
* Remove abstract expression kinds from the StmtClass enum. Update a few usersJohn McCall2010-02-031-6/+23
| | | | | | appropriately. Call out a few missing cases in the expression mangler. llvm-svn: 95176
* Implement promotion for enumeration types.Douglas Gregor2010-02-021-3/+38
| | | | | | | | | | | | | | | | | | | | | | | | | WHAT!?! It turns out that Type::isPromotableIntegerType() was not considering enumeration types to be promotable, so we would never do the promotion despite having properly computed the promotion type when the enum was defined. Various operations on values of enum type just "worked" because we could still compute the integer rank of an enum type; the oddity, however, is that operations such as "add an enum and an unsigned" would often have an enum result type (!). The bug actually showed up as a spurious -Wformat diagnostic (<rdar://problem/7595366>), but in theory it could cause miscompiles. In this commit: - Enum types with a promotion type of "int" or "unsigned int" are promotable. - Tweaked the computation of promotable types for enums - For all of the ABIs, treat enum types the same way as their underlying types (*not* their promotion types) for argument passing and return values - Extend the ABI tester with support for enumeration types llvm-svn: 95117
* Set the correct vtable pointers _before_ generating code for any member ↵Anders Carlsson2010-02-021-5/+10
| | | | | | initializers. Fixes about ~2000 clang/LLVM tests in the clang-on-clang build. llvm-svn: 95116
* Use the Arg variable rather than re-computing it. This also silences GCC'sChandler Carruth2010-02-021-1/+1
| | | | | | unused variable warning. llvm-svn: 95085
* Codegen CXXConstructExprs with trivial constructors as constants.John McCall2010-02-021-0/+23
| | | | | | Eliminates a lot of spurious global initializers, fixing PR6205. llvm-svn: 95077
* Check in a test case and a nasty workaround for PR6199.Anders Carlsson2010-02-021-1/+3
| | | | llvm-svn: 95076
* Improve handling of emitting 'null' pointers to data members.Anders Carlsson2010-02-024-51/+101
| | | | llvm-svn: 95066
* Move pointer to data member emission to CodeGenModule and use it in ↵Anders Carlsson2010-02-026-34/+45
| | | | | | CGExprConstant. Fixes PR5674. llvm-svn: 95063
* ARM/APCS: Fix classification of small complex integer types as "integer like".Daniel Dunbar2010-02-011-3/+3
| | | | llvm-svn: 95030
* ARM/APCS: Pass Complex types following llvm-gcc.Daniel Dunbar2010-02-011-0/+8
| | | | llvm-svn: 95029
* Fix FIXME and surrounding comment.Devang Patel2010-02-011-4/+1
| | | | llvm-svn: 95023
* Use appropriate context descriptor in RecordDecl's debug info.Devang Patel2010-02-011-3/+9
| | | | llvm-svn: 95016
* Do not use clang type name to name a local variable, e.g. Decl.Devang Patel2010-02-011-44/+44
| | | | llvm-svn: 95010
* Do not use clang type name to name a local variable, e.g. Decl.Devang Patel2010-02-011-29/+25
| | | | llvm-svn: 95009
* Use DeclContext as getContextDescriptor() argument.Devang Patel2010-02-011-18/+27
| | | | llvm-svn: 95008
* NeXT: Add support for -fobjc-legacy-dispatch.Daniel Dunbar2010-02-011-0/+4
| | | | llvm-svn: 95005
* Don't explicitly force utf strings into the __TEXT,__ustringChris Lattner2010-02-011-4/+0
| | | | | | | | | | by setting the section of the generated global. This is an optimization done by the code generator, and the code being removed didn't handle the case when the string contained an embedded nul (which the code generator does correctly handle). This is rdar://7589850 llvm-svn: 95003
* In C++, an initializer on a variable doesn't necessarily mean it's the ↵Sebastian Redl2010-02-011-1/+1
| | | | | | definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function. llvm-svn: 94999
* Emit debug info for namespaces.Devang Patel2010-02-012-1/+29
| | | | llvm-svn: 94991
* Switch expressions like T() and T(1,2) over to new-style initialization. I'mEli Friedman2010-01-311-1/+1
| | | | | | | not quite sure what we want to do about the AST representation; comments welcome. llvm-svn: 94967
* Simplify EmitMemberInitializer; no intended functionality change.Eli Friedman2010-01-311-19/+1
| | | | llvm-svn: 94965
* Start creating CXXBindReferenceExpr nodes when binding complex types to ↵Anders Carlsson2010-01-314-0/+31
| | | | | | references. llvm-svn: 94964
* Rework base and member initialization in constructors, with severalDouglas Gregor2010-01-312-41/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (necessarily simultaneous) changes: - CXXBaseOrMemberInitializer now contains only a single initializer rather than a set of initialiation arguments + a constructor. The single initializer covers all aspects of initialization, including constructor calls as necessary but also cleanup of temporaries created by the initializer (which we never handled before!). - Rework + simplify code generation for CXXBaseOrMemberInitializers, since we can now just emit the initializer as an initializer. - Switched base and member initialization over to the new initialization code (InitializationSequence), so that it - Improved diagnostics for the new initialization code when initializing bases and members, to match the diagnostics produced by the previous (special-purpose) code. - Simplify the representation of type-checked constructor initializers in templates; instead of keeping the fully-type-checked AST, which is rather hard to undo at template instantiation time, throw away the type-checked AST and store the raw expressions in the AST. This simplifies instantiation, but loses a little but of information in the AST. - When type-checking implicit base or member initializers within a dependent context, don't add the generated initializers into the AST, because they'll look like they were explicit. - Record in CXXConstructExpr when the constructor call is to initialize a base class, so that CodeGen does not have to infer it from context. This ensures that we call the right kind of constructor. There are also a few "opportunity" fixes here that were needed to not regress, for example: - Diagnose default-initialization of a const-qualified class that does not have a user-declared default constructor. We had this diagnostic specifically for bases and members, but missed it for variables. That's fixed now. - When defining the implicit constructors, destructor, and copy-assignment operator, set the CurContext to that constructor when we're defining the body. llvm-svn: 94952
* When performing a derived-to-base cast that we know will not change the ↵Anders Carlsson2010-01-311-52/+49
| | | | | | offset, we don't need to null check the input pointer. Fixes PR5965. llvm-svn: 94942
* When doing a base-to-derived cast we don't need to null check the derived ↵Anders Carlsson2010-01-311-10/+15
| | | | | | value if the class offset is 0. llvm-svn: 94939
* Some class related cleanup.Anders Carlsson2010-01-316-41/+39
| | | | llvm-svn: 94938
* More asm cleanup.Anders Carlsson2010-01-301-6/+6
| | | | llvm-svn: 94920
* Yay for more StringRefs.Anders Carlsson2010-01-301-3/+2
| | | | llvm-svn: 94917
OpenPOWER on IntegriCloud