aboutsummaryrefslogtreecommitdiff
path: root/Sema
AgeCommit message (Collapse)Author
2008-01-29AST for @synchronized.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46524 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29Tighten up ASTContext::typesAreCompatible()...it needs to make sure the ↵Steve Naroff
qualifiers match. The comment and C99 citation for this routine were correct...the code needed to conform to the comment/spec. This fixes the test added below. Tightening up this routine forced tweaks to Sema::CheckSubtractionOperands() and Sema::CheckCompareOperands(). For example, they both need to operate on the unqualified pointee... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46522 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29Use the canonical type when comparing array types so the comparison Eli Friedman
doesn't get confused by typedefs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29Tweak Sema::DefaultArgumentPromotion() to call UsualUnaryConversions(). This ↵Steve Naroff
makes sure function calls that don't have a prototype get the default function/array conversion. Patch by Eli Friedman! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46489 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28Implement "private extern" on function decls!Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46464 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28Fix a bug with struct initializers (in Sema::CheckInitializerListTypes()). Steve Naroff
Test case included from bz1948 (thanks Neil!). Also fixed an 80 column violation... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46430 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25Add more support for Apple's "private extern" extension...Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25Diagnose bad receiver type.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46358 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25Replace Sema::CheckVariableInitList, CheckConstantInitList, and ↵Steve Naroff
CheckForCharArrayInitializer with CheckInitializerListTypes. The new routine now supports struct/union initializers. This is a modified version of a patch by Eli Friedman. This version passes all of the clang tests and supports vectors:-) Note that Eli and I are still unsatisfied the implementation of CheckInitializerListTypes(). We'd like to find a more elegant implementation. Nevertheless, this is a complex part of the standard (and may be hard to simplify). Since the complexity is localized to this routine, we can iterate without too much disruption:-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25Fix a bug recovering from broken code with a goto that Eli reported.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46336 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24Exclude vectors from Type::isScalar() predicate.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22- Add Sema::CheckStringLiteralInit, Sema::IsStringLiteralInit.Steve Naroff
- Use previous hooks to simplify Sema::CheckInitializerTypes()... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46235 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21Sema::CheckInitializerTypes(). Start simpliying and cleaning up...Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21Elimate bogus warning when va_start is correctly used inFariborz Jahanian
a method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46232 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18Sema::FinalizeDeclaratorGroup(): Tighten up the tentative definition rule ↵Steve Naroff
when dealing with arrays. Bug submitted by Eli. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18Sema::FinalizeDeclaratorGroup()...make sure we emit an diagnostic for ↵Steve Naroff
tentative definitions with incomplete types. Touch up all test cases that are effected. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46152 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17Don't ICE on missing interface declaration when declaring one of its protocols.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17Fixed typo introduced by r46133 that caused -Wfloat-equal to break.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46134 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-17Renamed getSynthesizedSelectorSize to getSynthesizedMethodSize. Compute ↵Fariborz Jahanian
method name size in accordance with how rewriter synthesizes method name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46131 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-17Computed length of a __func__ identifier used in an objective-c method ↵Fariborz Jahanian
correctly, when creating its type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16Move promoteExprToType from being a static method in SemaExpr.cpp to beingChris Lattner
a method named ImpCastExprToType in Sema. Use this method to insert implicit casts for case statements from their operand type to the condition type of the switch. This fixes a crash on test/CodeGen/statements.c, reported by Eli Friedman. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16Sema::MergeFunctionDecl()...make sure diagnostic is accurate (wrt function ↵Steve Naroff
declarations/definitions). Patch by Carl Lewis! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46070 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15Finish up handling all permutations of "complex int" (in ↵Steve Naroff
Sema::UsualArithmeticConversions()). A FIXME remains to verify the conversion rules are consistent with GCC. Thanks to Eli for the new/improved test case... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15- Change Type::isComplexType() to exlude GCC's complex integer extension. In ↵Steve Naroff
general, we will keep the lowest level Type predicates "pure" (i.e. true to the C99 spec). - Modify Sema::UsualArithmeticConversions() to work with the new definition of Type::isComplexType(). This is a nice cleanup and also fixes a bug submitted by Eli (which I've added to the test suite). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46005 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15Rework commit r45976, which was incorrect.Steve Naroff
- Add Type::isComplexIntegerType(), Type::getAsComplexIntegerType(). - Don't inlude complex types with Type::isIntegerType(), which is too general. - Use the new predicates in Sema::UsualArithmeticConversions() to recognize/convert the types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45992 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14Make sure Sema::GetTypeForDeclarator() deals with abstract declarators when ↵Steve Naroff
diagnosing incorrect code. Bug submitted by Eli. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45989 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14Fix build issue on cygwin, patch by Sam BishopChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45977 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14Fix crasher when redefining functions. Not 100% pleased with this solution, ↵Steve Naroff
but it is clearly an improvement. Will discuss with Chris later. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45975 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-13Change Sema::CheckAddressOfOperation() to respect C99-only addressof rules.Steve Naroff
Remove diagnostics from Sema::CheckIndirectionOperand(). C89/C99 allow dereferencing an incomplete type. clang appears to be emulating some incorrect gcc behavior (see below). void foo (void) { struct b; struct b* x = 0; struct b* y = &*x; // gcc produces an error ("dereferencing pointer to incomplete type") } With this patch, the above is now allowed. Bug/Patch by Eli Friedman! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12allow __func__ in objc methods.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45915 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12Tighten up handling of __func__ and friends: it should be an arrayChris Lattner
of const char, and it should error if it occurs outside a function. Is it valid in an objc method? If so we should handle that too. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45910 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-12Add first pieces of support for parsing and representing Chris Lattner
extern "C" in C++ mode. Patch by Mike Stump! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45904 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-10Recover from user typo not having proper @interface decl and a bad foreach decl.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45839 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10Allow messaging expression as foreach's collection expression.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09Fix Sema::ActOnDeclarator() to call MergeFunctionDecl for function decls ↵Steve Naroff
that aren't in scope. Since C functions are in a flat namespace, we need to give them special treatment (when compared with variables and typedefs). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45789 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09Fix ASTContext::typesAreCompatible to allow for int/enum compatibility (C99 ↵Steve Naroff
6.7.2.2p4). Fix Sema::MergeFunctionDecl to allow for function type compatibility (by using the predicate on ASTContext). Function types don't have to be identical to be compatible... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09Teach Sema::ActOnCompoundLiteral about constraint C99 6.5.2.5p3.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45782 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08Fix Sema::CheckConditionalOperands(). The null pointer constant checks need ↵Steve Naroff
to precede the check for two pointer operands. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45732 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-07Limit type of foreach's element and collection to be a pointer to Fariborz Jahanian
objc object type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07Issue diagnostics if more than one declaration in objectove-c's foreach-stmt ↵Fariborz Jahanian
header. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07minor cleanup.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06rearrange some code.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06some simplifications/cleanups to ?: sema.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45665 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06Emit warnings like "dereferencing void pointer" instead of trying to Chris Lattner
pretty print the type name for void. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45664 91177308-0d34-0410-b5e6-96231b3b80d8