summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Silence a warning about an unused variable in -Asserts buildsDouglas Gregor2009-02-111-1/+1
| | | | llvm-svn: 64306
* Fix for PR3447: use padded sizes for computations on struct/union Eli Friedman2009-02-011-5/+5
| | | | | | constants. llvm-svn: 63491
* Implement constant generation of ImplicitValueInitExprs.Anders Carlsson2009-01-301-1/+6
| | | | llvm-svn: 63379
* Introduce a new expression node, ImplicitValueInitExpr, thatDouglas Gregor2009-01-291-5/+0
| | | | | | | | | | | | | represents an implicit value-initialization of a subobject of a particular type. This replaces the (ab)use of CXXZeroValueInitExpr within initializer lists for the "holes" that occur due to the use of C99 designated initializers. The new test case is currently XFAIL'd, because CodeGen's ConstExprEmitter (in lib/CodeGen/CGExprConstant.cpp) needs to be taught to value-initialize when it sees ImplicitValueInitExprs. llvm-svn: 63317
* Clean up designated initialization of unions, so that CodeGen doesn'tDouglas Gregor2009-01-291-24/+21
| | | | | | have to try to guess which member is being initialized. llvm-svn: 63315
* Improvements to code-generation and semantic analysis of designatedDouglas Gregor2009-01-281-1/+11
| | | | | | | | | | | | initializers. - We now initialize unions properly when a member other than the first is named by a designated initializer. - We now provide proper semantic analysis and code generation for GNU array-range designators *except* that side effects will occur more than once. We warn about this. llvm-svn: 63253
* Implement basic _Complex integer constant folding.Daniel Dunbar2009-01-281-1/+11
| | | | | | | - Merged into single ComplexEvaluator, these share too much logic to be worth splitting for float/int (IMHO). Will split on request. llvm-svn: 63248
* Code generation support for C99 designated initializers.Douglas Gregor2009-01-281-6/+2
| | | | | | | | | | | | | | | | | | | | The approach I've taken in this patch is relatively straightforward, although the code itself is non-trivial. Essentially, as we process an initializer list we build up a fully-explicit representation of the initializer list, where each of the subobject initializations occurs in order. Designators serve to "fill in" subobject initializations in a non-linear way. The fully-explicit representation makes initializer lists (both with and without designators) easy to grok for codegen and later semantic analyses. We keep the syntactic form of the initializer list linked into the AST for those clients interested in exactly what the user wrote. Known limitations: - Designating a member of a union that isn't the first member may result in bogus initialization (we warn about this) - GNU array-range designators are not supported (we warn about this) llvm-svn: 63242
* Get rid of some code that should be unnecessary.Eli Friedman2009-01-251-52/+0
| | | | llvm-svn: 62950
* Make the constant folder aware of Eli Friedman2009-01-251-0/+9
| | | | | | | __builtin___CFStringMakeConstantString. (We get into trouble in GenerateStaticBlockVarDecl if the constant folder isn't accurate.) llvm-svn: 62949
* Fix the address of a label to be properly considered and emitted as aEli Friedman2009-01-251-0/+6
| | | | | | constant. llvm-svn: 62948
* remove dead code.Chris Lattner2009-01-241-15/+0
| | | | llvm-svn: 62930
* Add support for vectors to APValue. Vector constant evaluator and tests coming.Nate Begeman2009-01-181-0/+13
| | | | llvm-svn: 62438
* add support for usage of cast to union thing with static varsNuno Lopes2009-01-171-20/+28
| | | | llvm-svn: 62387
* (LLVM up) Match TargetData API change in LLVM TOT.Daniel Dunbar2009-01-121-1/+1
| | | | llvm-svn: 62101
* Add QualifiedDeclRefExpr, which retains additional source-locationDouglas Gregor2009-01-061-1/+2
| | | | | | | | | | | | | | | | | | | information for declarations that were referenced via a qualified-id, e.g., N::C::value. We keep track of the location of the start of the nested-name-specifier. Note that the difference between QualifiedDeclRefExpr and DeclRefExpr does have an effect on the semantics of function calls in two ways: 1) The use of a qualified-id instead of an unqualified-id suppresses argument-dependent lookup 2) If the name refers to a virtual function, the qualified-id version will call the function determined statically while the unqualified-id version will call the function determined dynamically (by looking up the appropriate function in the vtable). Neither of these features is implemented yet, but we do print out qualified names for QualifiedDeclRefExprs as part of the AST printing. llvm-svn: 61789
* Add support for member references (E1.E2, E1->E2) with C++ semantics,Douglas Gregor2008-12-201-1/+4
| | | | | | | | | | which can refer to static data members, enumerators, and member functions as well as to non-static data members. Implement correct lvalue computation for member references in C++. Compute the result type of non-static data members of reference type properly. llvm-svn: 61294
* add codegen support for __func__ and friends, producing the sameChris Lattner2008-12-121-0/+10
| | | | | | output that GCC does. rdar://6440297 llvm-svn: 60922
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Change more code over to using the new Expr::EvaluateAnders Carlsson2008-12-011-16/+19
| | | | llvm-svn: 60323
* Remove the #ifdeffed out code.Anders Carlsson2008-11-251-241/+0
| | | | llvm-svn: 60032
* Use tryEvaluate for constant exprs.Anders Carlsson2008-11-221-2/+13
| | | | llvm-svn: 59857
* A few corrections to the expr constant work. Not enabled at the Eli Friedman2008-11-171-2/+3
| | | | | | moment. llvm-svn: 59435
* More expr constant work. (Off by default).Anders Carlsson2008-11-171-8/+25
| | | | llvm-svn: 59433
* rename Expr::tryEvaluate to Expr::Evaluate.Chris Lattner2008-11-161-2/+2
| | | | llvm-svn: 59426
* More constant expr work.Anders Carlsson2008-11-161-6/+18
| | | | llvm-svn: 59405
* Check in code that uses tryEvaluate for emitting constant exprs (not used yet).Anders Carlsson2008-11-151-0/+29
| | | | llvm-svn: 59375
* Use IgnoreParenCasts. No functionality change.Anders Carlsson2008-11-151-10/+1
| | | | llvm-svn: 59371
* Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl2008-11-111-8/+2
| | | | | | expressions, both of values and types. llvm-svn: 59057
* make codegen reject initializes with designators, like this:Chris Lattner2008-10-261-0/+6
| | | | | | | | t.c:1:13: error: cannot codegen this designators yet int a[10] = {2, 4, [8]=9, 10}; ^~~~~~~~~~~~~~~~~ llvm-svn: 58220
* Preliminary support for function overloadingDouglas Gregor2008-10-211-2/+2
| | | | llvm-svn: 57909
* silence release-assert warnings.Chris Lattner2008-10-121-2/+2
| | | | llvm-svn: 57392
* Make sema and codegen allow __builtin___CFStringMakeConstantString as a validChris Lattner2008-10-061-0/+18
| | | | | | | constant lvalue. Implement this in codegen by moving the code out of CGBuiltin into EmitConstantExpr. llvm-svn: 57163
* instead of making codegen try to know about all of the builtins to generateChris Lattner2008-10-061-23/+8
| | | | | | | constants for them, just use the constant evaluator to do the job. This also fixes crashes on 'unknown constant builtins'. llvm-svn: 57155
* Handle emitting __builtin_huge_valf as a constant expr.Anders Carlsson2008-08-251-0/+28
| | | | llvm-svn: 55299
* Add CodeGen support for CXXZeroInitValueExpr.Argyrios Kyrtzidis2008-08-231-0/+3
| | | | llvm-svn: 55249
* Add ExplicitCastExpr to replace the current CastExpr, and have ↵Argyrios Kyrtzidis2008-08-181-1/+1
| | | | | | | | | | | ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr): Expr -> CastExpr -> ExplicitCastExpr -> ImplicitCastExpr llvm-svn: 54955
* Add CodeGen support for AddrLabelExpr in initializers.Daniel Dunbar2008-08-161-0/+8
| | | | llvm-svn: 54837
* Change WarnUnsupported to ErrorUnsupported (in name and in practice).Daniel Dunbar2008-08-161-5/+5
| | | | | | | - We are beyond the point where this shows up often and when it does generating miscompiled files is bad. llvm-svn: 54836
* Add GetAddrOfConstantCString methodDaniel Dunbar2008-08-131-5/+3
| | | | | | | | | | | | | | | | | | - Returns addr of constant for argument + '\0'. - I couldn't think of a better name. - Move appropriate users of GetAddrOfConstantString to this. Rename getStringForStringLiteral to GetStringForStringLiteral. Add GetAddrOfConstantStringFromLiteral - This combines GetAddrOfConstantString and GetStringForStringLiteral. This method can be, but is not yet, more efficient. Change GetAddrOfConstantString to not add terminating '\0' - <rdar://problem/6140956> llvm-svn: 54768
* Change ObjCRuntime GenerateProtocol[Ref] methods to takeDaniel Dunbar2008-08-131-0/+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 ObjC constant string support for NeXT.Daniel Dunbar2008-08-121-2/+4
| | | | | | | | | | Changed CGObjCRuntime::GenerateConstantString interface to take std::string instead of char* and size. Change ObjC functions which call on GenerateConstantString to bitcast result to appropriate type. llvm-svn: 54659
* Change CodeGenModule to only create ObjC runtime for ObjC filesDaniel Dunbar2008-08-111-1/+1
| | | | | | | - Changed CodeGenModule::getObjCRuntime to return reference. - Added CodeGenModule::hasObjCRuntime predicate. llvm-svn: 54645
* More #include cleaningDaniel Dunbar2008-08-111-1/+2
| | | | | | - Remove internal uses of AST.h llvm-svn: 54628
* Back out r54608 (inline string literals were getting an extra '\0')Daniel Dunbar2008-08-101-23/+3
| | | | | | | | | | | | | | | temporarily, I assumed GetAddrForConstantString literal was being used consistently but it doesn't look like it is. Factored out a CodeGenModule::getStringForStringLiteral which handles extracting a std::string for the bytes of a StringLiteral, padded to match the type. Update EmitLValue to use getStringForStringLiteral, this was previously not padding strings correctly. Good thing we only emit strings in 4 different places! llvm-svn: 54621
* Fix crash during initialization of a bitfield which followed a zeroDaniel Dunbar2008-08-101-2/+8
| | | | | | | | length element. Fix some 80-col violations. llvm-svn: 54610
* Finally fix PR2189. This makes a fairly invasive but important change toChris Lattner2008-08-041-5/+4
| | | | | | | | | | move getAsArrayType into ASTContext instead of being a method on type. This is required because getAsArrayType(const AT), where AT is a typedef for "int[10]" needs to return ArrayType(const int, 10). Fixing this greatly simplifies getArrayDecayedType, which is a good sign. llvm-svn: 54317
* Rework codegen emission of globalsDaniel Dunbar2008-07-291-2/+2
| | | | | | | | | | | | | | | | | | | | - No (intended) functionality change. - Primary purpose is to clearly separate (lazy) construction of globals that are a forward declaration or tentative definition from those that are the final definition. - Lazy construction is now encapsulated in GetAddrOf{Function,GlobalVar} while final definitions are constructed in EmitGlobal{Function,Var}Definition. - External interface for dealing with globals is now limited to EmitGlobal and GetAddrOf{Function,GlobalVar}. - Also updated helper functions dealing with statics, annotations, and ctors to be private. llvm-svn: 54179
* Fix a bug in my previous patch, CGF is not valid for constants outside a ↵Chris Lattner2008-07-261-2/+2
| | | | | | function llvm-svn: 54108
* remove uses of QualType::getCanonicalType() from codegen for PR2189Chris Lattner2008-07-261-5/+4
| | | | llvm-svn: 54107
OpenPOWER on IntegriCloud