Граф коммитов

830 Коммитов

Автор SHA1 Сообщение Дата
Nuno Lopes 9a979c327c fix CheckForConstantInitializer() for Compound Literals
also fix the correspondent test (it was expecting more errors than it should. please confirm my fix is correct (at least gcc agrees with me)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 16:46:50 +00:00
Argyrios Kyrtzidis 560624a84e '&&' commands together so that the test status reflects the results of all the commands, otherwise the test status will be the result of only the last command.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-04 10:33:02 +00:00
Ted Kremenek 489f7b6419 '&&' clang commands together so that the test status reflects the results of all three clang executions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53132 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-04 04:38:48 +00:00
Ted Kremenek 03648657c7 Fix a bug in the dead stores checker reported in the following email:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002157.html

Essentially the observer mechanism in LiveVariables was observing block-level
expressions multiple times, leading to a case where the dead store checker could
see a value as dead when it was really live.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53115 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 22:25:27 +00:00
Ted Kremenek aeca9637ce Skip the "-dealloc" check if a ObjC class contains no ivars.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53100 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 15:37:02 +00:00
Ted Kremenek db09a4dee2 Added static analysis check to see if a subclass of NSObject implements -dealloc, and whether or not that implementation calls [super dealloc].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 04:29:21 +00:00
Chris Lattner e60cff1089 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53071 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 03:53:40 +00:00
Chris Lattner b081a350b5 Fix PR2252: don't warn on negating an unsigned value ever, and don't emit
'integer constant is so large that it is unsigned' warning for hex literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53070 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 03:47:30 +00:00
Chris Lattner 14943b90d9 Fix PR2020 by recovering by defining an anonymous enum, instead of recovering
by filling in the body of a union with enum constants.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 03:30:58 +00:00
Ted Kremenek 90a929e240 Update test case with new clang arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 23:18:57 +00:00
Ted Kremenek e81da5080c Update test case: simply running "clang -checker-simple" doesn't invoke the dead store checker anymore. We need "-warn-dead-stores" as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53055 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 23:18:22 +00:00
Ted Kremenek 141d8a059b Fix typo in test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53024 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 15:28:06 +00:00
Ted Kremenek f4381fddf1 Added AnalysisConsumer, a meta-level ASTConsumer class to drive various
analyses. This potentially is the primordial origins of a Clang-equivalent
"PassManager".

The new AnalysisConsumer interface allows multiple analyses to be run from a
single invocation of Clang.

Migrated the logic of "-warn-dead-stores" and "-warn-uninit-values" to use the
new AnalysisConsumer interface. The new interface results in a significant code
reduction to incorporate an analysis into the Driver.

Updated a test case to (correctly) acknowledge that it contains a dead store
(this check wasn't being performed because it was previously masked by
-warn-uninit-values).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52996 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 00:03:09 +00:00
Ted Kremenek 91d1a14be8 Added reference count checker test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52993 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 23:29:51 +00:00
Argyrios Kyrtzidis 07952324dd Add Sema support for C++ classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52956 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 10:37:29 +00:00
Chris Lattner 413d355e38 Fix a bug reported by Kelly Wilson, where we incorrectly
rejected FP immediates like 08.123


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 06:44:49 +00:00
Chris Lattner e5c5ee1cff Make ProcessDeclAttributes walk the declarator structure pulling
decl attributes out of the various places they can hide.  This makes
us correctly reject things like this:

t.c:2:22: error: mode attribute only supported for integer and floating-point types
  int **__attribute((mode(HI)))* i32;
                     ^

because you can't make a pointer be HImode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-29 00:16:31 +00:00
Argyrios Kyrtzidis 3a9fdb4742 Handle unnamed bitfields when parsing C++ classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52855 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-28 08:10:48 +00:00
Eli Friedman ad74a75818 Fix for PR2501; this patch makes usual arithmetic conversions for
integers which have the same width and different signedness work 
correctly. (The testcase in PR2501 uses a comparison between long and 
unsigned int).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52853 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-28 06:23:08 +00:00
Chris Lattner 3cc5e5b526 Fix a bug where we didn't promote 'const float' (or typedefs) to
double in some places.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52846 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-27 22:48:56 +00:00
Ted Kremenek 04bc87683a Added a simple static analysis check to look for improper uses of CFCreateNumber.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 23:59:48 +00:00
Chris Lattner f37da0ea0e rename some attr tests for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52770 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 06:32:02 +00:00
Chris Lattner fca0ddd429 fix a bug handling type attributes in the declspec. declspec processing
used to mutate the attribute list for declspecs when the type was 
converted, breaking the case where one declspec was shared by multiple
declarators.

This fixes rdar://6032532.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52769 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 06:27:57 +00:00
Chris Lattner abca36155c fix this testcase after Mon Ping's intrinsic rename.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52754 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 04:06:27 +00:00
Ted Kremenek 553cf18cd4 CF ref checker:
Tracked objects now have their type information tracked with them.

Enhanced summaries for ObjC methods to include the type information of the receiver.

Used the enhanced summaries to support the idiom that NSWindow owns itself (it sends a release message to itself upon close).

Added some comments.

Did some cleanups with the checker logic using operator overloading (reduced redundant code which I was concerned about being the source of bugs).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52741 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 21:21:56 +00:00
Argyrios Kyrtzidis 4cc18a4d52 Add parsing support for C++ classes.
Note that Parser::ParseCXXMemberSpecification is temporarily disabled until the Sema support is in place.
Once ParseCXXMemberSpecification is enabled, the Parser/cxx-class.cpp test will pass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 22:12:16 +00:00
Ted Kremenek a73447013c The CF retain/release checker now assumes that allocations do not fail. Eventually we will add a flag to the driver to enable allocation failures (documented as a FIXME).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 18:02:52 +00:00
Chris Lattner 13fd7e5111 "this patch adds code generation hooks for Objective-C constant strings. It also modifies Sema so that Objective-C constant strings are treated as untyped objects if the interface for the constant string class can not be found. This is consistent with Apple GCC. I thought it was consistent with GNU GCC, since this was causing failures when trying to compile GNUstep with (GNU) GCC, but it appears that this is not the case when attempting to produce a simple test case to demonstrate it. Possibly there is a way of making the error go away, but I haven't found out what it is yet."
Patch by David Chisnall!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52599 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 21:44:18 +00:00
Chris Lattner 6ee1f9c014 "This moves built-in Objective-C types up the scope chains to where they can be replaced by versions included from the runtime library's headers."
This makes it ok to use @"foo" without a declaration for NSConstantString.

Patch by David Chisnall!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52593 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 20:20:39 +00:00
Chris Lattner 5a6ddbf295 add parser and sema support for the funny ObjC '@defs' thing.
Patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52586 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:39:06 +00:00
Chris Lattner 0d17f6f7b1 Switch 'super' from being a weird cast thing to being a predefined expr node.
Patch by David Chisnall with objc rewriter and stmtdumper updates from me.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52580 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 18:04:54 +00:00
Ted Kremenek 39a1884968 Include stdint.h instead of stdio.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52578 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 17:20:55 +00:00
Ted Kremenek 5bce1b0f57 Test the dead-store checker using both -warn-dead-stores and -checker-simple.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52568 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 23:14:52 +00:00
Ted Kremenek 1a654b60ef Modified the dead stores checker to...
1) Check if a dead store appears as a subexpression.  For such cases, we emit
   a verbose diagnostic so that users aren't confused.  This addresses:
   
   <rdar://problem/5968508> checker gives misleading report for dead store in loop
   
2) Don't emit a dead store warning when assigning a null value to a pointer.
   This is a common form of defensive programming.  We may wish to make
   this an option to the the checker one day.
   
   This addresses the feature request in the following email:
   
   http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-June/001978.html



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 21:45:25 +00:00
Ted Kremenek b8e26e63d9 Introduce initial transfer function support for __imag__ and __real__. We don't
have complex RValues yet, so this logic is only fully implemented when __imag__
and __real__ are used on non-complex types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 17:55:38 +00:00
Eli Friedman 5395ef04e9 Make this test actually pass, in addition to the previous patch
which made it work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52382 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 05:36:46 +00:00
Ted Kremenek dd536bfa8b Remove Analysis-Apple.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52366 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:21:48 +00:00
Ted Kremenek d54ae2a8ea Move test case "uninit-msg-expr.m" from Analysis-Apple to Analysis (now works on all platforms).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52362 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:15:29 +00:00
Ted Kremenek 32dc95e1ae Moved test case NoReturn.m from Analysis-Apple to Analysis (now works on all platforms).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:05:04 +00:00
Ted Kremenek 859be3b1e7 Move NSString.m test case from Analysis-Apple to Analysis. The test case now works on all platforms.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 20:37:30 +00:00
Ted Kremenek 4b5484aceb Update test case to use -pedantic (makes the test case more clear).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 19:53:46 +00:00
Ted Kremenek dfc996c9d5 Fix misspelling of "svelte".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52348 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 19:51:41 +00:00
Ted Kremenek 7662af466e Move Analysis-Apple/CFString.c to Analysis (the test case now works on all platforms).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52346 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 19:35:31 +00:00
Ted Kremenek 88739bff1d Move CFDateGC.m test case from Analysis-Apple to Analysis (it now runs on all platforms).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52344 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:46:17 +00:00
Ted Kremenek 2f134c609f Moved CFDate.m from test/Analysis-Apple to test/Analysis, and added the necessary declarations from Foundation.h to CFDate.m so that the test case can be exercised on all platforms.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:34:22 +00:00
Ted Kremenek df220837ce Add test case for NSString format-string checking.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52337 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:01:05 +00:00
Eli Friedman 1e692ace08 Basic support for volatile loads and stores. Stores the volatile
qualifier in the lvalue, and changes lvalue loads/stores to honor 
the volatile flag.  Places which need some further attention are marked 
with FIXMEs.

Patch by Cédric Venet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 23:01:12 +00:00
Argyrios Kyrtzidis 874f608ec1 Fix broken test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52232 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 12:44:52 +00:00
Argyrios Kyrtzidis c577a0e9bf Multiple tests in a single test file must be linked with '&&'.
Otherwise, failing tests other than the last one will not be reported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52231 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 12:40:02 +00:00
Eli Friedman 54ecfce94b Don't crash if we can't find FileEntry info for a typedef, since one
isn't guaranteed to exist. This fixes a crash with conflicting typedefs
coming from stdin.

This also fixes the crash in PR2406, but doesn't completely fix the 
issue; it appears there's something strange about the physical location 
for the definition of int64_t in stdlib.h.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52209 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 06:20:39 +00:00