Commit Graph

833 Commits

Author SHA1 Message Date
Ted Kremenek bba6a4b367 Update CF reference count checker test case to illustrate the use of
toll-free bridging.

llvm-svn: 49772
2008-04-16 04:29:21 +00:00
Ted Kremenek 15d8f4cc27 Added test case illustrating the use of '&'.
llvm-svn: 49735
2008-04-15 18:37:29 +00:00
Steve Naroff 1dc53ef494 Rename RewriteTest->RewriteObjC.
llvm-svn: 49692
2008-04-14 22:03:09 +00:00
Ted Kremenek 69a4df4cb7 Updated test cases so that they do not emit warnings for dead stores.
llvm-svn: 49659
2008-04-14 17:40:10 +00:00
Ted Kremenek 16a8a3be41 Added test case to dead stores checker.
llvm-svn: 49647
2008-04-14 15:56:17 +00:00
Douglas Gregor 556877c1e6 This patch adds very basic support for parsing and type-checking class
inheritance in C++. It'll parse the base-specifier list, e.g.,

 class D : public B1, virtual public B2 { };

and do some of the simpler semantic checks (B1 and B2 are classes;
they aren't unions or incomplete types, etc).

llvm-svn: 49623
2008-04-13 21:30:24 +00:00
Douglas Gregor 83a586ec19 Introduce support for finding class and enum names via ordinary name lookup in C++
llvm-svn: 49621
2008-04-13 21:07:44 +00:00
Chris Lattner f8f945499c Fix PR2220, making diagnostics for unexpected tokens in pp expressions
more nice.

llvm-svn: 49619
2008-04-13 20:38:43 +00:00
Chris Lattner d71f83a8cb this started failing because a GEP was constant folded,
improve the robustness of the test.

llvm-svn: 49618
2008-04-13 19:54:28 +00:00
Chris Lattner b0d3844fb8 Default argument cleanups and minor improvements, patch by
Doug Gregor!

llvm-svn: 49598
2008-04-12 23:52:44 +00:00
Ted Kremenek a7c44113bc Changed behavior of how we handle "NULL" summaries: just call
GRSimpleVals::EvalCal(), and don't change reference counts.

Remove "getDoNothingSummary()", as a NULL summary does the same thing.

Added temporary hack for the "Get" rule for objects that return a pointer type:
treat them as non-owned CF objects.

Added test case to detect the release of a non-owned object.

llvm-svn: 49555
2008-04-11 20:11:19 +00:00
Ted Kremenek 4b77209694 Fixed some logic errors in the CF ref count checker; we now can detect simple
use-after-release errors.  Added test case.

llvm-svn: 49509
2008-04-10 23:44:06 +00:00
Ted Kremenek 4a78c3ae11 Refactored all logic to run the GRSimpleVals and CFRef checker into a common
code path in the clang driver.

Renamed options --grsimple to -checker-simple and -check-cfref to -checker-cfref.

llvm-svn: 49500
2008-04-10 22:16:52 +00:00
Chris Lattner 0e91b41902 typedef void T;
void f(T);

is only invalid in C++ mode, not C89 mode.

llvm-svn: 49460
2008-04-10 02:26:16 +00:00
Chris Lattner 58258246ec Several improvements from Doug Gregor related to default
argument handling.  I'll fix up the c89 (void) thing next.

llvm-svn: 49459
2008-04-10 02:22:51 +00:00
Chris Lattner aa9c7aed0f Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!

llvm-svn: 49369
2008-04-08 04:40:51 +00:00
Chris Lattner 3c7961597f merge compatibility testing of qualified/unqualified interfaces together
and fix a bug.

llvm-svn: 49322
2008-04-07 06:38:24 +00:00
Chris Lattner c9062d01d7 MyOtherClass<MyProtocol>* is compatible with MyClass*
if MyClass is a superclass of MyOtherClass, there is no need for
an exact interface match.

llvm-svn: 49320
2008-04-07 06:06:56 +00:00
Chris Lattner 56a7bf5a7e remove the old non-parallel test system. 'make' in clang/test now runs
the tests in parallel.

llvm-svn: 49290
2008-04-06 22:32:01 +00:00
Chris Lattner 285a3e47be reject 'int test(x, x) int x; {}'
llvm-svn: 49271
2008-04-06 06:50:56 +00:00
Chris Lattner 67b450cb48 reject 'typedef int y; int test(x, y)'.
llvm-svn: 49270
2008-04-06 06:47:48 +00:00
Chris Lattner 9d51f2b9d4 Fix handling of implicit int, resolving PR2012 and reverting (and
subsuming) my patch for PR1999.

llvm-svn: 49251
2008-04-05 06:32:51 +00:00
Chris Lattner 94fc8063b4 Step #1 to fixing PR2012: c89 allows declspecs to be completely
missing from function definitions only.  If we see a function 
definiton with missing declspecs, just fudge in an int.

llvm-svn: 49250
2008-04-05 05:52:15 +00:00
Chris Lattner 579a05d767 Fix PR2049, updating Eli's patch that fixes to mainline. This produces incorrect
code, but the codegen doesn't crash.  I'll file a bugzilla for the AST being wrong.

llvm-svn: 49226
2008-04-04 18:42:16 +00:00
Chris Lattner f3bc75afcf Since isComplexType() no longer returns true for _Complex integers, the code
generator needs to call isAnyComplexType().  This fixes PR1960.

llvm-svn: 49220
2008-04-04 16:54:41 +00:00
Steve Naroff 3913ea4bfb Add explicit support for diagnosing implicit function decls.
Without this, the diagnostic is very confusing. The diag is now consistent with gcc as well.

llvm-svn: 49214
2008-04-04 14:32:09 +00:00
Seo Sanghyeon 055c94f2f8 PR1963: Address of function is a constant expression
llvm-svn: 49212
2008-04-04 09:45:30 +00:00
Chris Lattner e799eb5daa Fix PR2081 (problems codegen'ing some recursive structures) patch
by Lauro Venancio!

llvm-svn: 49144
2008-04-03 05:50:42 +00:00
Steve Naroff 778927532d Change ObjCInterfaceDecl to inherit from NamedDecl (not TypeDecl). While ObjCInterfaceDecl is arguably a TypeDecl, it isn't a ScopedDecl. Since TypeDecl's are scoped, it makes sense to simply treat them as NamedDecl's. I could have fiddled a bit more with the hierarchy (in terms of creating a non-scoped TypeDecl), however this probably isn't worth the effort.
I also finished unifying access to scope decl change by converting Sema::getObjCInterfaceDecl() to use Sema::LookupDecl(). This is much cleaner now:-)

llvm-svn: 49107
2008-04-02 18:30:49 +00:00
Chris Lattner 6f6d226f63 improve error to be something end users will actually understand :)
llvm-svn: 49097
2008-04-02 17:15:17 +00:00
Ted Kremenek 018ba60f8e Added path-sensitive null dereference test case.
llvm-svn: 49095
2008-04-02 16:54:39 +00:00
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
Chris Lattner 65079bd9be fix codegen support for functions that are nothrow and noreturn.
llvm-svn: 47838
2008-03-03 03:45:26 +00:00
Chris Lattner 8496639787 Add a bunch of attributes, patch by Nuno Lopes.
llvm-svn: 47837
2008-03-03 03:28:21 +00:00
Steve Naroff b96e4ab649 Fix http://llvm.org/bugs/show_bug.cgi?id=2103.
llvm-svn: 47775
2008-02-29 23:30:25 +00:00
Steve Naroff 83777fef1a Fix http://llvm.org/bugs/show_bug.cgi?id=2106.
llvm-svn: 47768
2008-02-29 21:48:07 +00:00
Chris Lattner f4c1aa67bd testcase for attr deprecated, by Nuno Lopes.
llvm-svn: 47757
2008-02-29 18:11:31 +00:00
Lauro Ramos Venancio 01a72ff5d3 Implement codegen for the following static var init.
void g() {
  static char a[10];
  static char *b = a;
}

Now we can compile wget!

llvm-svn: 47627
2008-02-26 21:41:45 +00:00
Lauro Ramos Venancio 8af648ac55 Fix a bug in ConvertAsmString function.
llvm-svn: 47618
2008-02-26 19:19:58 +00:00
Lauro Ramos Venancio c9fbd7301a Convert x86 target specific inline asm constraints to LLVM.
llvm-svn: 47609
2008-02-26 18:33:46 +00:00
Lauro Ramos Venancio 8983891531 Fix PR2086.
llvm-svn: 47551
2008-02-25 19:03:15 +00:00
Chris Lattner 5329e7e5ed Fix PR2090, a typo in digraph processing.
llvm-svn: 47540
2008-02-24 19:05:57 +00:00
Nate Begeman b16d53ea31 add a test case
llvm-svn: 47455
2008-02-21 19:44:16 +00:00
Eli Friedman c62dd9d345 Some const initializer tests for stuff I just committed.
llvm-svn: 47442
2008-02-21 18:07:36 +00:00
Chris Lattner 3b418d8446 implement codegen support for sizeof(void), fixing PR2080.
llvm-svn: 47429
2008-02-21 05:45:29 +00:00
Chris Lattner a2417c9d8b add some semantic checks for address spaces.
llvm-svn: 47423
2008-02-21 01:42:41 +00:00
Lauro Ramos Venancio e2162c6549 Simplify aggregate initilizer implementation. Use the CodeGenModule::EmitConstantExpr method when
possible.
Fix mediabench/mpeg2/mpeg2dec test.

llvm-svn: 47336
2008-02-19 19:27:31 +00:00
Chris Lattner d2a02fe840 fix the second half of PR2041: __restrict is ok in c90 mode, even if
restrict isn't.

llvm-svn: 47316
2008-02-19 06:46:10 +00:00
Lauro Ramos Venancio c58fc4052e A global without initializer must be emitted as weak.
Fix Olden/bh test.

llvm-svn: 47292
2008-02-19 00:04:15 +00:00
Lauro Ramos Venancio dec89733a7 Implement multi-dimension array initalizer.
Fix McCat/08-main test.

llvm-svn: 47286
2008-02-18 22:44:02 +00:00
Steve Naroff f631ae2cf8 Tweak fix for http://llvm.org/bugs/show_bug.cgi?id=2000 to work across typedefs.
llvm-svn: 47269
2008-02-18 15:14:59 +00:00
Chris Lattner b080ed504e Fix PR2042. One remaining issue: we don't currently diagnose
int foobar(int);
 int foobar() {}

which requires ifdef'ing out a testcase in predefined-function.c.

llvm-svn: 47236
2008-02-17 19:31:09 +00:00
Eli Friedman f7e92acaba Implemnt isVariablyModifiedType correctly.
llvm-svn: 47233
2008-02-17 00:59:11 +00:00
Chris Lattner df53e20f2d implement codegen support for aggregates casted to void.
llvm-svn: 47226
2008-02-16 23:55:16 +00:00
Lauro Ramos Venancio bada8d4b5b Implement extern block var.
llvm-svn: 47223
2008-02-16 22:30:38 +00:00
Anders Carlsson f13b1efa75 Add more tests
llvm-svn: 47217
2008-02-16 19:51:36 +00:00
Chris Lattner 27055194b7 Fix CheckEndOfDirective to diagnose lines that contain macros that expand to
zero tokens.  This fixes PR2045, thanks to Neil for finding another 
incredibly subtle corner case :)

llvm-svn: 47203
2008-02-16 01:20:36 +00:00
Anders Carlsson 3ea23a45d9 Make sizeof and __alignof work correctly with packed structs.
llvm-svn: 47202
2008-02-16 01:20:23 +00:00
Chris Lattner 287c734075 Fix PR2041: restrict is not a keyword in c90.
llvm-svn: 47160
2008-02-15 18:02:59 +00:00
Eli Friedman 78e47634b2 Get rid of outdated code that masks type errors. Fixes PR2036.
llvm-svn: 47154
2008-02-15 06:56:02 +00:00
Eli Friedman e9d0954c06 Nevermind, these tests work... I messed up my testing.
llvm-svn: 47153
2008-02-15 06:29:53 +00:00
Eli Friedman a01cfa75eb Partial fix for struct compatibility; there's still something messy
going on with mixing scopes, though.

llvm-svn: 47152
2008-02-15 06:03:44 +00:00
Steve Naroff f631997cb5 A much better fix for http://llvm.org/bugs/show_bug.cgi?id=1987.
llvm-svn: 47103
2008-02-14 02:58:32 +00:00
Eli Friedman 2be9af9556 Fix a minor bug in isNullPointerConstant triggered by the linux
tgmath.h.

Note that there is another issue with tgmath.h, so mandel.c still 
doesn't work.

llvm-svn: 47069
2008-02-13 17:29:58 +00:00
Eli Friedman a7bf7ed476 Make typechecking for enum+int compatibility stricter.
llvm-svn: 47005
2008-02-12 08:46:17 +00:00
Eli Friedman 16f909670e Fix type compatibility between constant and variable arrays.
llvm-svn: 47003
2008-02-12 08:23:06 +00:00
Steve Naroff ab468cb14b Allow the parser to detect invalid DeclSpec's. This fixes http://llvm.org/bugs/show_bug.cgi?id=1987.
This commit only "guards" the call to ParseDeclarationSpecifiers() in ParseDeclarationOrFunctionDefinition(). 

We could consider guarding all calls, however this is a bit radical (since it effectively stops parsing the declaration once we have a bad declspec). Will discuss with Chris tomorrow.

llvm-svn: 46984
2008-02-12 04:08:59 +00:00
Anders Carlsson 6a8350b4f1 Get rid of bogus warnings when the second argument in va_start is either an implicit cast expr or a paren expr.
llvm-svn: 46950
2008-02-11 04:20:54 +00:00
Steve Naroff e78e2af754 Tweak test...
llvm-svn: 46946
2008-02-11 02:16:41 +00:00
Steve Naroff 326389b8ce Fix http://llvm.org/bugs/show_bug.cgi?id=1988.
Sema::CheckInitializerListTypes() needs to ignore invalid structures.

llvm-svn: 46942
2008-02-11 00:06:17 +00:00
Chris Lattner 36fc8790b7 Fix PR1992 by computing the right type for string literals, which
is an array type not a pointer type.  This requires updating some
diags that change and updating the code generator to handle the
proper form of strings.

llvm-svn: 46941
2008-02-11 00:02:17 +00:00
Eli Friedman de4496bb9e Basic codegen test for conditional with void*.
llvm-svn: 46940
2008-02-10 23:18:23 +00:00
Eli Friedman fadc8462be Add a couple of sema tests for qualifiers with conditionals containing
void*.

llvm-svn: 46939
2008-02-10 23:14:16 +00:00
Chris Lattner 7b8134f5c6 Fix PR1999, by emitting a hard error only if an argument declarator is completely
missing.  Otherwise, it is an implicit int case, which is valid in c90 and invalid 
elsewhere, but accepted as an extension.

llvm-svn: 46938
2008-02-10 23:08:00 +00:00
Steve Naroff 1018ea35b7 Refine bug fix to Expr::isLvalue (commit r46917).
llvm-svn: 46919
2008-02-10 01:39:04 +00:00
Steve Naroff 43c50866f1 Change Expr::isLvalue() to allow the "void" type. This fixes bz2000 submitted by Neil Booth.
Neil, can you point me to the place in the C99 spec that says this is allowed? I thought Expr::isLvalue() conformed to the spec, which says "C99 6.3.2.1: an lvalue is an expression with an object type or an incomplete type other than void.". Please advise.

llvm-svn: 46917
2008-02-10 00:30:18 +00:00
Anders Carlsson 2e64d1a50f Behave correctly if a constraint expression is invalid.
llvm-svn: 46910
2008-02-09 19:57:29 +00:00
Steve Naroff 45173e0ac0 Fix <rdar://problem/5733511> clang doesn't emit error for const array.
llvm-svn: 46905
2008-02-09 16:59:44 +00:00
Steve Naroff a369922449 A bunch-o changes to fix <rdar://problem/5716046> incomplete implementation of ObjC class warning is incomplete
As part of this fix, I made a low-level change to the text diagnostics machinery (to basically avoid printing duplicate source lines/carets when you have multiple diagnostics that refer to the same exact place). For now, this only happens with we don't have a source range (could be extended to support source ranges as well). 

llvm-svn: 46897
2008-02-08 22:06:17 +00:00
Lauro Ramos Venancio d74057fa87 Fix a bitfield regression. Reported by Anders Carlsson.
llvm-svn: 46889
2008-02-08 19:46:46 +00:00
Steve Naroff 8c099c3f03 Use getLogicalLineNumber() in FuzzyParseMicrosoftAsmStatement(), it's more general and simplifies the code.
llvm-svn: 46885
2008-02-08 18:01:27 +00:00
Steve Naroff db5f7d7699 Support fuzzy parsing MS line-oriented __asm's that originate from a macro (a case where we can't obtain source line info). As the test case indicates, we don't currently support line-oriented asm statements that mix file/macro body tokens.
llvm-svn: 46878
2008-02-08 03:36:19 +00:00
Eli Friedman 4297826cac Improve diagnostic for illegal array initialization.
llvm-svn: 46869
2008-02-08 00:48:24 +00:00
Lauro Ramos Venancio 9eff02d9f8 Simplify bitfield codegen.
Fix codegen of struct { short a[3]; int b:15; }.

llvm-svn: 46859
2008-02-07 19:29:53 +00:00
Lauro Ramos Venancio 0f166de892 Fix codegen of
struct {
  char a[3];
  unsigned char b:1;
};

Fix PR1990.

llvm-svn: 46856
2008-02-07 18:18:58 +00:00
Chris Lattner 3b5054dda0 Implement support for the extremely atrocious MS /##/ extension,
which pastes together a comment.  This is only enabled with 
-fms-extensions of course.

llvm-svn: 46845
2008-02-07 06:03:59 +00:00
Eli Friedman 1242fff6ec Make sure to propagate qualifiers through the member operator.
llvm-svn: 46830
2008-02-06 22:48:16 +00:00
Chris Lattner 871e0ceffb explicitly document that return statement argument does not necessarily follow the result type of the function. Add testcase.
llvm-svn: 46823
2008-02-06 21:20:34 +00:00
Eli Friedman 220ee41011 Fix the codegen of structs with flexible array members.
llvm-svn: 46806
2008-02-06 05:33:51 +00:00
Eli Friedman d49a720d52 Be a bit stricter about array type compatibility.
llvm-svn: 46799
2008-02-06 04:53:22 +00:00
Chris Lattner a5e4d30942 Finish off the refactoring of type handling stuff. Now we recompile every
tag decl after it has been completed

llvm-svn: 46798
2008-02-06 04:51:19 +00:00
Chris Lattner b5eda6253b pull .ll and .bc writing out of the ASTConsumer destructors into some top
level code in clang.  This is a cleanup, but does implement "-o" for 
-emit-llvm.  One effect of this is that "clang foo.c -emit-llvm" will now
emit into foo.ll instead of stdout.  Use "clang foo.c -emit-llvm -o -" or 
"clang < foo.c -emit-llvm" to get the old behavior.

llvm-svn: 46791
2008-02-06 01:42:25 +00:00
Steve Naroff e6016798bf Fix Parser::ParseObjCTryStmt() to allow for trailing @-keyword statements/expressions.
This bug fix is the result of not having 2-token lookahead to recognize specific @-keywords.

llvm-svn: 46768
2008-02-05 21:27:35 +00:00
Chris Lattner b1537ebdd4 rewrite some of the type refinement code to eliminate dangling pointers
simplify the code and generally make it more robust.

llvm-svn: 46745
2008-02-05 08:06:13 +00:00
Chris Lattner b977b6a59b Relax an assertion, fixing PR1968
llvm-svn: 46742
2008-02-05 06:37:34 +00:00
Devang Patel a703a67384 Cleanup InitListExpr code generation code.
Handle padding fields while initializing struct (fix PR 1962)

llvm-svn: 46736
2008-02-05 02:39:50 +00:00
Christopher Lamb da8e5d979e Add ending newline to test.
llvm-svn: 46692
2008-02-04 02:35:11 +00:00
Christopher Lamb 025b5fb883 Add experimental support for address space qualified types. Address space
qualifiers use the __attribute__((address_space(id))) syntax.

llvm-svn: 46691
2008-02-04 02:31:56 +00:00
Chris Lattner c43926fe67 Implement support for __extension__ which silences extwarnings in its
scope.  This is part of the fix for PR1966

llvm-svn: 46669
2008-02-02 20:20:10 +00:00
Anders Carlsson 6fa0813186 Add RUN line.
llvm-svn: 46663
2008-02-02 04:49:12 +00:00
Chris Lattner bfc2d8acd9 testcase for previous patch.
llvm-svn: 46662
2008-02-02 04:45:42 +00:00