Commit Graph

702 Commits

Author SHA1 Message Date
Chris Lattner daaa8ba77e 1) Enforce C99 6.7.3p2: "Types other than pointer types derived from
object or incomplete types shall not be restrict-qualified."

2) Warn about qualifiers on function types: C99 6.7.3p8: "If the 
specification of a function type includes any type qualifiers, the 
behavior is undefined."

3) Implement restrict on C++ references.

4) fix some locations for various C++ reference diagnostics.

llvm-svn: 49081
2008-04-02 06:50:17 +00:00
Chris Lattner a21ad8058a Fix several bugs in array -> pointer decomposition.
First, we got several CVR propagation cases wrong, which Eli pointed
out in PR2039.

Second, we didn't propagate address space qualifiers correctly, leading
to incorrect lowering of code in CodeGen/address-space.c.

Third, we didn't uniformly propagate the specifier in the array to the
pointer ("int[restrict 4]" -> "int *restrict").

This adds an ASTContext::getArrayDecayedType member that handles the 
non-trivial logic for this seemingly simple operation.

llvm-svn: 49078
2008-04-02 05:18:44 +00:00
Chris Lattner 81cb9e8637 Fix PR2017 and silence some bogus errors.
llvm-svn: 49068
2008-04-02 01:05:10 +00:00
Steve Naroff 257520b1b4 Fairly large "cleaup" related to changing ObjCCompatibleAliasDecl superclass (to inherit from NamedDecl, instead of ScopedDecl).
- Added a DenseMap to associate an IdentifierInfo with the ObjCCompatibleAliasDecl.
- Renamed LookupScopedDecl->LookupDecl and changed it's return type to Decl. Also added lookup for ObjCCompatibleAliasDecl's.
- Removed Sema::LookupInterfaceDecl(). Converted clients to used LookupDecl().
- Some minor indentation changes.

Will deal with ObjCInterfaceDecl and getObjCInterfaceDecl() in a separate commit...

llvm-svn: 49058
2008-04-01 23:04:06 +00:00
Ted Kremenek f646774f32 Added path-sensitive check for return statements that return the address
of a stack variable.  This is the path-sensitive version of a check that
is already done during semantic analysis.

llvm-svn: 48980
2008-03-31 15:02:58 +00:00
Chris Lattner 59a2594f3f rename Decl::CompatibleAlias -> ObjCCompatibleAlias.
Fix objc ivar lookup.  Ivar lookup should occur between lookup
of method-local values and lookup of globals.  Emulate this with
some logic in the handling of Sema::ActOnIdentifierExpr.

Two todo's left:
 1) sema shouldn't turn a bare reference to an ivar into "self->ivar"
    in the AST.  This is a hack.
 2) The new ScopedDecl::isDefinedOutsideFunctionOrMethod method does
    not correctly handle typedefs and enum constants yet.

llvm-svn: 48972
2008-03-31 00:36:02 +00:00
Steve Naroff f9e7c90129 Only have the rewriter produce a file when there are no errors.
llvm-svn: 48926
2008-03-28 22:26:09 +00:00
Steve Naroff 0de4199ca0 Make sure Sema::ActOnClassMessage() correctly diagnoses "super".
llvm-svn: 48924
2008-03-28 21:37:05 +00:00
Ted Kremenek 276278e5d2 Expanded NSString checking to check for nil for a few more methods.
llvm-svn: 48898
2008-03-27 22:05:32 +00:00
Ted Kremenek 2e4e7ccb22 Add line SourceLocation to NSString checks.
Added test case to test warning about passing 'nil' to NSString's compare: method.

llvm-svn: 48896
2008-03-27 21:23:57 +00:00
Steve Naroff c10c2e339f Fix rewriter tests to work with new output file logic. This changes forces the output to standard out (rather than generate a .cpp file, which is the new default for the rewriter).
llvm-svn: 48847
2008-03-26 22:28:40 +00:00
Ted Kremenek 9dd6ddec63 Added test case for static analysis to warn about passing uninitialized values as arguments (not the receiver) in message expressions.
llvm-svn: 48845
2008-03-26 22:00:11 +00:00
Ted Kremenek a1d9ed137a Added test case for static analyzer to detect uses of uninitialized pointers as receivers in Objective-C message expressions.
Added test case directory "Analysis-Apple" which is only run on Apple (darwin) machines.

llvm-svn: 48844
2008-03-26 21:51:44 +00:00
Nuno Lopes 623207d603 allow the format attribute to be specified in function pointer prototypes
# this is my first commit here, so please be gentle :)

llvm-svn: 48807
2008-03-25 23:01:48 +00:00
Nate Begeman c506c78117 Extend QualType::getAddressSpace to do the right thing for array types, and in
the future, RecordTypes.

llvm-svn: 48784
2008-03-25 18:36:32 +00:00
Sam Bishop ac92a13c86 The newest version of valgrind, 3.3.0, no longer appends PIDs to log filenames
by default.  Adding a %p works with this new version and is backwards
compatible, though it looks a little funny.

llvm-svn: 48698
2008-03-23 03:42:18 +00:00
Ted Kremenek fb475ec504 Changed merge operation for uninitialized values analysis to "intersect" (previous union).
The effect is that if a variable is uninitialized along a branch (but initialized along another), at merge points it is considered uninitialized.  Previously we had the opposite behavior.  The new behavior is more conservative, and more in line with gcc's behavior.

llvm-svn: 48689
2008-03-22 20:11:00 +00:00
Chris Lattner 97d496c182 Teach the rewriter how to respect the -o option.
llvm-svn: 48669
2008-03-22 00:08:40 +00:00
Chris Lattner 4f55259237 fix this test.
llvm-svn: 48668
2008-03-22 00:07:50 +00:00
Sam Bishop f4303edfa3 Only invoke the preprocessor; it's the only thing being tested. Also, check
the output to make sure that the macros and comments are being treated as such.

llvm-svn: 48638
2008-03-21 08:05:55 +00:00
Sam Bishop 558447416d Use the -E option when invoking clang. Only the preprocessor is
required to perform this test.

llvm-svn: 48636
2008-03-21 07:02:04 +00:00
Gabor Greif 56c563ad3f Add ability to run clang tests under valgrind. Patch by Sam Bishop.
llvm-svn: 48621
2008-03-20 22:50:54 +00:00
Gabor Greif f5eb286707 reduce chattyness of makefiles
llvm-svn: 48597
2008-03-20 14:28:22 +00:00
Gabor Greif 4fa19e4047 scan testdirs only once, patch by Mike Stump, thanks!
llvm-svn: 48589
2008-03-20 08:09:10 +00:00
Ted Kremenek c6a8352820 Convert tabs to spaces.
llvm-svn: 48539
2008-03-19 07:31:52 +00:00
Gabor Greif 831c7c52c7 add 'clean' targets, make sure that 'make test' works after 'make clean'
llvm-svn: 48488
2008-03-18 07:03:00 +00:00
Gabor Greif 8bdc7b057d let the %t magic happen, thanks Chris!
llvm-svn: 48487
2008-03-18 06:42:43 +00:00
Gabor Greif 1ac5215798 finishing touches: teminate the dots with a newline
llvm-svn: 48462
2008-03-17 18:36:14 +00:00
Gabor Greif 5434053f6d Implemented verbose mode.
make test VERBOSE=1
should now produce the same output like
the Makefile normally does.
Without VERBOSE only the names of failed tests
are printed.

I am pretty comfortable with this version, and
I think it is time to switch over to Makefile.parallel
to be the default.

What do you think? Did I forget some piece of feedback?

llvm-svn: 48458
2008-03-17 16:29:58 +00:00
Gabor Greif 430efdb95b Simplify further by creating *.testresults files
inside of the Output/ directory.
The testclean target could be removed now.

llvm-svn: 48457
2008-03-17 15:58:58 +00:00
Gabor Greif 4892b3fd5b Get rid of the creation of secondary makefile "Makefile.tests".
This implements second part of
<http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080310/004727.html>.

llvm-svn: 48456
2008-03-17 15:37:09 +00:00
Gabor Greif 2fc473069d More review feedback implemented:
Get rid of "awk" dependence by using same "make"
functionality:

<http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080310/004727.html>

llvm-svn: 48455
2008-03-17 15:07:59 +00:00
Gabor Greif d8d1b60237 Actually expand the %t1 patterns (in RUN: lines) to a unique
filename.
This fixes (e.g.) CodeGen/struct-x86-darwin.c which
raced at writing to "%t1" with other tests when parallel
testing was specified with a high "-j XX" value.

Also gets rid of the file tools/clang/test/%t1
when doing an "svn st" after testing.

llvm-svn: 48454
2008-03-17 13:45:47 +00:00
Gabor Greif 8eea5b51b5 Second round of review feedback.
* print out message when tests start
* testrunner sets status now
* on failed test run print out test name

I tested these changes with the non-parallel makefile
and it did not break.

llvm-svn: 48453
2008-03-17 12:35:00 +00:00
Gabor Greif 2c7f144ab7 implement a bit of feedback: print dots
llvm-svn: 48394
2008-03-15 08:11:35 +00:00
Gabor Greif 322f055e05 First draft of a parallelized test methodology. Improvements soon.
llvm-svn: 48391
2008-03-15 07:26:41 +00:00
Nate Begeman b561de7455 Correctly error on arrays with automatic storage full of objects with
non-default address space, and fix comment.
Add a test for this.

llvm-svn: 48366
2008-03-14 18:07:10 +00:00
Nate Begeman 144625ef9b ISO/IEC TR 18037
An address space name cannot be used to qualify an object that has automatic
storage duration.  Still not catching ASQual'd allocas of array type, just 
scalars at the moment.

llvm-svn: 48350
2008-03-14 00:22:18 +00:00
Steve Naroff 35cb7960e3 Two fixes to RewriteTest::RewriteObjCIvarRefExpr():
- For explicit ivar refers, make sure the cast is propagated to the AST.
- Don't free the base (since it is still in use).
This fixes the recent regression to test/Rewriter/objc-ivar-receiver-1.m.

llvm-svn: 48309
2008-03-12 23:15:19 +00:00
Steve Naroff 4182fd56ad Since the rewriter now outputs C++, it no longer makes sense to pipe the output to clang.
This should "fix" all but one of the test failure.

llvm-svn: 48275
2008-03-12 02:07:40 +00:00
Chris Lattner 4114219ac6 rewriter tests are darwin specific, don't run them on other platforms.
llvm-svn: 48168
2008-03-10 19:32:31 +00:00
Chris Lattner 3e4683262e implement simple support for arbitrary token lookahead. Change the
objc @try parser to use it, fixing a FIXME.  Update the 
objc-try-catch-1.m file to pass now that we get more reasonable 
errors.

llvm-svn: 48129
2008-03-10 06:06:04 +00:00
Nate Begeman be6bb8efac Add new test
llvm-svn: 48018
2008-03-07 20:04:49 +00:00
Ted Kremenek 7bdd630334 Patch by Nuno Lopes:
Added more comments for code processing attribute "format".
  Added more checks for corner cases, test cases, and warnings.

llvm-svn: 48011
2008-03-07 18:43:49 +00:00
Chris Lattner 54ee63886e remove two obsolete tests, not sure why my previous commit didn't commit the removal.
llvm-svn: 47986
2008-03-06 05:47:17 +00:00
Chris Lattner 855d024a83 Remove the first layer of support for "portability" warnings. This is
theoretically useful, but not useful in practice.  It adds a bunch of 
complexity, and not much value.  It's best to nuke it.  One big advantage
is that it means the target interfaces will soon lose their SLoc arguments
and target queries can never emit diagnostics anymore (yay).  Removing this
also simplifies some of the core preprocessor which should make it slightly
faster.

Ted, I didn't simplify TripleProcessor, which can now have at most one
triple, and can probably just be removed.  Please poke at it when you have
time.

llvm-svn: 47930
2008-03-05 01:18:20 +00:00
Chris Lattner 0fdc379475 The operand to the visibility attribute is required to be a quoted string, not a bare identifier.
llvm-svn: 47893
2008-03-04 18:08:48 +00:00
Chris Lattner 8e48dfe9a1 move deprecated -> attributes.c
llvm-svn: 47856
2008-03-03 21:17:42 +00:00
Gabor Greif e2e5c3f394 The attribute nothrow maps to llvm attribute nounwind. Fix testcase.
llvm-svn: 47841
2008-03-03 14:53:09 +00:00
Gabor Greif 76ac5cf9d3 Chris added this testcase with r47837. The mail only shows one todo-warning but I see 3. Strangeness. Correcting lines 16 and 24.
llvm-svn: 47840
2008-03-03 14:30:39 +00:00