summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* De-ASTContext-ify DeclContext.Argyrios Kyrtzidis2009-06-301-4/+4
| | | | | | | Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating". Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit. llvm-svn: 74506
* PR4390: Make sure to handle anonymous unions correctly while building Eli Friedman2009-06-141-5/+2
| | | | | | static intializers for structs. llvm-svn: 73349
* Sink the BuiltinInfo object from ASTContext into theChris Lattner2009-06-141-0/+1
| | | | | | | | preprocessor and initialize it early in clang-cc. This ensures that __has_builtin works in all modes, not just when ASTContext is around. llvm-svn: 73319
* Fix up constant expression handling to deal with the address Eli Friedman2009-05-271-15/+3
| | | | | | of a reference correctly. llvm-svn: 72463
* Reflow some comments.Mike Stump2009-05-161-3/+3
| | | | llvm-svn: 71937
* push GlobalDecl through enough of the CodeGenModule interfacesChris Lattner2009-05-121-1/+1
| | | | | | | | | to allow us to support generation of deferred ctors/dtors. It looks like codegen isn't emitting a call to the dtor in member-functions.cpp:test2, but when it does, its body should get emitted. llvm-svn: 71594
* Correct for renaming PaddedSize -> AllocSize inDuncan Sands2009-05-091-6/+6
| | | | | | LLVM. llvm-svn: 71350
* Fix crash with constant initialization of bit-fields in unions.Eli Friedman2009-05-071-1/+1
| | | | llvm-svn: 71194
* Fix for PR4108: be a bit looser with the casts that we accept in Eli Friedman2009-04-301-2/+3
| | | | | | constant initializers. llvm-svn: 70483
* Minor work related to removing the assumption that value initialization Eli Friedman2009-04-131-11/+18
| | | | | | implies an all-zero bit pattern. llvm-svn: 68994
* Add support for generating reference initialization code.Anders Carlsson2009-04-111-2/+21
| | | | llvm-svn: 68852
* Rename variables to avoid conflict.Anders Carlsson2009-04-101-8/+8
| | | | llvm-svn: 68764
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-4/+4
| | | | | | No functionality change (really). llvm-svn: 68726
* Add a destination type argument to EmitConstantExpr. This will be used for ↵Anders Carlsson2009-04-081-9/+17
| | | | | | when the destination has a reference type. (No functionality change yet) llvm-svn: 68593
* More "prep" work for handling UTF16 CFString.Steve Naroff2009-04-011-2/+1
| | | | | | Patch by Jean-Daniel Dupas. Thanks! llvm-svn: 68203
* Some "prep" work for handling ObjC @-string constants that contain UTF-8. No ↵Steve Naroff2009-03-311-3/+2
| | | | | | | | functionality change. Changed GenerateConstantString() to take an ObjCStringLiteral (instead of a std::string). While this isn't strictly necessary, it seems cleaner and allows us to cache to "containsNonAscii" if necessary (to avoid checking in both Sema and CodeGen). llvm-svn: 68114
* Return 0 if the ConstExprEmitter can't handle an expression.Anders Carlsson2009-03-031-3/+1
| | | | llvm-svn: 65951
* Do some blocks cleanup and simplification. Fix a crash, and add a test case.Anders Carlsson2009-03-011-3/+7
| | | | llvm-svn: 65746
* CodeGen support for copied BlockDeclRefExprs.Mike Stump2009-02-251-1/+1
| | | | llvm-svn: 65487
* first wave of fixes for @encode sema support. This is part of PR3648.Chris Lattner2009-02-241-4/+23
| | | | | | | The big difference here is that (like string literal) @encode has array type, not pointer type. llvm-svn: 65391
* Fix IRgen of constant expressions referring to external/staticDaniel Dunbar2009-02-241-5/+8
| | | | | | | variables. - PR3657. llvm-svn: 65381
* Eliminate a bunch of code which should be dead.Eli Friedman2009-02-221-194/+5
| | | | llvm-svn: 65267
* Add enough checking to ensure that non-constant block literals don'tMike Stump2009-02-191-1/+5
| | | | | | | appear to be constant. I'll probably redo this and throw it all away later once we have codegen for BlockDeclRefExprs. llvm-svn: 65070
* Remove IRgen constant emission assumption that LValue APValue resultsDaniel Dunbar2009-02-191-15/+31
| | | | | | | | | only occur for pointer types; they are also possible for integer types now. - No intended functionality change, IntExprEvaluate doesn't return LValue results yet. llvm-svn: 65066
* More codegen for blocks. The type of block literals should be better.Mike Stump2009-02-191-0/+3
| | | | | | The size calculation is improved. llvm-svn: 64994
* Change EmitConstantExpr to allow failure.Daniel Dunbar2009-02-171-15/+33
| | | | | | | | | | | | | | IRgen no longer relies on isConstantInitializer, instead we just try to emit the constant. If that fails then in C we emit an error unsupported (this occurs when Sema accepted something that it doesn't know how to fold, and IRgen doesn't know how to emit) and in C++ we emit a guarded initializer. This ends up handling a few more cases, because IRgen was actually able to emit some of the constants Sema accepts but can't Evaluate(). For example, PR3398. llvm-svn: 64780
* Generate the helper function for blocks. Now basic codegen isMike Stump2009-02-141-1/+4
| | | | | | starting to work for blocks. llvm-svn: 64570
* Add hook to add attributes to function declarations that we knowDouglas Gregor2009-02-141-1/+2
| | | | | | | | | | | | | | | | about, whether they are builtins or not. Use this to add the appropriate "format" attribute to NSLog, NSLogv, asprintf, and vasprintf, and to translate builtin attributes (from Builtins.def) into actual attributes on the function declaration. Use the "printf" format attribute on function declarations to determine whether we should do format string checking, rather than looking at an ad hoc list of builtins and "known" function names. Be a bit more careful about when we consider a function a "builtin" in C++. llvm-svn: 64561
* Add a very basic implemenation of global blocks. This needs to be cleaned up.Anders Carlsson2009-02-121-0/+4
| | | | llvm-svn: 64387
* 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
OpenPOWER on IntegriCloud