aboutsummaryrefslogtreecommitdiff
path: root/Sema
AgeCommit message (Collapse)Author
2007-12-16Sema::ActOnMemberReferenceExpr() needs to perform the default conversions.Steve Naroff
Bug and test case provided by Carl Lewis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45078 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14- Remove getInstanceMethods/getClassMethods API on ObjcInterfaceDecl, ↵Steve Naroff
ObjcProtocolDecl, and ObjcCategoryDecl. These methods are replaced by the respective iterators on each class. - Add getInstanceMethodForSelector to ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCatgoryDecl. This hook will do a "shallow" lookup. This is a convenience method that reducing some of the iterator usage. - Various changes to convert all clients to the above API's... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45046 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13Patch to make ObjcQualifiedInterfaceType inherit ObjcInterfaceTypeFariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45014 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13Sema::ActOnFinishFunctionBody(): Since we no longer synthesize a ↵Steve Naroff
FunctionDecl for each method, remove the unconditional initialization to 0 and corresponding comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45008 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13Don't do integer promotions of LHS for compound shift assignment. The LHS ↵Chris Lattner
has to be a modifiable lvalue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44993 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12Concatenation of objc strings.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44964 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-12make it a bit more clear in what way the ivar is consistent.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44945 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12simplify some code, bump j. This fixes the remaining test failures.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44941 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12unbreak the build. I'm still working on test failures.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44938 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12split objc pieces of SemaDecl.cpp out into SemaDeclObjC.cppChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44925 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12implement correct semantic analysis for shifts. For:Chris Lattner
int test(int x, long long y) { return x << y; } we now realize the type of the shift is int, not long long. This fixes a fixme from june. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44912 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12Add ObjC parser support for concatenated ObjC strings. Note thatChris Lattner
this is passed to sema and ignored there, so the second part of the string will not make it into the AST. Passing to Fariborz to finish Sema + AST construction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44898 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11simplify code now that isConstantExpr really does alwaysChris Lattner
return a loc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44890 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. NowTed Kremenek
SourceManager is passed by reference, allowing the SourceManager to be associated with a specific translation unit, and not the entire execution of the driver. Modified all users of Diagnostics to comply with this new interface. Integrated SourceManager as a member variable of TargetInfo. TargetInfo will eventually be associated with a single translation unit (just like SourceManager). Made the SourceManager reference in ASTContext private. Provided accessor getSourceManager() for clients to use instead. Modified clients to comply with new interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44878 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11For @optional unimplemented methods do not issue the warning.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44872 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11Avoid the first person in a recently added comment. Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44843 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11Change err_undef_protocolref to warn_undef_protocolref (this is consistent ↵Steve Naroff
with GCC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44840 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11Explicitly set the string literal type from "char *" to "constant array of ↵Steve Naroff
char". At this point, I am fairly certain the front-end is correct. Unfortunately, the back-end is still unhappy. That said, I've commented out the two lines in globalinit.c that are causing problems. Chris, please have a look...thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44823 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10Add support for initializing char arrays from string literals.Steve Naroff
Adapted from a patch by Anders Carlsson. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44816 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09Implement correct semantic analysis of subtractions, implementingChris Lattner
C99 6.5.6. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44746 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07Implemented when static typing is combined with protocols and use as receiverFariborz Jahanian
type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44685 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07Have Sema::CheckConstantInitList skip semantic analysis when the element ↵Steve Naroff
type is a record (until we implement the FIXME). This removes a bogus error for the following code... snarofflocal% cat bug.m #import <Foundation/NSGeometry.h> #define NUMHELICOPTERRECTS 5 static NSRect helicopterRects[NUMHELICOPTERRECTS] = { {{27, 0}, {18, 11}}, // Bottom {{0, 8}, {4, 11}}, // Tail {{0, 16}, {50, 1}}, {{22, 5}, {18, 12}}, // Body {{0, 10}, {42, 3}} }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44684 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07Lookup methods in the global pool even when a statically typed object's ↵Steve Naroff
class interface isn't in scope! As the comment in the code indicates, I'm not fond of this. Nevertheless, gcc compat is a goal. Here is the case I'm talking about... #import <Foundation/Foundation.h> @interface AnyClass : NSObject - (NSRect)rect; @end @class Helicopter; static void func(Helicopter *obj) { NSRect r = [obj rect]; } ...before this patch, we would warn/error. With this patch, everything "just works". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44682 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07Rewrite 'super' within a class method. This required some minor tweaks to ↵Steve Naroff
the front-end. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44673 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07Patch to implement "Protocol" as a built-in type declared asFariborz Jahanian
"@class Protocol;" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44670 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06Add workaround to get test/Parser/compound_literal.c working again.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44666 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06On Steve's suggestion, moved handling of use of undeclared method in a messageFariborz Jahanian
to rewriter (my previous patch). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44665 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06A missing method in a messaging expression issues a warning, clients must not Fariborz Jahanian
crash because of this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44648 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05Patch to prevent crash on use of objc2 syntax.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44617 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05Add sema checking for compound literal expressions.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44605 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05Revert DidWarn change - It won't catch all cases anyway and GCC warns for ↵Anders Carlsson
every excess element. Maybe later we can add back the limit and make it smarter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44603 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-04Simplified setting up Method's scope before generating AST for its nody.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44576 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03Handle initializing vector elements correctly. Emit just one warning if ↵Anders Carlsson
there are excess initializers, instead of one per initializer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44525 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02restore these lines, which fixes some regtest failures.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44516 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02improve VC++ compatibility, patch by Cédric Venet.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44496 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30Initialize CurMethodDecl to 0.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44463 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-30Support lax vector conversions.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44449 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29Yesterday, I simplified how we stream top-level decls.Steve Naroff
After a discussion with Ted, we both came to the conclusion that adding a "HandleTopLevelDeclaration" hook to ASConsumer is far more elegant. The default implementation of HandleTopLevelDeclaration will be responsible for iterating over the ScopedDecl (which has a chain of the decls:-). TODO: Once Ted adds HandleTopLevelDeclaration, make sure TagDecls are chainged appropriately... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44445 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29Update the initializer's type, in addition to the decl, if we've changed the ↵Christopher Lamb
type of the decl based on it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44440 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29Enhanced implementation of -Wfloat-equal to check for comparisons againstTed Kremenek
floating-point literals that are represented exactly by the APFloat in FloatingLiteral. For such literals, we do not emit a warning since such checks are often performed in real code to see if a variable has changed from its original value. This heuristic clearly can lead to false negatives, but the hope is it will significantly reduce false positives to help make the compiler flag more useful. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44424 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29Added "isExact" field to FloatingLiteral. This flag indicates whether or notTed Kremenek
the APFloat representing the parsed literal can represent the literal value exactly. This is useful when performing various semantic checks on the code, and issuing appropriate warnings to users. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44423 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28Several fixes/simplifications surrounding how we stream top-level decl AST's.Steve Naroff
The following code... typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR; struct Y { int A; }; struct X { int A; } D; struct X E, F; ...now produces the following output... > ../../Debug/bin/clang xx.c -ast-print Read top-level tag decl: 'cssm_data' typedef struct cssm_data CSSM_DATA; typedef struct cssm_data *CSSM_DATA_PTR; Read top-level tag decl: 'Y' Read top-level tag decl: 'X' Read top-level variable decl: 'D' Read top-level variable decl: 'E' Read top-level variable decl: 'F' ...which is much more accurate than the previous -ast-print output... typedef struct cssm_data CSSM_DATA; typedef struct cssm_data CSSM_DATA; Read top-level variable decl: 'D' Read top-level variable decl: 'E' Read top-level variable decl: 'E' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44421 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28Fix a bug checking for 'int foo(void)' that didn't look through typedefs of ↵Chris Lattner
void. Bug pointed out by Michael Zolda, thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27Set loc earlier in CheckSingleInitializer to avoid emitting a Chris Lattner
diagnostic without a location. This produces: simpleTest.c:2:18: error: initializer element is not constant int *myPointer = &(myArray[2]); ^~~~~~~~~~~~~ instead of: error: initializer element is not constant git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44375 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27Move the null pointer constant check from ↵Steve Naroff
Sema::CheckSingleInitializer/ActOnCallExpr/CheckMessageArgumentTypes/ActOnReturnStmt to Sema::CheckSingleAssignmentConstraints. This makes sure all null pointer assignments are considered compatible. Thanks to Seo Sanghyeon for the bug, follow-through, and patch! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44366 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27handle __vector_size__ like vector_sizeChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27Add comment to CheckVectorCast.hAnders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44356 91177308-0d34-0410-b5e6-96231b3b80d8