Commit Graph

5899 Commits

Author SHA1 Message Date
Ted Kremenek a8b8ce499a Add range highlighting for path-sensitive return-of-stack-address check.
llvm-svn: 54219
2008-07-30 17:49:12 +00:00
Daniel Dunbar e49df9b58f Change CodeGenModule GlobalDeclMap to directly reference globals
instead of mapping the decl to a bitcast of the global to the correct
type.
 
 - GetAddrOf{Function,GlobalVar} introduce the bitcast on every use now.

 - This solves a problem where a dangling pointer could be introduced
   by the RAUW done when replacing a forward or tentative
   definition. See testcase for more details.

 - Fixes <rdar://problem/6108358>

llvm-svn: 54211
2008-07-30 16:32:24 +00:00
Ted Kremenek 8cf5045012 Fix regression in range highlighting in HTML output.
llvm-svn: 54181
2008-07-29 23:35:38 +00:00
Daniel Dunbar 9c426524f8 Rework codegen emission of globals
- No (intended) functionality change.

 - Primary purpose is to clearly separate (lazy) construction of
   globals that are a forward declaration or tentative definition from
   those that are the final definition.

 - Lazy construction is now encapsulated in
   GetAddrOf{Function,GlobalVar} while final definitions are
   constructed in EmitGlobal{Function,Var}Definition.
 
 - External interface for dealing with globals is now limited to
   EmitGlobal and GetAddrOf{Function,GlobalVar}.

 - Also updated helper functions dealing with statics, annotations,
   and ctors to be private.

llvm-svn: 54179
2008-07-29 23:18:29 +00:00
Steve Naroff 873bd8497a Fix incomplete implementation for rewriting protocol refs.
<rdar://problem/6108127> clang ObjC rewriter: no translation of id <proto>

llvm-svn: 54163
2008-07-29 18:15:38 +00:00
Daniel Dunbar 837fd272f8 Fix codegen of chained declarations
- Killed useless CodeGenModule::EmitGlobalVarDeclarator, instead just
   recurse on any ScopedDecl.
 - Fix for <rdar://problem/6093838>

llvm-svn: 54162
2008-07-29 17:47:36 +00:00
Chris Lattner 373351725f add a crazy idea
llvm-svn: 54151
2008-07-29 03:46:33 +00:00
Chris Lattner 03bc8c0ab8 fix tag
llvm-svn: 54121
2008-07-27 06:13:09 +00:00
Chris Lattner e8c687f05a list delta and distcc.
llvm-svn: 54120
2008-07-27 06:10:19 +00:00
Eli Friedman bd84059cdb Minor tweak plus a couple of FIXMEs.
llvm-svn: 54119
2008-07-27 05:46:18 +00:00
Eli Friedman d7a9a46cb5 Remove bashism; sh != bash on Ubuntu.
llvm-svn: 54118
2008-07-27 05:05:07 +00:00
Ted Kremenek 192510920e Fix serialization for TypedefType by allowing TypedefType to access the internal CanonicalType stored in Type.
The test case Serialization/stmt_exprs.c now passes.

llvm-svn: 54117
2008-07-27 03:47:53 +00:00
Chris Lattner 872eb55f5e make "call foo.dump()" and "call foo->dump()" work in GDB,
with QualTypes and Types.

llvm-svn: 54116
2008-07-27 00:48:22 +00:00
Chris Lattner e80159da05 remove QualType::getCanonicalType. Also make
QualType::ReadBackpatch public so that FieldDecl doesn't need
to be a friend of QualType.

llvm-svn: 54115
2008-07-27 00:06:09 +00:00
Chris Lattner 35ffe331b9 remove two uses of getCanonicalType I missed.
llvm-svn: 54114
2008-07-27 00:05:05 +00:00
Chris Lattner 613fdff902 clean up the footer a bit more.
llvm-svn: 54113
2008-07-26 23:54:49 +00:00
Chris Lattner e3bbfffa5b remove SSIs.
llvm-svn: 54112
2008-07-26 23:52:26 +00:00
Chris Lattner 9213f5d947 Add the right path to the lines image.
llvm-svn: 54111
2008-07-26 23:51:08 +00:00
Chris Lattner 7cb2da9d0b link to doxygen dox
llvm-svn: 54110
2008-07-26 23:45:57 +00:00
Chris Lattner 401cc23c4d Comment out the last call to QualType::getCanonicalType. This *breaks*
Serialization/stmt_exprs.c, but I don't know the right solution.  Will fix
when I get a chance to talk to Ted about it.

llvm-svn: 54109
2008-07-26 22:40:28 +00:00
Chris Lattner d9fa5d6a23 Fix a bug in my previous patch, CGF is not valid for constants outside a function
llvm-svn: 54108
2008-07-26 22:39:33 +00:00
Chris Lattner 0f398c4472 remove uses of QualType::getCanonicalType() from codegen for PR2189
llvm-svn: 54107
2008-07-26 22:37:01 +00:00
Chris Lattner 3f6cd0bc76 remove some unneeded calls to getCanonicalType
llvm-svn: 54106
2008-07-26 22:36:27 +00:00
Chris Lattner 574dee6cac change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)

llvm-svn: 54105
2008-07-26 22:17:49 +00:00
Chris Lattner 6fc6614c0d alphabeticalize a bit better.
llvm-svn: 54104
2008-07-26 22:09:09 +00:00
Daniel Dunbar 086fe1ac79 Add doxygen support
- Stolen from LLVM with minor modifications

llvm-svn: 54103
2008-07-26 21:32:24 +00:00
Chris Lattner 6731544be7 convert more code to use ASTContext to get canonical types instead
of doing it directly.  This is required for PR2189.

llvm-svn: 54102
2008-07-26 21:30:36 +00:00
Chris Lattner ac87ef5dcc remove a helper method.
llvm-svn: 54101
2008-07-26 20:50:02 +00:00
Chris Lattner 7e80097f6e implement codegen support for labels at the end of stmtexprs.
llvm-svn: 54100
2008-07-26 20:23:23 +00:00
Chris Lattner 6284378fcd minor tidying, no functionality change.
llvm-svn: 54099
2008-07-26 20:15:14 +00:00
Chris Lattner 944d306371 fix some problems handling stmtexprs with labels (PR2374), and
improve 'expression unused' diagnostics for stmtexprs.

llvm-svn: 54098
2008-07-26 19:51:01 +00:00
Chris Lattner 06afbebbdd fix an extraneous blank line in -ast-dump output.
llvm-svn: 54097
2008-07-26 19:24:43 +00:00
Chris Lattner bcf2e66b3c testcase for PR2416, which we already handle correctly.
llvm-svn: 54096
2008-07-26 19:15:11 +00:00
Ted Kremenek ef6378cda7 Remove some old text.
llvm-svn: 54095
2008-07-26 05:21:44 +00:00
Chris Lattner df59f5aa3c Pull protocol resolution of out ActOnStartClassInterface, this is also the
last client of the old ParseObjCProtocolReferences, so it also removes it.

llvm-svn: 54094
2008-07-26 04:13:19 +00:00
Chris Lattner b1f3c948ee refactor protocol resolution out of ActOnStartCategoryInterface
llvm-svn: 54093
2008-07-26 04:07:02 +00:00
Chris Lattner 3bbae00f50 pull protocol resolution out into ActOnStartProtocolInterface.
This temporarily duplicates ParseObjCProtocolReferences, but it
will be removed in the future.

llvm-svn: 54092
2008-07-26 04:03:38 +00:00
Chris Lattner 9c1842b612 simplify some code.
llvm-svn: 54091
2008-07-26 03:47:43 +00:00
Chris Lattner 908d39e45e remove duplicate error message.
llvm-svn: 54090
2008-07-26 03:40:25 +00:00
Chris Lattner 8b2ec166b8 < only starts a declspec in objc mode.
llvm-svn: 54089
2008-07-26 03:38:44 +00:00
Chris Lattner 12fd035d6f remove fixed fixme
llvm-svn: 54088
2008-07-26 01:56:46 +00:00
Chris Lattner bc76297674 make DeclSpec manage its own protocol qualifier list memory instead of having
clients allocate the memory and it delete it.

llvm-svn: 54087
2008-07-26 01:53:50 +00:00
Chris Lattner 16fac4f2ad Fix hte next wave of problems with protocol qualified ID:
1) reject stuff like "id<foo> short" and "<foo> short".  2) set
the declspec range correctly 3) only parse protocol qualifiers
when in objc mode.

llvm-svn: 54086
2008-07-26 01:18:38 +00:00
Chris Lattner 31236f8744 remove objc prefixes from these tests.
llvm-svn: 54085
2008-07-26 01:04:40 +00:00
Chris Lattner 89026888ef move all objc sema tests into a new SemaObjC directory. Next step is to
remove the objc- prefix from the tests that use it.

llvm-svn: 54084
2008-07-26 00:57:24 +00:00
Chris Lattner a075e63bbc fix several problems with the protocol qualified id handling where id was implicit.
First, fix canonical type handling of these, since protocol qualified id's are always
canonical.  Next, enhance SemaType to actually make these when used (instead of int)
allowing them to actually be used when appropriate.  Finally remove a bunch of logic
relating to the mishandling of canonical types with protocol-qual id's.  This fixes
rdar://5986251

llvm-svn: 54083
2008-07-26 00:46:50 +00:00
Chris Lattner 0974b2380f improve handling of the horrible GCC objc extension that treats "<foo>"
like "id<foo>".  This 1) fixes an infinite loop in the parser on things
like "short<foo>" 2) emits a warning about this bogus construct and 3)
changes the testcase to be substantially reduced.

llvm-svn: 54082
2008-07-26 00:20:22 +00:00
Chris Lattner 9acd2f1cd2 add a new diag helper that takes a range.
llvm-svn: 54081
2008-07-26 00:16:04 +00:00
Chris Lattner 0d70761cad GCC supports the complex conjugate operator (an extension) on complex int
as well as complex float. rdar://6097730

llvm-svn: 54080
2008-07-25 23:52:49 +00:00
Chris Lattner 8c217a81ac fix diagnostics.
llvm-svn: 54079
2008-07-25 23:41:08 +00:00
Chris Lattner 4591fd0aac Fix rdar://6103124, the only dummy blocks are ones without names. Named blocks
are important part of control flow structures.

llvm-svn: 54078
2008-07-25 23:40:10 +00:00
Ted Kremenek 0478105f7c Added project idea for a doxygen-like tool built using clang
llvm-svn: 54076
2008-07-25 23:34:29 +00:00
Chris Lattner 2841fc0e7b fix 80 col violation.
llvm-svn: 54075
2008-07-25 23:30:42 +00:00
Chris Lattner 903eb518e6 Fix rdar://6095136, various crashes with incomplete enum types.
llvm-svn: 54074
2008-07-25 23:18:17 +00:00
Chris Lattner 6bf59d82c8 minor cleanup
llvm-svn: 54073
2008-07-25 23:07:18 +00:00
Daniel Dunbar c9809a9d68 Remove unused ASTConsumer::HandleTopLevelDeclaration
llvm-svn: 54071
2008-07-25 22:39:30 +00:00
Chris Lattner 2ce500ffbe move a method.
llvm-svn: 54069
2008-07-25 22:25:12 +00:00
Chris Lattner bea82ff6ed Fix a couple bugs in aggregate cast processing: 1) fix precedecence
problem with &&/||.  2) use canonical types for comparison instead 
of raw types. 3) emit an ext-warn for a gnu extension.

Also simplify the code to make it less nested.

llvm-svn: 54068
2008-07-25 22:06:10 +00:00
Ted Kremenek 870f750434 Format string errors should underling the format string, not the function name.
llvm-svn: 54067
2008-07-25 22:03:03 +00:00
Chris Lattner 3f375d055e make sizeof/alignof diagnostics highlight their operand with a sourcerange.
llvm-svn: 54066
2008-07-25 21:45:37 +00:00
Chris Lattner 61f60a05b2 c89 does not perform array -> pointer promotion unless the array is an lvalue. This
is different than C99.  This fixes the rest of rdar://6095180.

llvm-svn: 54064
2008-07-25 21:33:13 +00:00
Chris Lattner 513165ecf3 move some code, no other change.
llvm-svn: 54063
2008-07-25 21:10:04 +00:00
Ted Kremenek e8f7bdc5cf Updated latest checker build.
llvm-svn: 54060
2008-07-25 21:05:04 +00:00
Daniel Dunbar b5586dad97 Fix long double test case
- Had wrong sizeof(long double) encoded into test case
 - Results now agree with llvm-gcc

llvm-svn: 54059
2008-07-25 20:54:30 +00:00
Chris Lattner f6e1e309c7 In c99 mode, comma does do function/array promotion even though
it does not do unary promotions (like short->int).

llvm-svn: 54058
2008-07-25 20:54:07 +00:00
Ted Kremenek 04350ebe4a Refine ObjCPropertyImplDecl:
- Remove a bunch of setXXX methods until we actually need them. This cleans up the
interface, and makes the object immutable until we have a reason to be mutable.

- Remove enum value OBJC_PR_IMPL_None since it was never used.

- Remove instance variable 'PropertyImplKind PropertyImplementation;'. This is
  not needed because we can tell if ObjCPropertyImplDecl represents @synthesize
  if 'ObjCPropertyDecl *PropertyDecl' is not null.

llvm-svn: 54055
2008-07-25 20:43:38 +00:00
Ted Kremenek 7fb92dbf47 Enabled 'unused ivars' check by default.
llvm-svn: 54052
2008-07-25 20:35:01 +00:00
Ted Kremenek e17c037f4f Remove '.' in expected warning
llvm-svn: 54051
2008-07-25 20:30:34 +00:00
Ted Kremenek d074ce47b6 Have the UnusedIvar check skip ivars with setters/getters created by @synthesize.
llvm-svn: 54050
2008-07-25 20:28:02 +00:00
Nate Begeman 448b0cb033 X86 builtin fixes
llvm-svn: 54049
2008-07-25 20:17:24 +00:00
Nate Begeman fe79ca2ab9 Generate vector compares in codegen
llvm-svn: 54048
2008-07-25 20:16:05 +00:00
Nate Begeman e7f45b2977 Move comment to match style
llvm-svn: 54047
2008-07-25 20:15:41 +00:00
Nate Begeman 8d161830d1 De-tabify
llvm-svn: 54046
2008-07-25 20:15:14 +00:00
Chris Lattner e174acc910 Comma does not perform unary promotions, rdar://6095180
llvm-svn: 54045
2008-07-25 20:02:29 +00:00
Chris Lattner e08e47ab2f gcc requires a semicolon at the end of an interface, unlike its extension for structs.
rdar://6095245.

llvm-svn: 54044
2008-07-25 19:54:55 +00:00
Steve Naroff e2177fbfdc Cleaunup Sema::ActOnClassMessage(). This commit:
(a) removes a bogus warning.
(b) removes an undesirable usage of the ObjCMessageExpr constructor that takes an IdentifierInfo * (which I will abolish).

llvm-svn: 54042
2008-07-25 19:39:00 +00:00
Chris Lattner f9c49e5d27 Reject typedef redefinitions when the underlying types are not identical,
even if in a system header etc.  rdar://6079937

llvm-svn: 54038
2008-07-25 18:44:27 +00:00
Chris Lattner 31614aeb0a update this testcase.
llvm-svn: 54037
2008-07-25 18:42:46 +00:00
Daniel Dunbar c481f72857 Add test case for hex floating point constants in < C99 mode
- For: rdar://6096838

llvm-svn: 54036
2008-07-25 18:41:57 +00:00
Chris Lattner c94ad4abcb In c89 mode accept hex fp constants as an extension:
t2.c:1:17: warning: hexadecimal floating constants are a C99 feature
long double d = 0x0.0000003ffffffff00000p-16357L;
                ^

instead of emitting a weird error message that doesn't make sense:

t2.c:1:41: error: hexadecimal floating constants require an exponent
long double d = 0x0.0000003ffffffff00000p-16357L;
                                        ^

rdar://6096838

llvm-svn: 54035
2008-07-25 18:18:34 +00:00
Ted Kremenek 83ec24501e Remove call to isSEL and isSEL itself since the call is dead (isObjCObjectPointerType() will never return true for selectors).
llvm-svn: 54034
2008-07-25 18:17:35 +00:00
Chris Lattner ec8996d771 Add support for __extension__ as an lvalue. rdar://6097308
llvm-svn: 54033
2008-07-25 18:07:19 +00:00
Steve Naroff 542cd5d3f9 Move fix in r54013 from the parser to sema.
llvm-svn: 54032
2008-07-25 17:57:26 +00:00
Ted Kremenek 2483730e3f Only warn about missing/incomplete -dealloc implementations when a class contains a non-SEL, non-IBOutlet ivar that references an ObjC object.
llvm-svn: 54024
2008-07-25 17:04:49 +00:00
Chris Lattner f08932928c comment out #pragma mark and #warning directives.
llvm-svn: 54020
2008-07-25 16:37:06 +00:00
Chris Lattner b9c34de5c4 rewrite handling of the raw token stream in -rewrite-macros to lex
everything up front into a vector.  This makes it easier to scan around
the stream when needed.

llvm-svn: 54019
2008-07-25 16:29:12 +00:00
Chris Lattner 3e3ff3e538 alphabeticalize
llvm-svn: 54018
2008-07-25 16:06:51 +00:00
Steve Naroff 29788347b2 Fix RewriteObjC::RewriteObjCThrowStmt() to respect whitespace between the @ and throw.
This fixes <rdar://problem/5988388> clang ObjC rewriter: mystery 'w' inserted in exception throw.

llvm-svn: 54017
2008-07-25 15:41:30 +00:00
Steve Naroff ce5206b4f2 Fix Parser::ParseObjCMethodDefinition(). Only call the actions module for valid MDecl's.
llvm-svn: 54013
2008-07-25 14:30:25 +00:00
Ted Kremenek 177bc93165 Updated checker build.
llvm-svn: 54012
2008-07-25 05:21:03 +00:00
Ted Kremenek 092ec76923 Don't emit 'dead initialization' warnings for variables marked 'unused'.
This fixes PR 2573: http://llvm.org/bugs/show_bug.cgi?id=2573

llvm-svn: 54009
2008-07-25 04:47:34 +00:00
Ted Kremenek 39c59a8887 Implemented Sema support for attribute "unused".
llvm-svn: 54008
2008-07-25 04:39:19 +00:00
Daniel Dunbar 0e5845c13a Rework codegen of case ranges
- Fix multiple issues with the way case ranges were emitted, see test
   cases details about the specific issues.

 - The root issue was not being careful about how basic blocks were
   emitted which led to them being chained together incorrectly,
   resulting in improper control flow.

 - Fixes <rdar://problem/6098585>

llvm-svn: 54006
2008-07-25 01:11:38 +00:00
Daniel Dunbar dd49a04d18 Allow CLANG env variable to override "clang" command in TestRunner.sh
llvm-svn: 54005
2008-07-25 01:05:44 +00:00
Ted Kremenek 5eb536b74c Use ASTContext::isObjCObjectPointerType() to check if an ivar is a reference to an Objective-C object.
llvm-svn: 53999
2008-07-24 23:59:07 +00:00
Ted Kremenek 77c51b2aa3 Move isObjCObjectPointerType() from Sema to ASTContext.
llvm-svn: 53998
2008-07-24 23:58:27 +00:00
Ted Kremenek a23b9f0e90 Update VS project.
llvm-svn: 53995
2008-07-24 22:20:01 +00:00
Steve Naroff 6c79f97037 Fix Sema::ActOnClassMessage() to pass through the identifier for "super".
This fixes a critical rewriter bug (<rdar://problem/6096760> clang ObjC rewriter: 'self' not expected value in class method called with 'super').

Also added a couple FIXME's since I'm not happy with my fix to Sema. It would be nicer if the super handling for class/instance messages was the same (based on PreDefinedExpr).

llvm-svn: 53994
2008-07-24 19:44:33 +00:00
Ted Kremenek 9e9afb552c Correctly handle NSAssertionHandle -handleFailureInMethod:object:file:lineNumber:description:
This fixes: http://llvm.org/bugs/show_bug.cgi?id=2593

llvm-svn: 53993
2008-07-24 18:47:16 +00:00
Ted Kremenek 365f21c8db Updated checker build.
llvm-svn: 53992
2008-07-24 18:15:01 +00:00
Ted Kremenek 0e60b7588a Don't issue a missing +dealloc warning for classes that just contain SEL ivars.
This fixes PR 2592: http://llvm.org/bugs/show_bug.cgi?id=2592

llvm-svn: 53987
2008-07-24 17:45:56 +00:00
Daniel Dunbar 66cd9a32d2 Fix comment
llvm-svn: 53986
2008-07-24 17:38:50 +00:00
Ted Kremenek 53b29025f1 Rename test case file.
llvm-svn: 53984
2008-07-24 17:02:18 +00:00
Ted Kremenek 87b16f4258 Issue dead store warnings for preincrements involved in a subexpression.
llvm-svn: 53983
2008-07-24 17:01:17 +00:00
Ted Kremenek 4a154b2857 Ignore -MT and -MF.
llvm-svn: 53977
2008-07-24 03:52:21 +00:00
Ted Kremenek 1c0c06bb9c "This patch adds paths for Fedora 9 in clang.cpp and support for two preprocessor options in ccc."
Patch by Zhongxing Xu!

llvm-svn: 53976
2008-07-24 03:49:15 +00:00
Daniel Dunbar 2e0f1cd00c Fix EmitCaseStmtRange to ignore empty ranges
- Also cleaned up emission slightly 
 - Inspection of the code revealed several other bugs, however. Case
   ranges are not properly wired and can result in switch cases being
   dropped or even infinite loops. See: <rdar://problem/6098585>

Completes: <rdar://problem/6094119>
llvm-svn: 53975
2008-07-24 01:18:41 +00:00
Daniel Dunbar 908fccc6ea Add Expr::getIntegerConstantExprValue helper method
- For getting an APSInt from a known integer constant Expr.
 - TODO: Many users of Expr::isIntegerConstantExpr in codegen should
   probably be using this instead...

llvm-svn: 53974
2008-07-24 01:08:37 +00:00
Ted Kremenek 25177f5e53 Updated checker build.
llvm-svn: 53969
2008-07-23 23:39:06 +00:00
Ted Kremenek 0b5eb1ac87 Added dead stores test case.
llvm-svn: 53966
2008-07-23 23:18:43 +00:00
Ted Kremenek c99332c5a6 Modified HTMLDiagnostics to also perform syntax highlighting for errors in header files.
llvm-svn: 53965
2008-07-23 23:18:15 +00:00
Ted Kremenek 9572cae92b Don't flag dead stores when the result of a preincrement/predecrement is used in an enclosing expression.
llvm-svn: 53964
2008-07-23 22:19:56 +00:00
Ted Kremenek 1692342e58 Added UnaryOperator::isPrefix().
llvm-svn: 53963
2008-07-23 22:18:43 +00:00
Ted Kremenek b9e10c02d2 Use typedef range_iterator instead of SourceRange* in PathDiagnosticPiece.
llvm-svn: 53962
2008-07-23 21:51:42 +00:00
Ted Kremenek ecc851bb6e Further refine dead store checking to distinguish between dead stores and dead increments.
llvm-svn: 53960
2008-07-23 21:16:38 +00:00
Ted Kremenek 46abc7db6b Properly skip IBOutlets when checking for unused ivars.
Refine the error message of unused ivars.
Added test case.

llvm-svn: 53957
2008-07-23 18:21:36 +00:00
Ted Kremenek 0cdba6b43e Initialize instance variable DeclAccess in ctor for ObjCIvarDecl.
llvm-svn: 53956
2008-07-23 18:12:25 +00:00
Ted Kremenek 73295fab89 When constructing an ObjCIvarDecl object in Sema, provide its visibility up front instead of setting it afterwards.
This change also fixes a subtle bug where the access control of an ivar would be initialized to garbage if we didn't have an explicit visibility specifier (e.g., @private).

llvm-svn: 53955
2008-07-23 18:04:17 +00:00
Ted Kremenek 7de7fd0305 Updated comment for class ObjCIvarDecl: it turns out the default access control
is protected, not private.

Added ObjCIvarDecl::getCanonicalAccessControl() to report the visible access
control of an ivar, whereas getAccessControl() returns the access control
relating to how the ivar was actually declared.

llvm-svn: 53954
2008-07-23 17:44:44 +00:00
Ted Kremenek 6b6a4b6446 Ivar access mode ObjCIvarDecl::None == ObjCIvarDecl::Protected, not private.
llvm-svn: 53953
2008-07-23 17:14:39 +00:00
Ted Kremenek 19f4e16f3e Update Xcode project.
llvm-svn: 53952
2008-07-23 17:13:09 +00:00
Chris Lattner 28ee5b3d29 don't depend on the result of CreateNeg to be a binop
llvm-svn: 53948
2008-07-23 06:53:34 +00:00
Chris Lattner 070968957e Fix rdar://6094010 various asserts happening with wide strings in inline asm.
llvm-svn: 53947
2008-07-23 06:46:56 +00:00
Chris Lattner d258325c2b Fix a codegen crash on:
int foo(void) {
  float x[2];
  return x;
}

rdar://6093986

llvm-svn: 53946
2008-07-23 06:31:27 +00:00
Ted Kremenek 3b28f4911c Add prototype implementation of unused ivar check.
llvm-svn: 53942
2008-07-23 00:45:26 +00:00
Ted Kremenek 0b39845f93 Updated checker build.
llvm-svn: 53936
2008-07-22 22:45:52 +00:00
Argyrios Kyrtzidis cbece36b22 Fix compilation error on GCC 4.3.0 ('memcpy' was not declared in this scope).
llvm-svn: 53934
2008-07-22 21:56:45 +00:00
Daniel Dunbar a2fbefc159 Add note to check what __alignof__ a function type should be.
llvm-svn: 53928
2008-07-22 19:44:18 +00:00
Anders Carlsson 35a56368be Always define __SIZE_TYPE__ as long unsigned int.
llvm-svn: 53922
2008-07-22 17:16:13 +00:00
Ted Kremenek 5dd9c0eaf6 Update VS project.
llvm-svn: 53921
2008-07-22 17:13:59 +00:00
Ted Kremenek 85b898e1de Use llvm::utostr_32 instead of ostringstream.
llvm-svn: 53914
2008-07-22 16:56:21 +00:00
Ted Kremenek 59a4d909e1 Update VS project.
llvm-svn: 53913
2008-07-22 16:47:06 +00:00
Ted Kremenek a8efcf58a2 Update Xcode project.
llvm-svn: 53910
2008-07-22 16:22:19 +00:00
Ted Kremenek 1f352db96a Moved registration of basic path-sensitive checks from GRSimpleVals.cpp to GRExprEngineInternalChecks.cpp.
llvm-svn: 53909
2008-07-22 16:21:24 +00:00
Ted Kremenek 6bb53303e1 Rename file.
llvm-svn: 53906
2008-07-22 14:41:47 +00:00
Daniel Dunbar ee8bbb3ccc Prevent codegen crash on sizeof(<function type>), a gcc extension.
llvm-svn: 53899
2008-07-22 01:35:47 +00:00
Ted Kremenek 98f6e582f2 Added path-sensitive checking for null pointer values passed to function arguments marked nonnull.
This implements <rdar://problem/6069935>

llvm-svn: 53891
2008-07-22 00:46:16 +00:00
Daniel Dunbar 327acd7a6c Implement bzero, memset, memmove builtins.
This subsumes Nico Weber's patch and implements bzero in terms
of llvm.memset to match llvm-gcc.

llvm-svn: 53888
2008-07-22 00:26:45 +00:00
Daniel Dunbar b725726c29 Implement nans, prefetch, and trap builtins.
This closes <rdar://problem/6080720>, support for __builtin_constant_p
has been filed separately.

llvm-svn: 53885
2008-07-21 22:59:13 +00:00
Chris Lattner d7352d6801 minor cleanup to the actions interface to pass around SmallVectorImpl instead
of a specific smallvector size.

Fix protocol lists to pass down proper location info, so we get diagnostics
like this:

t.m:3:35: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
                                  ^

instead of this:

t.m:3:44: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
                                           ^


Add a new IdentifierLocPair typedef which is just a pair<IdentifierInfo*, SourceLocation>

llvm-svn: 53883
2008-07-21 22:17:28 +00:00
Ted Kremenek 5224e6a81d Add test case for nonnull attribute.
Fix indexing bug.

llvm-svn: 53882
2008-07-21 22:09:15 +00:00
Ted Kremenek 2d63bc1e99 Added sema support for the nonnull attribute. Will add test cases soon.
llvm-svn: 53881
2008-07-21 21:53:04 +00:00
Daniel Dunbar 7ed03c4cdd Kill an unused variable warning
llvm-svn: 53878
2008-07-21 21:43:28 +00:00
Chris Lattner 388f6e97e1 unindent this function by using an early exit, not functionality change.
llvm-svn: 53877
2008-07-21 21:33:21 +00:00
Chris Lattner 390d39ac7e move two more lists of protocols over to use ObjCList<ObjCProtocolDecl>,
simplifying code along the way and fixing a problem and memory leak or two.

llvm-svn: 53876
2008-07-21 21:32:27 +00:00
Daniel Dunbar c2f67966f4 Add __builtin_powi[fl] support
llvm-svn: 53866
2008-07-21 18:44:41 +00:00
Daniel Dunbar 5b288788b3 Fix a test RUN line to not generate '=-' in test directory
llvm-svn: 53865
2008-07-21 18:42:27 +00:00
Chris Lattner 102ccc4f8c add forward definition protocols to the protocol list for a class.
llvm-svn: 53864
2008-07-21 18:35:17 +00:00
Chris Lattner 461d3f8eb8 references to completely undeclared protocols should be errors.
References to forward definitions should be warnings.

llvm-svn: 53863
2008-07-21 18:34:02 +00:00
Steve Naroff f0ff879881 RewriteObjC::RewriteObjCForCollectionStmt() needs to handle bodies with a single statement.
Fixes <rdar://problem/6084870> clang ObjC rewriter: for-in enumeration in 1 line produces output with error.

llvm-svn: 53858
2008-07-21 18:26:02 +00:00
Chris Lattner d004505b74 introduce a new ObjCList templated class and start moving
various objc lists over to it.  First up, the protocol list 
on ObjCInterfaceDecl.

llvm-svn: 53856
2008-07-21 18:19:38 +00:00
Ted Kremenek b47772535b Update checker build.
llvm-svn: 53855
2008-07-21 17:53:09 +00:00
Chris Lattner 65056c48a7 rename setReferencedProtocolList -> addReferencedProtocols to
be consistent with ObjCInterfaceDecl.

llvm-svn: 53852
2008-07-21 17:23:15 +00:00
Daniel Dunbar d93abc3bb0 Implement ffs, parity, and popcount builtins.
+ test case

llvm-svn: 53851
2008-07-21 17:19:41 +00:00
Argyrios Kyrtzidis b3fa8639e1 Change 'MDecl' to 'MD' to fix redefinition compiler error in MSVC++.
llvm-svn: 53849
2008-07-21 09:18:38 +00:00
Chris Lattner 046485640d fix typo
llvm-svn: 53848
2008-07-21 07:13:18 +00:00
Chris Lattner ca1e848588 Switch initialization of the protocol list for an interface decl to use
the standard "set these as the list of protocols" interface instead of a 
strange "set this as the size and then set each one to the value" interface.
The problem with the later is that it a) is completely different from 
everything else, b) is awkward, and c) doesn't handle the case when a
referenced protocol is invalid: it set it to null.

This meant that all clients downstream would have to handle null protocols
in the protocol list, and empirically they didn't.  Fix this by not setting
invalid protocols in the referenced protocol list, fixing the crash on 
test/Sema/objc-interface-1.m

While I'm at it, clean up some locations so that we produce:

t.m:1:25: error: cannot find interface declaration for 'NSObject', superclass of 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
~~~~~~~~~~~~~~~~~~~~~   ^

instead of:

t.m:1:1: error: cannot find interface declaration for 'NSObject', superclass of 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
^

llvm-svn: 53846
2008-07-21 07:06:49 +00:00
Chris Lattner 87899be4cc when in the context of an @implementation, look for private methods in the
@implementation to resolve nullary selector references.

llvm-svn: 53845
2008-07-21 06:44:27 +00:00
Chris Lattner f1c149db9f don't pass in null as the Name for GenerateClassStructure,
it goes and makes std::strings out of them, which is not 
defined.

llvm-svn: 53843
2008-07-21 06:31:05 +00:00
Chris Lattner 12bf571fa8 improve diagnostics about problems with receivers to highlight the receiver.
llvm-svn: 53842
2008-07-21 06:16:07 +00:00
Chris Lattner bd2d634424 continue cleaning up code, and disable sending a message directly to an
interface.  This fixes a bug where we used to accept:

void test2(NSNumber x) {
	[x METH];
}

which doesn't make sense and GCC rejects.

llvm-svn: 53841
2008-07-21 06:12:56 +00:00
Chris Lattner 6b946cc788 simplify control flow a bit, reducing indentation. No functionality change.
llvm-svn: 53837
2008-07-21 05:57:44 +00:00
Chris Lattner 79f14789d8 tighten up some checks, don't allow sending a message to NSString****
llvm-svn: 53836
2008-07-21 05:54:02 +00:00
Chris Lattner 393f4ae047 update diagnostic to include string
llvm-svn: 53835
2008-07-21 05:38:58 +00:00
Chris Lattner 0c373078e2 improve invalid member reference diagnostics to print the type and
have better source ranges.  Before:

t.m:11:53: error: member reference is not to a structure or union
    CGFloat maxOffsetY = [_outlineLayer contentSize].height - [_outlineLayer frame].size.height;
                                                    ^~~~~~~

after:

t.m:11:54: error: member reference base type ('id') is not a structure or union
    CGFloat maxOffsetY = [_outlineLayer contentSize].height - [_outlineLayer frame].size.height;
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

llvm-svn: 53834
2008-07-21 05:35:34 +00:00
Chris Lattner 3f44d70771 merge a bunch of code that is now common between qual interfaces and interfaces.
llvm-svn: 53833
2008-07-21 05:27:51 +00:00
Chris Lattner d7983b472e rename getProtocols -> getProtocol, as it only returns a single
protocol.  Simplify some code to use unconditional form of the
protocol access list.

llvm-svn: 53832
2008-07-21 05:20:01 +00:00
Chris Lattner 419f699b55 use iterators instead of direct access to protocol list.
llvm-svn: 53831
2008-07-21 05:19:23 +00:00
Chris Lattner 13b2ace8df improve documentation of ObjCInterfaceType significantly. Also,
make the qual_* iterators and getNumProtocols() lists be accessible through
ObjCInterfaceType (returning an empty range if not a 
ObjCQualifiedInterfaceType).  This eliminates special checks in clients.

llvm-svn: 53830
2008-07-21 05:13:51 +00:00
Chris Lattner dc420f4866 Fix a bunch of crashes that occur in (attempted) handling of objc properties.
This code would previously crash on x.y where x is 'id'.

llvm-svn: 53827
2008-07-21 04:59:05 +00:00
Chris Lattner f8f5682998 right, the error is when the itf *doesn't* have the member.
llvm-svn: 53826
2008-07-21 04:54:33 +00:00
Chris Lattner bf58ba78df use the simplified form of lookupInstanceVariable for callers who
don't care which class actually defines it.

llvm-svn: 53825
2008-07-21 04:44:44 +00:00
Chris Lattner 8bb52cb5a2 improve the diagnostic for an erroneous objc ivar reference
from:

t.m:8:7: error: member reference is not to a structure or union
  pool->farm = 0;
      ^ ~~~~
to:

t.m:8:7: error: 'NSAutoreleasePool' has member named 'farm'
  pool->farm = 0;
  ~~~~^ ~~~~

llvm-svn: 53824
2008-07-21 04:42:08 +00:00
Chris Lattner 4befd736b2 simplify a bunch of code, no functionality change.
llvm-svn: 53823
2008-07-21 04:36:39 +00:00
Chris Lattner b63a745331 rearrange some code, no functionality change.
llvm-svn: 53822
2008-07-21 04:28:12 +00:00
Chris Lattner 530315fe89 improve comments yet again, now I know what this does :)
llvm-svn: 53821
2008-07-21 04:16:33 +00:00
Chris Lattner 6886f38369 minor rename, also, reject pointer to qualified id.
id<NSCopyable>*  is not an "objc pointer type", id<NSCopyable> is.

llvm-svn: 53820
2008-07-21 04:13:58 +00:00
Chris Lattner c47d930448 Fix a crash that can happen when you have typedefs for pointers to
interfaces.  Just because they x->isPointerType() doesn't mean it is
valid to just cast to a pointertype.  We have to handle typedefs etc
as well.

llvm-svn: 53819
2008-07-21 04:09:54 +00:00
Chris Lattner 15727f69fa improve comments.
llvm-svn: 53818
2008-07-21 04:07:11 +00:00
Chris Lattner 2a47fa7372 simplify this predicate, only checking isObjCQualifiedIdType once.
llvm-svn: 53817
2008-07-21 04:03:34 +00:00
Chris Lattner 9099474130 Add a space, ted apparently has philosophical problems with spaces ;-)
llvm-svn: 53808
2008-07-20 04:22:06 +00:00
Nuno Lopes 8a48c2f7d9 fix test
llvm-svn: 53802
2008-07-19 22:11:43 +00:00
Ted Kremenek 4f2fb96d18 Updated latest checker build.
llvm-svn: 53800
2008-07-19 19:50:00 +00:00
Ted Kremenek f487548c17 Patch by Kovarththanan Rajaratnam:
"When dumping the tokens (-dumptokens output type), the column numbers are not
correctly shown. This patch fixes that issue."

llvm-svn: 53797
2008-07-19 19:10:40 +00:00
Ted Kremenek 0fff6d3c06 Patch by
"When dumping the tokens (-dumptokens output type), the column numbers are not
correctly shown. This patch fixes that issue."

llvm-svn: 53796
2008-07-19 19:10:04 +00:00
Ted Kremenek f7ffd66551 Reimplement ccc-analyzer in a language I actually know, and implement some obvious optimizations when processing command line arguments.
llvm-svn: 53783
2008-07-19 06:11:04 +00:00
Ted Kremenek d2d122961d Remove typo.
llvm-svn: 53776
2008-07-18 23:13:03 +00:00
Ted Kremenek 2a6b0b5d5e Quote invocation of clang in pipe to handle paths with spaces.
llvm-svn: 53775
2008-07-18 23:11:33 +00:00
Ted Kremenek 8857703b57 Added test case.
llvm-svn: 53770
2008-07-18 20:48:10 +00:00
Ted Kremenek 6f2c46a275 Update checker build.
llvm-svn: 53769
2008-07-18 20:22:22 +00:00
Ted Kremenek f41b1c45fa "currentHandler" is a nullary selector
llvm-svn: 53763
2008-07-18 18:14:26 +00:00
Ted Kremenek f7faa42c6c Fix caching bug.
llvm-svn: 53759
2008-07-18 17:39:56 +00:00
Ted Kremenek 3b2294c7e6 Add panic support for NSAssertionHandler.
llvm-svn: 53758
2008-07-18 17:24:20 +00:00
Daniel Dunbar 155ed24359 Prevent clang from emitting output when input has errors
+ test case
<rdar://problem/6080040>
http://llvm.org/bugs/show_bug.cgi?id=2280

llvm-svn: 53756
2008-07-18 16:38:05 +00:00
Ted Kremenek d785465167 Add panic function.
llvm-svn: 53755
2008-07-18 16:28:33 +00:00
Ted Kremenek 36f6b04295 Fix 80 col violation
llvm-svn: 53754
2008-07-18 15:59:33 +00:00
Ted Kremenek b1c91bfc45 Fix regression by explicitly checking if we are negating a SymIntConstantVal.
llvm-svn: 53753
2008-07-18 15:54:51 +00:00
Ted Kremenek 6a62d908c3 Improve path-sensitivity when using the logical not operator.
llvm-svn: 53752
2008-07-18 15:46:06 +00:00
Ted Kremenek 91614e6fe6 Renamed deterministic EvalBinOp to DetermEvalBinOpNN. This name mangling is unfortunately needed because virtual methods with the same name can be hidden by subclasses.
llvm-svn: 53751
2008-07-18 15:27:58 +00:00
Ted Kremenek 8d6b42e096 Created ValueStateSet class to manage the creation of multiple states by a method.
Modified the new EvalBinOpNN to generate states instead of nodes.  This is a much simpler interface and is what clients will want to do.

llvm-svn: 53750
2008-07-18 05:53:58 +00:00