aboutsummaryrefslogtreecommitdiff
path: root/AST/Expr.cpp
AgeCommit message (Collapse)Author
2008-03-15Make a major restructuring of the clang tree: introduce a top-levelChris Lattner
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05remove the source location arguments to various target query methods.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47954 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27Removed VarDecl::hasStaticStorage() (redundant with hasGlobalStorage())Ted Kremenek
Removed VarDecl::hasAutoStorage() (only used by hasLocalStorage()) Merged logic from VarDecl::hasAutoStorage() into VarDecl::hasLocalStorage(), and expanded (fixed) the logic of hasLocalStorage() to handle Extern and PrivateExtern. Renamed Expr::hasStaticStorage() to Expr::hasGlobalStorage(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47681 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21implement codegen support for sizeof(void), fixing PR2080.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20Alternate address spaces work:Chris Lattner
rename QualType::getQualifiers to getCVRQualifiers. Add some fixme's and clean up some code relevant to qualifiers. Change ASQualType to contain a Type* instead of a QualType. Any CVR qualifiers should be on the outer qual type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18Tweak fix for http://llvm.org/bugs/show_bug.cgi?id=2000 to work across typedefs.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18Fix bug where we would report the wrong value for __alignof__ with an expr ↵Anders Carlsson
that is not a type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-16Make sizeof and __alignof work correctly with packed structs.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47202 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15Remove useless parameter from isConstantSizeType.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47156 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13Fix a minor bug in isNullPointerConstant triggered by the linux Eli Friedman
tgmath.h. Note that there is another issue with tgmath.h, so mandel.c still doesn't work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13Move IgnoreParenCasts to be a method on Expr.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47040 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10Refine bug fix to Expr::isLvalue (commit r46917).Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46919 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10Change Expr::isLvalue() to allow the "void" type. This fixes bz2000 ↵Steve Naroff
submitted by Neil Booth. Neil, can you point me to the place in the C99 spec that says this is allowed? I thought Expr::isLvalue() conformed to the spec, which says "C99 6.3.2.1: an lvalue is an expression with an object type or an incomplete type other than void.". Please advise. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31Make CallExpr::isBuiltinConstantExpr slightly more efficient.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46594 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31Add support for CallExpr::isBuiltinConstantExpr(). For now, this hook is ↵Steve Naroff
used to support CFConstantStrings. Can be extended to support other built-in functions. This allows the following code to compile without error... #include <CoreFoundation/CoreFoundation.h> #define CONST_STRING_DECL(S, V) const CFStringRef S = (const CFStringRef)__builtin___CFStringMakeConstantString(V); CONST_STRING_DECL(kCFTimeZoneSystemTimeZoneDidChangeNotification, "kCFTimeZoneSystemTimeZoneDidChangeNotification") git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30Implement first round of feedback on __builtin_overloadNate Begeman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29Implement __builtin_offsetof.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46515 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25fix isIntegerConstantExpr evaluation of unary !.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25Support checking and codegen of constant vector globalsNate Begeman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17Implement basic overload support via a new builtin, __builtin_overload.Nate Begeman
__builtin_overload takes 2 or more arguments: 0) a non-zero constant-expr for the number of arguments the overloaded functions will take 1) the arguments to pass to the matching overloaded function 2) a list of functions to match. The return type of __builtin_overload is inferred from the function whose args match the types of the arguments passed to the builtin. For example: float a; float sinf(float); int sini(int); float b = __builtin_overload(1, a, sini, sinf); Says that we are overloading functions that take one argument, and trying to pass an argument of the same type as 'a'. sini() does not match since it takes and argument of type int. sinf does match, so at codegen time this will turn into float b = sinf(a); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46132 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17Added method Expr::IgnoreParens(), which returns the first non-ParenExpr Expr*.Ted Kremenek
Refactored the use of this method into both the Sema module and Analysis module, which were using their own static functions that did the same thing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14Record if a compound literal expression is @ file scope. This allows us to ↵Steve Naroff
implement C99 6.5.2.5p6. This could have been done without modifying the AST (by checking the decl type and passing the info down to isContextExpr), however we concluded this is more desirable. Bug/patch by Eli Friedman! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45966 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14Revert r45951, Chris says it violates the C99 spec.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45961 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14Rewrite Expr::isNullPointerConstant() to deal with multiple levels of ↵Steve Naroff
explicit casts. Now, isNullPointerConstant() will return true for the following: "(void*)(double*)0" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12Fix the type of predefined identifiers like __func__. Patch byChris Lattner
Eli Friedman! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45906 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10- Teach Expr::isConstantExpr() about InitListExpr's (and offsetof, since I ↵Steve Naroff
noticed it was missing). - Rename CheckInitializer() to CheckInitializerTypes(). - Removed the isStatic argument to CheckInitializerTypes() and all of it's subroutines. Checking for constant expressions is now done separately. - Added CheckForConstantInitializer(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45840 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09Fix isIntegerConstantExpr to compare against zero for casts to bool instead ofChris Lattner
truncating. This allows us to compile: void foo() { static _Bool foo = 4; } into: @foo1 = internal global i8 1 instead of: @foo1 = internal global i8 4 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09Teach Expr::isConstantExpr() about CompoundLiterals.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07Substituted all instances of the string "Objc" for "ObjC". This fixesTed Kremenek
some naming inconsistencies in the names of classes pertaining to Objective-C support in clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02Fix PR1895: a crash on an ugly gcc extension.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45505 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29Don't attribute in file headers anymore. See llvmdev for theChris Lattner
discussion of this change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45410 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-28Add accessors + iterator interface.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45378 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18Fix the location we emit the "not a constant" error for this:Chris Lattner
int foo() { typedef int x[foo()]; static int y = sizeof(x); } previously we'd emit it on the typedef, which made not sense at all. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45154 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17Fixed another case where sizeof() returns the size in bytes, not bits.Ted Kremenek
This parallels a previous patch (duplicate logic caused the bug to appear in multiple locations): r44316 (http://llvm.org/viewvc/llvm-project?rev=44316&view=rev). Patch provided by Nuno Lopes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45098 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-15Removed "isSizeOfExpr" mode from StmtIterator. It turned out not to beTed Kremenek
so useful and introduced a few bugs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45051 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14Added "mode" to StmtIterator to record if the expression being iteratedTed Kremenek
over is the subexpression of a sizeof(expression). Different clients will wish to handle iteration over such subexpressions differently, and can now easily query if they are iterating over such statements using the StmtIterator's inSizeOfExpr(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45047 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14Added support to StmtIterator to traverse the size expression of a VLA typeTed Kremenek
declared in a sizeof. For example: sizeof(int[foo()]); the expression "foo()" is an expression that is executed during the evaluation of sizeof. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45043 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12TargetInfo no longer includes a reference to SourceManager.Ted Kremenek
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation. Added many utility methods to FullSourceLoc to provide shorthand for: FullLoc.getManager().someMethod(FullLoc.getLocation()); instead we have: FullLoc.someMethod(); Modified TextDiagnostics (and related classes) to use this short-hand. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44957 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11Fix a case where we'd return "is not a constant expr" withoutChris Lattner
return a location. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44889 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05Recognize CompoundLiteralExpr's as valid lvalue's.Steve Naroff
Also updated a FIXME in Sema::CheckInitializer()... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44602 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01Compute side-effect for conditional expression.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44492 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01make the unused expression warning less noisy by not warning about comma ↵Chris Lattner
exprs whose LHS and RHS both have side effects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44486 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30String literals are always valid LValues.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44472 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30GCC has an extension where the left hand side of the ? : operator can be ↵Anders Carlsson
omitted. Handle this in a few more places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44462 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28fix compilation error noticed by Nuno LopesChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44388 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27add several cases that Expr::hasStaticStorage missed, pointed out by Oliver HuntChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44376 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27sizeof is defined by bitsin(char) not by units of 8 bits.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44369 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25sizeof() return size in bytes, not bits, patch by Nuno Lopes!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44316 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15Finish up variadic methods/messages.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44172 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-13improve handling of address of global when checking forChris Lattner
constants and initializers. Patch by Sanghyeon Seo, thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44049 91177308-0d34-0410-b5e6-96231b3b80d8