Commit Graph

6476 Commits

Author SHA1 Message Date
Ted Kremenek ca8ac081af Unbreak ccc-analyzer: getcwd is from package Cwd
llvm-svn: 56397
2008-09-21 18:26:19 +00:00
Ted Kremenek 32c1181468 Patch by Richard Godbee:
Output to .info files the absolute paths to files that were rejected by the
parser or crashed the analyzer.

llvm-svn: 56396
2008-09-21 18:04:49 +00:00
Ted Kremenek 172f04dfe6 scan-build now prints out bug categories.
llvm-svn: 56395
2008-09-21 06:58:09 +00:00
Ted Kremenek 33663885c3 Add a bug category for NSError** checks.
llvm-svn: 56394
2008-09-21 06:57:40 +00:00
Ted Kremenek ebb4245b84 Have ScanView.py generate a "<td></td>" pair in the output HTML instead of having scan-build output an empty (and possibly unused) <td>.
llvm-svn: 56393
2008-09-21 03:55:51 +00:00
Cedric Venet b074a21b08 Update VS projects.
llvm-svn: 56390
2008-09-20 18:03:16 +00:00
Ted Kremenek de195e2100 Add "category" to BugTypes, allowing bugs to be grouped.
Changed casing of many bug names.  The convention will be to have bug names (mostly) lower cased, and categories use some capitalization.

llvm-svn: 56385
2008-09-20 04:23:38 +00:00
Ted Kremenek bc15d8539d Add PostStore, a new ProgramPoint to distinguish between 'stores' and other PostStmts.
GRExprEngine:
  Use PostStore in EvalStore.
  Use a second version of EvalStore in EvalBinaryOperator to associate the store with the expression on the LHS.

llvm-svn: 56383
2008-09-20 01:50:34 +00:00
Daniel Dunbar 025b48dd6e Make scan-view more robust / friendly when bug reporting fails.
llvm-svn: 56382
2008-09-20 01:43:16 +00:00
Daniel Dunbar d4c2337ef5 Add initial implementation of scan-view
- Web based interface to static analyzer.

llvm-svn: 56375
2008-09-19 23:32:11 +00:00
Daniel Dunbar 669632bf9a Add REPORTBUG marker to scan-build.
llvm-svn: 56373
2008-09-19 23:18:44 +00:00
Ted Kremenek 8cdc71859c Test case for transfer function logic of const casts.
llvm-svn: 56369
2008-09-19 20:53:52 +00:00
Ted Kremenek 31a15f8ba2 Bug fix: for the base transfer function logic for casts, handle const casts as just propagating the value.
llvm-svn: 56368
2008-09-19 20:51:22 +00:00
Ted Kremenek 37202acdff Update checker build
llvm-svn: 56367
2008-09-19 20:20:09 +00:00
Ted Kremenek 34bfd8a490 Fixed logic error in BasicConstraintManager pointed out by Zhongxing Xu.
For checking if a symbol >= value, we need to check if symbol == value || symbol
> value. When checking symbol > value and we know that symbol != value, the path
is infeasible only if value == maximum integer.

For checking if a symbol <= value, we need to check if symbol == value || symbol
< value. When checking symbol < value and we know that symbol != value, the path
is infeasible only if value == minimum integer.

Updated test case exercising this logic: we only prune paths if the values are
unsigned.

llvm-svn: 56354
2008-09-19 18:00:36 +00:00
Chris Lattner a7b034463e Fix rdar://6222856: the receiver of a message expr is an
arbitrary expr, not just a assign expr.  The grammar comment
was right, the code was just wrong.

llvm-svn: 56353
2008-09-19 17:44:00 +00:00
Ted Kremenek a5bf9cb4be When we have a binary expression 'int operator symbol', properly rewrite this as
'symbol operator-reverse int'. This patch is a combination of code from
Zhongxing Xu and myself (Zhongxing noticed this bug for the cases of
relational operators).

llvm-svn: 56351
2008-09-19 17:31:13 +00:00
Zhongxing Xu a8e88ecda6 Add an omitted case for AssumeSymInt.
llvm-svn: 56334
2008-09-19 06:07:59 +00:00
Ted Kremenek 9a7e2efec0 Updated checker build.
llvm-svn: 56333
2008-09-19 05:14:13 +00:00
Ted Kremenek 55bec4d511 Added test case for PR 2600: proper use of NSError**
llvm-svn: 56332
2008-09-19 04:56:32 +00:00
Ted Kremenek a417c0e80a Add panic function "__assert_fail".
llvm-svn: 56327
2008-09-19 02:30:47 +00:00
Ted Kremenek 6a1a334b6c Register the implicit null-dereferenced object as a notable symbol.
llvm-svn: 56319
2008-09-18 23:23:19 +00:00
Ted Kremenek b42f482c91 Implement second part of PR 2600: NSError** parameter may be null, and should be checked before being dereferenced.
llvm-svn: 56318
2008-09-18 23:09:54 +00:00
Ted Kremenek c38b3fbc4c Update Xcode project.
llvm-svn: 56317
2008-09-18 23:08:24 +00:00
Ted Kremenek 6633871cb3 Analysis option -warn-objc-nserror-methods is no longer available. (check is done automatically with -checker-cfref)
llvm-svn: 56313
2008-09-18 21:25:58 +00:00
Ted Kremenek f0673e4eb6 Change implementation of NSError** coding-style check to be invoked at the end of the retain/release analysis.
llvm-svn: 56312
2008-09-18 21:25:13 +00:00
Steve Naroff 3405a73ab8 Finish pushing blocks attribute through the clang attribute machinery.
Also added a couple simple tests from the "gcc.apple" test suite.

llvm-svn: 56309
2008-09-18 16:44:58 +00:00
Steve Naroff 9779e92fa4 Add driver support for invoking block rewriter.
Also tweaked the create function to take an explicit output file.

llvm-svn: 56305
2008-09-18 14:10:13 +00:00
Ted Kremenek be061e2a19 Enable '-warn-objc-nserror-methods' by default.
llvm-svn: 56298
2008-09-18 06:34:16 +00:00
Ted Kremenek fc3abeb1e5 Implemented one of the checks requested in PR 2600:
"Method accepting NSError** argument should have non-void return value to indicate that an error occurred."

Test case written, but the header needs to be delta-debugged reduced.  Will commit shortly.

llvm-svn: 56297
2008-09-18 06:33:41 +00:00
Ted Kremenek 137fc0ea01 Added CFNumberCreate test case to illustrate a 32-bit/64-bit arch issue.
llvm-svn: 56295
2008-09-18 00:28:23 +00:00
Ted Kremenek 24bef31597 Add path-sensitivity test case.
llvm-svn: 56294
2008-09-17 22:24:13 +00:00
Daniel Dunbar 86d97c7985 Improve x86 ABI compatibility.
- Enables use of ABIArgInfo::Expand when needed. This greatly
   improves our x86 ABI compatibility.

 - As the infrastructure for target specific ABI handling isn't built
   yet, this change means ABI compatibility on other platforms is once
   again broken in a different way than before.

 - Upcoming: Figure out how to refactor ABI handling into
   targets. More documentation.

llvm-svn: 56293
2008-09-17 21:22:33 +00:00
Daniel Dunbar d9d1f5f522 Print current function on verification failures.
llvm-svn: 56291
2008-09-17 21:13:22 +00:00
Daniel Dunbar d34d6dc458 Drop CodeGenTypes parameter to classifyArgumentType.
Ensure that ABIArgInfo::Default implementation for aggregrate types
is sensible (StructRet on return and ByVal on arguments).

No functionality change.

llvm-svn: 56289
2008-09-17 20:11:04 +00:00
Steve Naroff 43bafa78b3 Remove BlockStmtExpr.
Block literals are now represented by the concrete BlockExpr class.
This is cleanup (removes a FIXME).
No functionality change.

llvm-svn: 56288
2008-09-17 18:37:59 +00:00
Daniel Dunbar 6ff95305e6 Another attempt to make test/Makefile return correct error code.
llvm-svn: 56285
2008-09-17 18:08:07 +00:00
Steve Naroff a5629376e8 Fix http://llvm.org/bugs/show_bug.cgi?id=2760.
llvm-svn: 56280
2008-09-17 14:05:40 +00:00
Ted Kremenek 45a928b956 Updated checker build.
llvm-svn: 56274
2008-09-17 04:22:09 +00:00
Zhongxing Xu 7b7394c8ec Fix comment typo.
llvm-svn: 56271
2008-09-17 02:35:50 +00:00
Daniel Dunbar 8fc81b02e2 Add support for ABIArgInfo::Expand
- No functionality change.

llvm-svn: 56269
2008-09-17 00:51:38 +00:00
Steve Naroff 2da868e9c2 Add support for rewriting blocks...
llvm-svn: 56266
2008-09-17 00:13:27 +00:00
Daniel Dunbar 86169d6d0d Ignore XFAIL tests when checking for make failure in test/
llvm-svn: 56262
2008-09-16 23:43:13 +00:00
Ted Kremenek 025f83534c Fix copy-paste error in test case.
llvm-svn: 56261
2008-09-16 23:25:28 +00:00
Ted Kremenek 8782716c4a Minor pass-sensitivity improvement:
if we know that 'len != 0' and know that 'i == 0' then we know that
  'i < len' must evaluate to true and cannot evaluate to false

llvm-svn: 56260
2008-09-16 23:24:45 +00:00
Ted Kremenek 2b4b3b13a9 Update Xcode project.
llvm-svn: 56259
2008-09-16 23:21:45 +00:00
Steve Naroff 7a147c6a3c Remove support for BlockExprExpr. For example...
^(expression) or ^(int arg1, float arg2)(expression)
...is no longer supported. 
All block literals now require a compound statement.

llvm-svn: 56257
2008-09-16 23:11:46 +00:00
Steve Naroff 3b1e172d7e Sema::ActOnBlockReturnStmt(): Need to perform the UsualUnaryConversions on the return type.
Sema::CheckReturnStackAddr(): Make sure we skip over implicit casts.
Added some more test cases...

llvm-svn: 56254
2008-09-16 22:25:10 +00:00
Ted Kremenek 0ecb53a421 ProgramPoint now takes the space of two pointers instead of one. This change was
motivated because it became clear that the number of subclasses of ProgramPoint
would expand and we ran out of bits to represent a pointer variant. As a plus of
this change, BlockEdge program points can now be represented explicitly without
using a cache of CFGBlock* pairs in CFG.

llvm-svn: 56245
2008-09-16 18:44:52 +00:00
Zhongxing Xu 5912c6e6f0 Fixed an offset calculation error.
llvm-svn: 56242
2008-09-16 07:58:21 +00:00
Ted Kremenek 2d470fc0ba Patch by Csaba Hruska!
"Here is a patch what replaces std::ostream with llvm::raw_ostream. This patch
covers the AST library, but ignores Analysis lib."

llvm-svn: 56185
2008-09-13 05:16:45 +00:00
Ted Kremenek 5f09b1dece Updated checker build.
llvm-svn: 56177
2008-09-13 00:23:41 +00:00
Ted Kremenek 907921f753 Include links to stderr output of clang in the table of files that clang rejects.
llvm-svn: 56173
2008-09-12 22:49:36 +00:00
Daniel Dunbar 2880158a20 Add ccc support for -e and -sectorder.
- llvmc2, save me!

llvm-svn: 56169
2008-09-12 19:42:28 +00:00
Daniel Dunbar da41a14ce0 Round out object size checking builtins (fprintf ones disabled as we
have no mapping to FILE*). We are also missing printf format
attributes for the printf style ones.

llvm-svn: 56168
2008-09-12 18:39:42 +00:00
Daniel Dunbar 229121df87 Add website links to testing coverage & specification references.
llvm-svn: 56167
2008-09-12 18:33:44 +00:00
Ted Kremenek ef2b3a71bb Add missing spaces in path diagnostics.
llvm-svn: 56166
2008-09-12 18:17:46 +00:00
Daniel Dunbar be12fd1f4f Teach FindSpecRefs how to link to C++ spec.
llvm-svn: 56164
2008-09-12 18:10:49 +00:00
Daniel Dunbar 84b70f7f0f Add --suppress-system-warnings (on by default, use =0 to disable)
- For investigating warnings in system headers / builtins.
 - Currently also enables the behavior that allows silent redefinition
   of types in system headers. Conceptually these are separate but I
   didn't feel it was worth two options (or changing LangOptions).

llvm-svn: 56163
2008-09-12 18:10:20 +00:00
Ted Kremenek d3f0d9b07c Updated checker build.
llvm-svn: 56142
2008-09-12 04:56:58 +00:00
Douglas Gregor aa1e21dcbd Give string literals const element typesin C++, and cope with the deprecated C++ conversion from a string literal to a pointer-to-non-const-character
llvm-svn: 56137
2008-09-12 00:47:35 +00:00
Daniel Dunbar 484603be40 Iterate on sema for :? in Objective-C:
- Follow C99 behavior of using other operand type when one of
   operands is a null pointer constant.
 - Fix overenthusiastic devolving of any Objective-C types to id:
   o If either operand has an Objective-C object type then:
     - If both operands are interfaces and either operand can be
       assigned to the other, use that type as the composite type.
     - Otherwise, if either type is id, use id as the composite type.
     - Otherwise, warn about incompatible types and use id as the
       composite type.
 - Return handling of qualified idea to separate test following
   general pointer type checking.
   o Upgraded from old code to allow devolving to id (without warning,
     which matches GCC).
 - <rdar://problem/6212771>

Add test case for issues fixed above, XFAIL though because it exposed
a new issue in property handling.

llvm-svn: 56135
2008-09-11 23:12:46 +00:00
Argyrios Kyrtzidis 47f9865182 Add comments about C++ clause 3.3.2p4 that mentions that the condition declaration should be local to an if/switch/while/for statement.
llvm-svn: 56134
2008-09-11 23:08:39 +00:00
Ted Kremenek 4ab81cbe2f Echo stderr/stdout from clang subprocess to both the stderr of ccc-analyzer and
to an output file. This way users can both see the output of 'clang' as well as
enable background logging of files that clang encounters problems on.

llvm-svn: 56130
2008-09-11 23:05:26 +00:00
Ted Kremenek 28d1dc50b8 Bug fix: <rdar://problem/6164367>
scan-build now correctly processes path prefixes that contain multiple '+'
characters or other regex control characters.

llvm-svn: 56121
2008-09-11 21:15:10 +00:00
Mon P Wang 08fedcbcbb Added SSE41 pminsd, pmaxsd, roundps and a few others
llvm-svn: 56114
2008-09-11 19:22:31 +00:00
Ted Kremenek 81ced5c472 Check if the environment variable TERM is defined before using it.
This fixes: <rdar://problem/6164279> scan-build gives error when invoked without TERM variable

llvm-svn: 56110
2008-09-11 18:17:51 +00:00
Ted Kremenek c4488441da Update Xcode project.
llvm-svn: 56109
2008-09-11 18:14:22 +00:00
Steve Naroff 4adbe3116e Fix <rdar://problem/6210791> clang ObjC rewriter: @try / @catch block with no @finally does not call objc_exception_try_exit.
Need a couple tweaks to RewriteObjCTryStmt(). Need to deal with implicit finally clauses (to make sure objc_exception_try_exit is called). Also fixed a related bug where we need to generate an implicit @catch else clause (to again make sure objc_exception_try_exit is called).

llvm-svn: 56104
2008-09-11 15:29:03 +00:00
Douglas Gregor 27a907eb8c bool is not an extension in C++
llvm-svn: 56103
2008-09-11 12:06:59 +00:00
Anders Carlsson 9396a89899 Make sure to store the exception in the catch parameter.
llvm-svn: 56102
2008-09-11 09:15:33 +00:00
Anders Carlsson b5130d8588 Make sure to emit the catch parameter as well as the catch body.
llvm-svn: 56101
2008-09-11 08:21:54 +00:00
Anders Carlsson 3a3c2444d6 Fix stupid mistake I made in the exception handling code
llvm-svn: 56100
2008-09-11 06:35:14 +00:00
Argyrios Kyrtzidis 176edb5490 Do implicit conversion to bool for the condition in a do-while statement.
llvm-svn: 56096
2008-09-11 05:16:22 +00:00
Argyrios Kyrtzidis fea38016a9 Fix do-while scoping in C++.
llvm-svn: 56095
2008-09-11 04:46:46 +00:00
Argyrios Kyrtzidis 9321c74bd0 Allow array-to-pointer conversion for rvalues.
llvm-svn: 56094
2008-09-11 04:25:59 +00:00
Argyrios Kyrtzidis 0fdbd6cf25 CXXConditionDeclExpr expression node is an lvalue.
llvm-svn: 56093
2008-09-11 04:22:26 +00:00
Argyrios Kyrtzidis e7092bafc2 LangOptions.C99 should be false in C++.
llvm-svn: 56092
2008-09-11 04:21:06 +00:00
Argyrios Kyrtzidis 504bb844ba Revert r56078, getLang().C99 being true in C++ is a bug that will be fixed.
llvm-svn: 56090
2008-09-11 03:06:46 +00:00
Douglas Gregor e972aa471d Add support for expected-note to Clang's -verify option
llvm-svn: 56089
2008-09-11 02:46:36 +00:00
Daniel Dunbar d3674e6f40 Use ABIArgInfo for decisions about function arguments (not just return
value).
 - Added ABIArgInfo::ByVal (mostly supported) and ABIArgInfo::Expand
   (asserted out).

 - Added classifyArgumentType which currently just uses
   ABIArgInfo::Default or ByVal. This nearly matches old behavior, but
   we now set ByVal in a few situations we may have left it off before
   (on complex, for example).

llvm-svn: 56086
2008-09-11 01:48:57 +00:00
Daniel Dunbar ce05c8eb49 Fix two bugs exposed by array passing assert:
(1) Additional arguments to variadic methods should have default
promotions applied.

(2) Additional arguments to non-variadic methods were allowed.

llvm-svn: 56084
2008-09-11 00:50:25 +00:00
Daniel Dunbar 16211a2cc7 Add ObjCMethodDecl::getSourceRange.
llvm-svn: 56083
2008-09-11 00:47:15 +00:00
Argyrios Kyrtzidis f01fa82423 Fold Parser::ParseTag into Parser::ParseEnumSpecifier, as suggested in this post:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-September/002721.html

llvm-svn: 56081
2008-09-11 00:21:41 +00:00
Daniel Dunbar 83876b4594 Bug fix, apply default argument promotion in message sends for which
no method declaration was found.
 - This was allowing arrays to pass "by value" among other things.

Add assert in CodeGen that arguments cannot have array type.

llvm-svn: 56080
2008-09-11 00:04:36 +00:00
Daniel Dunbar aa9326c7e2 Refactor common Obj-C message send checking code into
CheckMessageArgumentTypes.
 - No functionality change.

llvm-svn: 56079
2008-09-11 00:01:56 +00:00
Argyrios Kyrtzidis 48dea3b9f5 -getLang().C99 is true in C++ too, remove the use of the C99orCXX variable.
-Scoping in C99 works good for C++ too, remove the C++-specific comments.

If someone thinks that the C++-specific comments are necessary for clarification, let me know and I'll put them back on.

llvm-svn: 56078
2008-09-10 23:46:08 +00:00
Argyrios Kyrtzidis 996677e12d In the 'condition.cpp' test case, make sure that condition declarations are local to the statement.
llvm-svn: 56077
2008-09-10 23:34:50 +00:00
Daniel Dunbar b034bc71d4 Add XFAIL test case for:
<rdar://problem/6211479> [sema] array type invalid for Obj-C property

llvm-svn: 56075
2008-09-10 23:11:23 +00:00
Steve Naroff 2752a17a00 More semantic analysis for blocks...
llvm-svn: 56064
2008-09-10 19:17:48 +00:00
Steve Naroff 3ef15b5c2a Sema::ActOnIdentifierExpr(): Lookup block arguments.
llvm-svn: 56063
2008-09-10 18:33:00 +00:00
Argyrios Kyrtzidis eece3fe4fd Add some C++-specific comments in the parsing methods of if/switch/while/for.
llvm-svn: 56060
2008-09-10 17:38:35 +00:00
Daniel Dunbar 573884eaf7 Implement ABIArgType::Coerce support.
- As a test, enable basic usage for some common x86-32 cases. This
    increases our x86-32 compliance (on other targets our compliance
    will just be broken in a different way).

llvm-svn: 56051
2008-09-10 07:04:09 +00:00
Daniel Dunbar b8b4759462 Add CodeGenTypes::GetFunctionType overload for getting the effective
type of a call.

Change NeXT runtime to use this instead of trying to bitcasting
internally (which doesn't respect the ABI).

Fix subtle bug, use of ConvertTypeRecursive instead of ConvertType is
bad inside GetFunctionType.

llvm-svn: 56050
2008-09-10 07:00:50 +00:00
Daniel Dunbar 7a95ca3197 Move FunctionType conversion into CGCall.cpp:
- Added CodeGenTypes::GetFunctionType, taking a CGFunctionInfo.
 - Updated Obj-C runtimes to use this instead of rolling the
   llvm::FunctionType by hand.
 - Killed CodeGenTypes::{ConvertReturnType, DecodeArgumentTypes}.

Add ABIArgInfo class to encapsulate ABI decision of how to lower types
to LLVM.
 - Will move to target sometime soon.

llvm-svn: 56047
2008-09-10 04:01:49 +00:00
Daniel Dunbar a72d4aece6 Add ABIArgInfo class to encapsulate ABI decision of how to lower types
to LLVM.
 - Will move to target sometime soon.

llvm-svn: 56046
2008-09-10 02:41:04 +00:00
Argyrios Kyrtzidis 07052350f0 Implement CodeGen support for the 'CXXConditionDeclExpr' expression node, which represents a 'condition' declaration, e.g: "if (int x=0) {...}".
llvm-svn: 56045
2008-09-10 02:36:38 +00:00
Argyrios Kyrtzidis 7620ee4550 Implement Sema support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).
llvm-svn: 56044
2008-09-10 02:17:11 +00:00
Argyrios Kyrtzidis 791dc3cd4e Change line endings: CRLF -> LF
llvm-svn: 56043
2008-09-10 02:14:49 +00:00
Argyrios Kyrtzidis ac1f2abd93 Use Sema::isDeclInScope instead of IdentifierResolver::isDeclInScope.
llvm-svn: 56042
2008-09-10 02:11:07 +00:00
Daniel Dunbar c68897d2c3 Tweak CGCall functions again:
- Realized these functions will eventually need access to more data,
   moved to CodeGenModule. Eventually they should probably live
   together in some other helper class.

llvm-svn: 56039
2008-09-10 00:41:16 +00:00
Daniel Dunbar 76c8eb75b1 Tweak CGCall functions:
- Move actual param attr list creation to
   CodeGenFunction::ConstructParamAttrList.
 - Make ReturnTypeUsesSret static.

llvm-svn: 56038
2008-09-10 00:32:18 +00:00
Daniel Dunbar 81cf67fa0b Add CodeGenFunction::ReturnTypeUsesSret
- Hook so NeXT runtime doesn't depend on ABI.

llvm-svn: 56034
2008-09-09 23:48:28 +00:00
Argyrios Kyrtzidis aa479138ea Add new 'CXXConditionDeclExpr' expression node used for a 'condition' declaration, e.g: "if (int x=0) {...}".
It is a subclass of DeclRefExpr and the main difference is that CXXConditionDeclExpr owns the declaration that it references.

llvm-svn: 56033
2008-09-09 23:47:53 +00:00
Daniel Dunbar 613855c8af Move ABI specific code for functions / calls to CGCall.cpp:
- Factor out EmitFunction{Pro,Epi}log

llvm-svn: 56031
2008-09-09 23:27:19 +00:00
Daniel Dunbar bc915f4025 Factor CodeGenFunction::StartFunction out of GenerateCode and
StartObjCMethod.

llvm-svn: 56030
2008-09-09 23:14:03 +00:00
Argyrios Kyrtzidis 2bdac73591 Make IdentifierResolver::isDeclInScope regard declarations of a parent 'control' scope as part of the current scope.
The 'control' scope is the 'condition' scope of if/switch/while statements and the scope that contains the for-init-statement and 'condition' of a for statement.

e.g:
if (int x = 0 /*'control' scope*/) {
  // x will be regarded as part of this substatement scope.
} else {
  // and as part of this substatement scope too.
}

llvm-svn: 56020
2008-09-09 21:57:58 +00:00
Argyrios Kyrtzidis f4b92e6924 Add a LangOptions member to IdentifierResolver.
Make Sema pass the LangOptions to IdentifierResolver's constructor.

llvm-svn: 56015
2008-09-09 21:32:02 +00:00
Argyrios Kyrtzidis 5b144d5cc4 Add Sema::isDeclInScope which wraps IdentifierResolver::isDeclInScope.
No functionality change.

llvm-svn: 56014
2008-09-09 21:18:04 +00:00
Daniel Dunbar 54bb1933b1 Use a unified return block.
- For the time being this means our emitted code is somewhat worse,
   especially for aggregates. This will be fixed.

llvm-svn: 56013
2008-09-09 21:00:17 +00:00
Argyrios Kyrtzidis f602e427e9 Fix test case.
llvm-svn: 56012
2008-09-09 20:56:12 +00:00
Daniel Dunbar 0bc8e86d6e Move EmitAggregate{Copy,Clear} into CodeGenFunction.
- No functionality change.

llvm-svn: 56010
2008-09-09 20:49:46 +00:00
Argyrios Kyrtzidis 2b4072fe55 Implement parser support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).
Add new 'ActOnCXXConditionDeclarationExpr' action, called when the 'condition' is a declaration instead of an expression.

llvm-svn: 56007
2008-09-09 20:38:47 +00:00
Steve Naroff fac18fe2ee Fix <rdar://problem/6197841> try, finally with no catch stops the exception from being propagated
llvm-svn: 56004
2008-09-09 19:59:12 +00:00
Argyrios Kyrtzidis 4f11d78fcc IdentifierResolver cleanup. Make some methods out-of-line.
llvm-svn: 56002
2008-09-09 19:28:27 +00:00
Anders Carlsson 4f1c7c3773 Check in half-assed implementation of @try/@catch.
llvm-svn: 55994
2008-09-09 17:59:25 +00:00
Anders Carlsson e005aa13f1 Simple @throw support.
llvm-svn: 55991
2008-09-09 16:16:55 +00:00
Steve Naroff 44cfcb6fb1 Tweak implementation for allowing ObjC builtin type redefinitions.
- Replace string comparisons with pre-defined idents.
- Avoid calling isBuiltinObjCType() to avoid two checks. 
- Remove isBuiltinObjCType(), since it was only used in Sema::MergeTypeDefDecl().
- Have Sema::MergeTypeDefDecl() set the new type.

This is a moidified version of an patch by David Chisnall.

llvm-svn: 55990
2008-09-09 14:32:20 +00:00
Steve Naroff 58d5ea7ac9 Simplify typesAreBlockCompatible().
llvm-svn: 55989
2008-09-09 13:47:19 +00:00
Argyrios Kyrtzidis 03849a2c5b Update VC++ project files.
llvm-svn: 55986
2008-09-09 11:39:45 +00:00
Anders Carlsson 9ff22483fd Add types and functions related to exceptions.
llvm-svn: 55984
2008-09-09 10:10:21 +00:00
Anders Carlsson 1963b0c38f Move handling of @try and @throw to the runtime class.
llvm-svn: 55983
2008-09-09 10:04:29 +00:00
Mon P Wang 919d1b3ff3 Added SSE4.1 packusdw
llvm-svn: 55978
2008-09-09 02:49:09 +00:00
Daniel Dunbar 41cf9dedc6 Change CodeGen to emit calls using (RValue,Type) list:
- Add CodeGenFunction::EmitAnyExprToTemp
   o Like EmitAnyExpr, but emits aggregates to a temporary location if
     none is available. Seems like this should be simpler (even aside
     from using first class aggregates).

 - Killed CodeGenFunction::EmitCallArg (just append the pair)

 - Conversion of RValues to actual call arguments is now isolated in
   CodeGenFunction::EmitCall.

llvm-svn: 55970
2008-09-09 01:06:48 +00:00
Mon P Wang b1851271a4 Added SSE41 pmovsx pmovzx intrinsics
llvm-svn: 55967
2008-09-09 00:19:01 +00:00
Daniel Dunbar 0beedc1684 Fix a number of issues w.r.t. emission of global for functions and
aliases.
 - Attributes specific to a definition are only set when the
   definition is seen.
 - Alias generation is delayed until the end of the module; necessary
   since the alias may reference forward.
 - Fixes: PR2743, <rdr://6140807&6094512>
 - Improves: <rdr://6095112> (added XFAIL)

Also, print module on verification failures.

llvm-svn: 55966
2008-09-08 23:44:31 +00:00
Daniel Dunbar 3d7c90b8ec Refactor parameter attribute handling:
- Add CGCall.h for dealing with ABI issues related to calls.
  - Add CGFunctionInfo and CGCallInfo for capturing ABI relevant
    information about functions and calls.
  - Isolate LLVM parameter attribute handling inside CGCall.cpp

llvm-svn: 55963
2008-09-08 21:33:45 +00:00
Daniel Dunbar 1e6ff5f37f Add ThreadSpecified bit to Decl.
- Patch from Kevin Tew.

llvm-svn: 55940
2008-09-08 20:05:47 +00:00
Daniel Dunbar 47be094138 Add missing RUN line
llvm-svn: 55934
2008-09-08 18:01:15 +00:00
Argyrios Kyrtzidis dee8291a14 Support C++'s declaration-statement.
llvm-svn: 55888
2008-09-07 18:58:01 +00:00
Nico Weber b0920374ca rename libclangSEMA to libclangSema
llvm-svn: 55887
2008-09-07 17:09:06 +00:00
Nuno Lopes fc8c680b89 skip test if llvm-gcc is requires but not found on the path.
someone with llvm-gcc installed please test if the Codegen/function-attributes.c test isn't skip in your system. thanks.

llvm-svn: 55871
2008-09-06 16:42:14 +00:00
Daniel Dunbar a46348c51b Key LLVM types for TagDecl's off of the clang Type, since there is now
a many-to-one relationship between TagDecl's and types.

llvm-svn: 55870
2008-09-06 02:26:43 +00:00
Eli Friedman 6565d45b5f Per PR2773, define __USER_LABEL_PREFIX__ for x86-32 Linux and Windows.
If you're on some other platform, the correct definition for this macro 
would be appreciated; to find the correct definition, just run the 
following command:

echo | gcc -dM -E - | grep USER_LABEL_PREFIX

llvm-svn: 55869
2008-09-06 01:37:51 +00:00
Steve Naroff 8de9c3affe More type checking for blocks. Still incomplete (will hopefully finish up this weekend).
llvm-svn: 55862
2008-09-05 22:11:13 +00:00
Ted Kremenek 6ddf53e4bd Add comment back that Argiris pointed out that I mistakenly removed (the comments below it were stale, so I accidently removed the whole thing).
llvm-svn: 55841
2008-09-05 17:39:33 +00:00
Ted Kremenek 2147570258 Change struct forward declarations and definitions to use unique RecordDecls, as opposed to creating a single RecordDecl and reusing it.
This change effects both RecordDecls and CXXRecordDecls, but does not effect EnumDecls (yet).

The motivation of this patch is as follows:
- Capture more source information, necessary for refactoring/rewriting clients.

- Pave the way to resolve ownership issues with RecordDecls with the forthcoming
  addition of DeclGroups.

Current caveats:
- Until DeclGroups are in place, we will leak RecordDecls not explicitly
  referenced by the AST.  For example:

    typedef struct { ... } x;  

  The RecordDecl for the struct will be leaked because the TypedefDecl doesn't
  refer to it.  This will be solved with DeclGroups.
  
- This patch also (temporarily) breaks CodeGen.  More below.

High-level changes:
- As before, TagType still refers to a TagDecl, but it doesn't own it.  When
  a struct/union/class is first referenced, a RecordType and RecordDecl are
  created for it, and the RecordType refers to that RecordDecl.  Later, if
  a new RecordDecl is created, the pointer to a RecordDecl in RecordType is
  updated to point to the RecordDecl that defines the struct/union/class.

- TagDecl and RecordDecl now how a method 'getDefinition()' to return the
  TagDecl*/RecordDecl* that refers to the TagDecl* that defines a particular
  enum/struct/class/union. This is useful from going from a RecordDecl* that
  defines a forward declaration to the RecordDecl* that provides the actual
  definition. Note that this also works for EnumDecls, except that in this case
  there is no distinction between forward declarations and definitions (yet).

- Clients should no longer assume that 'isDefinition()' returns true from a
  RecordDecl if the corresponding struct/union/class has been defined.
  isDefinition() only returns true if a particular RecordDecl is the defining
  Decl. Use 'getDefinition()' instead to determine if a struct has been defined.

- The main changes to Sema happen in ActOnTag. To make the changes more
  incremental, I split off the processing of enums and structs et al into two
  code paths. Enums use the original code path (which is in ActOnTag) and
  structs use the ActOnTagStruct. Eventually the two code paths will be merged,
  but the idea was to preserve the original logic both for comparison and not to
  change the logic for both enums and structs all at once.

- There is NO CHAINING of RecordDecls for the same RecordType. All RecordDecls
  that correspond to the same type simply have a pointer to that type. If we
  need to figure out what are all the RecordDecls for a given type we can build
  a backmap.

- The diff in CXXRecordDecl.[cpp,h] is actually very small; it just mimics the
  changes to RecordDecl. For some reason 'svn' marks the entire file as changed.

Why is CodeGen broken:
- Codegen assumes that there is an equivalence between RecordDecl* and
  RecordType*. This was true before because we only created one RecordDecl* for
  a given RecordType*, but it is no longer true. I believe this shouldn't be too
  hard to change, but the patch was big enough as it is.
  
I have tested this patch on both the clang test suite, and by running the static analyzer over Postgresql and a large Apple-internal project (mix of Objective-C and C).  

llvm-svn: 55839
2008-09-05 17:16:31 +00:00
Argyrios Kyrtzidis 2545aeb710 Support "typeof unary-expression" (GNU C++ extension).
llvm-svn: 55833
2008-09-05 11:26:19 +00:00
Argyrios Kyrtzidis 971dd236f0 Set different header search paths for the Windows platform.
llvm-svn: 55832
2008-09-05 09:41:20 +00:00
Argyrios Kyrtzidis 624cab87dc Add header search paths for Mingw32 (GCC version 4).
llvm-svn: 55830
2008-09-05 09:03:53 +00:00
Argyrios Kyrtzidis 91c3f526dc Line endings: CRLF -> LF
llvm-svn: 55829
2008-09-05 08:53:53 +00:00
Daniel Dunbar 7de5e3b111 Fix placement of const on a number of X86 builtins.
llvm-svn: 55827
2008-09-05 05:56:16 +00:00
Daniel Dunbar 0335024c4a Test case for previous commit (Workaround gcc bug causing crash on our
preprocessed outputs)

llvm-svn: 55826
2008-09-05 03:23:51 +00:00
Daniel Dunbar 98e0e535bd Workaround gcc bug causing crash on our preprocessed outputs.
- gcc is not happy if we start a preprocessed file with
#line 1 "XXX" 1
 - Workaround by making sure file starts with a simple #line change.

Also, factored WriteLineInfo out.

Also, fixed bug where FileType was not being correctly updated.

llvm-svn: 55825
2008-09-05 03:22:57 +00:00
Ted Kremenek cb36325316 Remove stale comments.
llvm-svn: 55822
2008-09-05 01:38:34 +00:00
Ted Kremenek 47923c7e59 Remove "NextDecl" from RecordDecl. This change touches many files that where RecordDecl or CXXRecordDecl was constructed, always with an argument of 'NULL' for the previous declaration.
The motivation behind this change is that chaining the RecordDecls is simply unnecessary.  Once we create multiple RecordDecls for the same struct/union/class, clients that care about all the declarations of the same struct can build a back map by seeing which Decls refer to the same RecordType.

llvm-svn: 55821
2008-09-05 01:34:33 +00:00
Daniel Dunbar 2ffee610da Set sext/zext on function result.
- <rdar://problem/6156739>

llvm-svn: 55815
2008-09-05 00:57:45 +00:00
Ted Kremenek c92c134563 Patch to scan-build by Jordan Breeding:
- Don't remove $BaseDir; may be unsafe
- Always create HTML directory with parents

llvm-svn: 55813
2008-09-04 23:56:36 +00:00
Daniel Dunbar 449a339ffd Set function attributes (sext, zext, etc.) on Objective-C methods.
llvm-svn: 55812
2008-09-04 23:41:35 +00:00
Ted Kremenek f82dab1a7a Updated checker build.
llvm-svn: 55810
2008-09-04 23:13:30 +00:00