summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix <rdar://problem/6765383> clang-6: clang does not appear to support ↵Steve Naroff2009-04-161-0/+2
| | | | | | declaring a static Block 'const'. llvm-svn: 69306
* PCH support for InitListExpr, DesignatedInitExpr, and ImplicitValueInitExpr.Douglas Gregor2009-04-161-0/+18
| | | | llvm-svn: 69251
* PCH support for ShuffleVectorExpr and BlockDeclRefExprDouglas Gregor2009-04-161-0/+9
| | | | llvm-svn: 69244
* PCH support for ExtVectorElementExpr and VAArgExpr.Douglas Gregor2009-04-151-3/+3
| | | | llvm-svn: 69240
* PCH support for MemberExpr and CallExpr.Douglas Gregor2009-04-151-0/+5
| | | | llvm-svn: 69186
* PCH support for string literalsDouglas Gregor2009-04-151-0/+21
| | | | llvm-svn: 69172
* Implement support for designated initializers that refer to members ofDouglas Gregor2009-04-151-18/+48
| | | | | | anonymous structs or unions. Fixes PR3778. llvm-svn: 69153
* Improve "assignment to cast" diagnostic.Daniel Dunbar2009-04-151-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Strip off extra parens when looking for casts. - Change the location info to point at the cast (instead of the assignment). For example, on int *b; #define a ((void*) b) void f0() { a = 10; } we now emit: /tmp/t.c:4:3: error: assignment to cast is illegal, lvalue casts are not supported a = 10; ^ ~ /tmp/t.c:2:12: note: instantiated from: #define a ((void*) b) ~^~~~~~~~~~ instead of: /tmp/t.c:4:5: error: expression is not assignable a = 10; ~ ^ llvm-svn: 69114
* Strip paren expressions when trying to diagnose "cast as lvalue"Daniel Dunbar2009-04-141-1/+1
| | | | | | extension. llvm-svn: 69100
* Make our diagnostics about the obsolete GNU designated-initializerDouglas Gregor2009-03-281-1/+1
| | | | | | | syntax into extension warnings, and provide code-modification hints showing how to fix the problem. llvm-svn: 67885
* use isa<>Chris Lattner2009-03-231-2/+2
| | | | llvm-svn: 67543
* Adjust isModifiableLvalue to give a slightly more useful diagnostic for Eli Friedman2009-03-221-10/+11
| | | | | | attempting to illegally modify a BlockDeclRefExpr. llvm-svn: 67491
* fix some warnings in release-assert mode.Chris Lattner2009-03-221-9/+9
| | | | llvm-svn: 67456
* When building the structured initializer list, pre-allocate storage inDouglas Gregor2009-03-201-0/+5
| | | | | | | | | | | its vectors based on the subobject type we're initializing and the (unstructured) initializer list. This eliminates some malloc thrashing when parsing initializers (from 117 vector reallocations down to 0 when parsing Cocoa.h). We can't always pre-allocate the right amount of storage, since designated initializers can cause us to initialize in non-predictable patterns. llvm-svn: 67421
* Destroy expressions properly when resizing an initializer listDouglas Gregor2009-03-201-1/+1
| | | | llvm-svn: 67417
* Almost complete implementation of rvalue references. One bug, and a few ↵Sebastian Redl2009-03-161-10/+8
| | | | | | unclear areas. Maybe Doug can shed some light on some of the fixmes. llvm-svn: 67059
* Add the ability to clone integer and string literals. Use it when ↵Anders Carlsson2009-03-151-1/+10
| | | | | | instantiating template expressions. llvm-svn: 67030
* Handle dependent types/exprs in static_assert expressions.Anders Carlsson2009-03-141-0/+1
| | | | llvm-svn: 66997
* Implement template instantiation for the prefix unary operators. AsDouglas Gregor2009-03-131-0/+30
| | | | | | | | always, refactored the existing logic to tease apart the parser action and the semantic analysis shared by the parser and template instantiation. llvm-svn: 66987
* Refactor the way we handle operator overloading and templateDouglas Gregor2009-03-131-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | instantiation for binary operators. This change moves most of the operator-overloading code from the parser action ActOnBinOp to a new, parser-independent semantic checking routine CreateOverloadedBinOp. Of particular importance is the fact that CreateOverloadedBinOp does *not* perform any name lookup based on the current parsing context (it doesn't take a Scope*), since it has to be usable during template instantiation, when there is no scope information. Rather, it takes a pre-computed set of functions that are visible from the context or via argument-dependent lookup, and adds to that set any member operators and built-in operator candidates. The set of functions is computed in the parser action ActOnBinOp based on the current context (both operator name lookup and argument-dependent lookup). Within a template, the set computed by ActOnBinOp is saved within the type-dependent AST node and is augmented with the results of argument-dependent name lookup at instantiation time (see TemplateExprInstantiator::VisitCXXOperatorCallExpr). Sadly, we can't fully test this yet. I'll follow up with template instantiation for sizeof so that the real fun can begin. llvm-svn: 66923
* add a helper function to strip noop casts.Chris Lattner2009-03-131-0/+34
| | | | llvm-svn: 66909
* Eliminate some unused default cases in switches on the binary operator kindDouglas Gregor2009-03-121-1/+4
| | | | llvm-svn: 66837
* Eliminate CXXClassVarDecl. It doesn't add anythingDouglas Gregor2009-03-111-1/+1
| | | | llvm-svn: 66696
* Minor cleanup for choose expressions: add a helper that returns the Eli Friedman2009-03-041-8/+2
| | | | | | chosen sub-expression, rather than just evaluating the condition. llvm-svn: 66018
* Change the AST generated for offsetof a bit so that it looks like a Eli Friedman2009-02-271-43/+0
| | | | | | | | normal expression, and change Evaluate and IRGen to evaluate it like a normal expression. This simplifies the code significantly, and fixes PR3396. llvm-svn: 65622
* Make isICE assert when Evaluate can't evaluate an ICE, as suggested byEli Friedman2009-02-271-26/+58
| | | | | | | Daniel. Some minor fixes/cleanup. Allow __builtin_choose_expr, __real__, and __imag__ in ICEs, following gcc's example. llvm-svn: 65610
* The middle operand in ?: is optional, really.Mike Stump2009-02-271-1/+1
| | | | llvm-svn: 65609
* Rewrite of isIntegerConstantExpr to be centered around Evaluate. This Eli Friedman2009-02-261-326/+172
| | | | | | | | | | | | | | | | | | | | | | | is a rather big change, but I think this is the direction we want to go; the code is significantly shorter now, and it doesn't duplicate Evaluate code. There shouldn't be any visible changes as far as I know. There has been some movement towards putting ICE handling into Evaluate (for example, VerifyIntegerConstantExpression uses Evaluate instead of isICE). This patch is sort of the opposite of the approach, making ICE handling work without Evaluate being aware of it. I think this approach is better because it separates the code that does the constant evaluation from code that's calculating a rather arbitrary predicate. The one thing I don't really like about this patch is that the handling of commas in C99 complicates it signficantly. (Seriously, what was the standards committee thinking when they wrote that part?) I think I've come up with a decent approach, but it doesn't feel ideal. I might add some way to check for evaluated commas from Evaluate in a subsequent patch; that said, it might not be worth bothering. llvm-svn: 65524
* first wave of fixes for @encode sema support. This is part of PR3648.Chris Lattner2009-02-241-1/+3
| | | | | | | The big difference here is that (like string literal) @encode has array type, not pointer type. llvm-svn: 65391
* We should not generate __weak write barrier on indirect referenceFariborz Jahanian2009-02-231-0/+2
| | | | | | | of a pointer to object; This patch does this odd behavior according to gcc. llvm-svn: 65334
* More objc gc work. Match gcc's treatment of ivar accessFariborz Jahanian2009-02-221-0/+27
| | | | | | | true a local pointer to objective-c object in generating write barriers. llvm-svn: 65290
* Improvements to ASTContext::getDeclAlignInBytes; fixes the testcase in Eli Friedman2009-02-221-20/+7
| | | | | | | | | PR3254 and part of PR3433. The isICE changes are necessary to keep the computed results consistent with Evaluate. llvm-svn: 65258
* A few small tweaks to isConstantInitializer. (No test because this Eli Friedman2009-02-201-3/+9
| | | | | | isn't getting used by Sema or CodeGen at the moment...) llvm-svn: 65107
* rip out __builtin_overloadChris Lattner2009-02-181-12/+0
| | | | llvm-svn: 64961
* teach child iterators to walk into the child string of an ObjCStringLiteral,Chris Lattner2009-02-181-2/+2
| | | | | | so it shows up in -ast-dump. llvm-svn: 64901
* privatize all of the string literal memory allocation/creationChris Lattner2009-02-181-47/+21
| | | | | | stuff behind a private static function. llvm-svn: 64898
* change the StringLiteral AST node to track all of the SourceLocations of Chris Lattner2009-02-181-6/+22
| | | | | | | | the various PPTokens that are pasted together to make it. In the course of working on this, I discovered ParseObjCStringLiteral which needs some work. I'll tackle it next. llvm-svn: 64892
* isICE was evaluating ?: incorrectly with missing-gcc-LHS extension.Daniel Dunbar2009-02-181-3/+16
| | | | | | | Add assert to isICE that, on success, result must be the same as EvaluateAsInt()... this enforces a minimum level of sanity. llvm-svn: 64865
* Convert isIntegerConstantExpr to use ASTContext::MakeIntValue. Daniel Dunbar2009-02-181-39/+29
| | | | | | | | | | | | | | | - This idiom ensures that the result will have the right width and type. - Tested on most of x86_64/llvm-test to satisfy my paranoia. - This fixes at least the following bugs: o UnaryTypeTraitExpr wasn't setting the width correctly. o Arithmetic on _Bool wasn't setting the width correctly. And probably a number more. llvm-svn: 64864
* Rename UnaryTypeTraitExpr::Evaluate to EvaluateTrait to not collideDaniel Dunbar2009-02-171-1/+1
| | | | | | with Expr::Evaluate(). llvm-svn: 64850
* Unbreak clang.Daniel Dunbar2009-02-161-1/+1
| | | | | | | | Doug: please verify that it is expected that LastIdx can be less that NumInits. And perhaps add a comment so that Chris doesn't break your code. :) llvm-svn: 64688
* fix long lines.Chris Lattner2009-02-161-8/+12
| | | | llvm-svn: 64684
* introduce and use a new ExtVectorElementExpr::isArrow method, at Eli's ↵Chris Lattner2009-02-161-0/+6
| | | | | | suggestion llvm-svn: 64681
* Add hook to add attributes to function declarations that we knowDouglas Gregor2009-02-141-4/+4
| | | | | | | | | | | | | | | | 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
* Several related changes: Chris Lattner2009-02-141-38/+103
| | | | | | | | | | | | | | | 1) implement parser and sema support for reading and verifying attribute(warnunusedresult). 2) rename hasLocalSideEffect to isUnusedResultAWarning, inverting the sense of its result. 3) extend isUnusedResultAWarning to directly return the loc and range info that should be reported to the user. Make it substantially more precise in some cases than what was previously reported. 4) teach isUnusedResultAWarning about CallExpr to decls that are pure/const/warnunusedresult, fixing a fixme. 5) change warn_attribute_wrong_decl_type to not pass in english strings, instead, pass in integers and use %select. llvm-svn: 64543
* Implicitly declare certain C library functions (malloc, strcpy, memmove,Douglas Gregor2009-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | etc.) when we perform name lookup on them. This ensures that we produce the correct signature for these functions, which has two practical impacts: 1) When we're supporting the "implicit function declaration" feature of C99, these functions will be implicitly declared with the right signature rather than as a function returning "int" with no prototype. See PR3541 for the reason why this is important (hint: GCC always predeclares these functions). 2) If users attempt to redeclare one of these library functions with an incompatible signature, we produce a hard error. This patch does a little bit of work to give reasonable error messages. For example, when we hit case #1 we complain that we're implicitly declaring this function with a specific signature, and then we give a note that asks the user to include the appropriate header (e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In case #2, we show the type of the implicit builtin that was incorrectly declared, so the user can see the problem. We could do better here: for example, when displaying this latter error message we say something like: 'strcpy' was implicitly declared here with type 'char *(char *, char const *)' but we should really print out a fake code line showing the declaration, like this: 'strcpy' was implicitly declared here as: char *strcpy(char *, char const *) This would also be good for printing built-in candidates with C++ operator overloading. The set of C library functions supported by this patch includes all functions from the C99 specification's <stdlib.h> and <string.h> that (a) are predefined by GCC and (b) have signatures that could cause codegen issues if they are treated as functions with no prototype returning and int. Future work could extend this set of functions to other C library functions that we know about. llvm-svn: 64504
* Fix va_arg bug noticed by Eli, __builtin_va_arg is not an l-valueDaniel Dunbar2009-02-121-1/+1
| | | | | | designating an object. llvm-svn: 64371
* CallExpr now uses ASTContext's allocate to allocate/delete its array of ↵Ted Kremenek2009-02-091-5/+16
| | | | | | subexpressions. llvm-svn: 64162
* Deallocate the StringLiteral itself in StringLiteral::Destroy() and ↵Ted Kremenek2009-02-091-1/+2
| | | | | | deallocate the string data before running StringLiteral's destructor. llvm-svn: 64146
* Allocate the subexpression array for OberloadExpr from ASTContext's allocator.Ted Kremenek2009-02-091-0/+7
| | | | llvm-svn: 64145
OpenPOWER on IntegriCloud