Ted Kremenek
eccf3e5821
Added "nonlval::LValAsInteger" to represent abstract LVals casted to integers, allowing us to track lvals when they are casted back to pointers.
...
llvm-svn: 50108
2008-04-22 21:10:18 +00:00
Ted Kremenek
6fdd3b35dc
Added null dereference test involving arrays.
...
llvm-svn: 50084
2008-04-22 04:56:55 +00:00
Fariborz Jahanian
a591a12ea5
Allow property in base class to be implemented in a
...
derived class.
llvm-svn: 50074
2008-04-21 23:57:08 +00:00
Ted Kremenek
efa92f1dfc
Added missing expected-warning.
...
llvm-svn: 50073
2008-04-21 23:45:26 +00:00
Ted Kremenek
503924bb9c
Added null dereference test case looking for null dereferences involving MemberExpr.
...
llvm-svn: 50072
2008-04-21 23:44:17 +00:00
Fariborz Jahanian
c6bec7b6dc
More semantics checks of properties. Property implementation can implicitly use
...
ivar of same name.
Better diagnostics to bring home this point.
llvm-svn: 50065
2008-04-21 21:57:36 +00:00
Fariborz Jahanian
f2a7d7c949
Support for @dynamic AST build.
...
More property semantics checking.
First test case for ObjC2's property implementation.
llvm-svn: 50057
2008-04-21 21:05:54 +00:00
Douglas Gregor
89f238cbe1
Clean up handling of function redeclarations
...
llvm-svn: 50021
2008-04-21 02:02:58 +00:00
Nate Begeman
1c906206b8
Fix PR2236
...
Add test
Implement feedback from Chris re: PR1998
llvm-svn: 50001
2008-04-20 20:38:08 +00:00
Chris Lattner
14cd1ee95f
Two improvements to initializer parsing:
...
1. If we hit a semantic error, try harder to recover to emit
diagnostics for later initializer errors (PR2241).
2. Don't leak parsed initializers on an error.
llvm-svn: 49998
2008-04-20 19:07:56 +00:00
Nate Begeman
ce4d7fce6b
OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.
...
llvm-svn: 49942
2008-04-18 23:10:10 +00:00
Nuno Lopes
42dd577238
fix __attribute__(format) for struct function pointer fields
...
llvm-svn: 49938
2008-04-18 22:43:39 +00:00
Ted Kremenek
217e9bff2b
Added test cases to test for reference count leaks.
...
llvm-svn: 49885
2008-04-18 02:00:02 +00:00
Ted Kremenek
b47c742002
Add extra test cases to test "escaping" for the reference count checker.
...
llvm-svn: 49812
2008-04-16 20:41:27 +00:00
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
Anders Carlsson
53fef5d9d6
Add trailing newline.
...
llvm-svn: 46652
2008-02-01 23:27:51 +00:00
Anders Carlsson
0b05d041f2
Only OCU vectors can be splatted.
...
llvm-svn: 46651
2008-02-01 23:17:55 +00:00
Steve Naroff
edb5bc6f09
Fix two rewriter bugs with @catch .
...
- Support @catch(...), rather than crash:-)
- Make sure all catch bodies get rewritten. This "fix" is really a workaround until the iterator for the "try" AST is fixed. Will fix this in a separate commit.
llvm-svn: 46644
2008-02-01 20:02:07 +00:00
Ted Kremenek
e9a709a0c5
Moved "Rewriter" tests from test/Sema to test/Rewriter.
...
llvm-svn: 46640
2008-02-01 17:05:54 +00:00
Anders Carlsson
806700f973
It is allowed to get the address of an array subscript, even if the array has the register qualifier, if the array is really a pointer.
...
llvm-svn: 46634
2008-02-01 07:15:58 +00:00
Chris Lattner
a347834869
make some diagnostics more terse, update testcases.
...
Fix Sema::ActOnInstanceMessage to correctly do things in terms of canonical
types, fixing bogus errors like:
NSDistantObject.m:10383:120: error: bad receiver type 'typeof((id<NSMutableCopying>)self)'
id mess = ({ id __inv__ = ((void *)0); id __mb__ = _NSMessageBuilder((id <NSMutableCopying>)self, &__inv__); (void)[(__typeof__((id <NSMutableCopying>)self))__mb__ mutableCopyWithZone:((void *)0)]; if (!objc_collecting_enabled()) object_dispose(__mb__); __inv__; });
llvm-svn: 46633
2008-02-01 06:57:39 +00:00
Ted Kremenek
81f0550cdd
Added back 'CodeGen' to test suite (accidentally removed in my last patch).
...
llvm-svn: 46631
2008-02-01 06:37:46 +00:00
Ted Kremenek
effdafa62a
Implemented casts for ConcreteInt and ConcreteIntLValue.
...
Implemented '==' and '!=' for ConcreteIntLValue.
llvm-svn: 46630
2008-02-01 06:36:40 +00:00
Chris Lattner
7f024fe0c6
Fix PR1965: missing diagnostics for parameters that are missing
...
type specifiers. This required updating some (buggy) tests, and the
testcase was previously accidentally committed.
llvm-svn: 46603
2008-01-31 06:10:07 +00:00
Chris Lattner
4973fb9273
Fix a bogus test
...
llvm-svn: 46602
2008-01-31 06:06:29 +00:00
Chris Lattner
a779d69029
Fix a rewriter crash when the whole body of a foreach is itself
...
rewritten, as in Sema/rewrite-foreach-6.m. Fariborz/Steve,
please review this to see if it is sane.
llvm-svn: 46600
2008-01-31 05:10:40 +00:00
Chris Lattner
a94035bbb8
Fix PR1921 by promoting negative indices to intptrty.
...
llvm-svn: 46599
2008-01-31 04:12:50 +00:00
Steve Naroff
2a2c5b98ee
Fix test case and add a FIXME.
...
llvm-svn: 46577
2008-01-30 21:50:43 +00:00
Lauro Ramos Venancio
86b99c1b79
getLLVMFieldNo can't be called before emitting the base value.
...
llvm-svn: 46576
2008-01-30 21:23:20 +00:00
Lauro Ramos Venancio
f5291d2871
A pointer to an opaque type is an "opaque type definition".
...
llvm-svn: 46575
2008-01-30 21:21:08 +00:00
Eli Friedman
1bc0fed9a5
Fix codegen for conditionals with incommpatible pointer types. Code
...
that causes this isn't really correct, but if we're going to accept
this, it should come up with a consistent AST.
llvm-svn: 46557
2008-01-30 17:02:03 +00:00
Chris Lattner
05ba4cbe17
fix a problem reported by Eli, caused by not keeping bool as i1
...
when in a register.
llvm-svn: 46552
2008-01-30 07:01:17 +00:00
Chris Lattner
e850fa2452
make this pass by adding an expected error, add some tests.
...
llvm-svn: 46551
2008-01-30 06:46:30 +00:00
Steve Naroff
1e7873642b
Many refinements to Sema::MergeVarDecl(). This routine still needs some re-work to fully handle tentative decls.
...
This includes a fix to bz1908.
llvm-svn: 46540
2008-01-30 00:44:01 +00:00
Devang Patel
45a65d2ee1
Handle incomplete struct initializer.
...
llvm-svn: 46534
2008-01-29 23:23:18 +00:00
Fariborz Jahanian
284011b462
Rewriting of @synchronized. This has one FIXME in it. But this should allow @sychronized to be rewritten.
...
llvm-svn: 46533
2008-01-29 22:59:37 +00:00
Steve Naroff
ddb1dd8c5f
Tighten up ASTContext::typesAreCompatible()...it needs to make sure the qualifiers match. The comment and C99 citation for this routine were correct...the code needed to conform to the comment/spec. This fixes the test added below.
...
Tightening up this routine forced tweaks to Sema::CheckSubtractionOperands() and Sema::CheckCompareOperands(). For example, they both need to operate on the unqualified pointee...
llvm-svn: 46522
2008-01-29 18:58:14 +00:00
Eli Friedman
7031d734ed
Fix a bug where CodeGen would attempt to erase an instruction that was
...
already used.
llvm-svn: 46519
2008-01-29 18:13:51 +00:00
Anders Carlsson
a8dc3e6b52
Implement __builtin_offsetof.
...
llvm-svn: 46515
2008-01-29 15:56:48 +00:00
Chris Lattner
0c8a1edb8b
Fix a bug where we would incorrectly emit a "cannot paste" error
...
message when handling the GNU ", ## __VA_ARGS__" extension. While
I'm at it, flag uses of this as extensions.
llvm-svn: 46503
2008-01-29 07:54:23 +00:00
Anders Carlsson
ce0740e1f5
Handle binary or in constant expressions.
...
llvm-svn: 46482
2008-01-29 01:33:32 +00:00
Anders Carlsson
0674a7417f
Correctly handle constants that refer to enums.
...
llvm-svn: 46481
2008-01-29 01:28:48 +00:00
Anders Carlsson
6f2a10e8c9
Correctly handle scalars in braces.
...
llvm-svn: 46480
2008-01-29 01:15:48 +00:00
Steve Naroff
f06b5ba047
Fix bz1950. ASTContext::functionTypesAreCompatible() needs to operate on the unqualified parameter types (per C99 6.7.5.3p15).
...
llvm-svn: 46472
2008-01-29 00:15:50 +00:00
Steve Naroff
aeb6b30f64
Fix a bug with struct initializers (in Sema::CheckInitializerListTypes()).
...
Test case included from bz1948 (thanks Neil!).
Also fixed an 80 column violation...
llvm-svn: 46430
2008-01-28 02:00:41 +00:00
Chris Lattner
77927cc33c
Add support for dispatching an objc message to a variable
...
in an initializer list.
llvm-svn: 46367
2008-01-25 19:43:26 +00:00
Chris Lattner
8917c5ace2
First half of a fix for the "objc message send in initializer" bug. This only
...
handles message sends with typenames to start with.
llvm-svn: 46366
2008-01-25 19:37:24 +00:00
Fariborz Jahanian
cc9c5452d1
Diagnose bad receiver type.
...
llvm-svn: 46358
2008-01-25 17:43:39 +00:00
Nate Begeman
43eec490fb
Support checking and codegen of constant vector globals
...
llvm-svn: 46343
2008-01-25 05:34:48 +00:00
Steve Naroff
78c6cdf95e
Replace Sema::CheckVariableInitList, CheckConstantInitList, and CheckForCharArrayInitializer with CheckInitializerListTypes. The new routine now supports struct/union initializers.
...
This is a modified version of a patch by Eli Friedman. This version passes all of the clang tests and supports vectors:-)
Note that Eli and I are still unsatisfied the implementation of CheckInitializerListTypes(). We'd like to find a more elegant implementation. Nevertheless, this is a complex part of the standard (and may be hard to simplify). Since the complexity is localized to this routine, we can iterate without too much disruption:-)
llvm-svn: 46339
2008-01-25 00:51:06 +00:00
Chris Lattner
3efff5472b
Fix a bug recovering from broken code with a goto that Eli reported.
...
llvm-svn: 46336
2008-01-25 00:01:10 +00:00
Fariborz Jahanian
60a901621f
Fixed a nasty bug which took a while to come up with a test case,
...
diagnose, and took even longer to fix. It has to do with rewriting of a message
receiver which is an 'ivar' reference. Fix, however, is to remove a code which
was not doing the right thing and no longer needed.
llvm-svn: 46279
2008-01-23 20:34:40 +00:00
Chris Lattner
7238225c28
add support for -Wundef.
...
llvm-svn: 46274
2008-01-23 17:19:46 +00:00
Fariborz Jahanian
0a71ad2e07
Problem with ObjC's type-encoding of nested structs causing infinit recursion.
...
llvm-svn: 46260
2008-01-22 22:44:46 +00:00
Lauro Ramos Venancio
09af71c2a6
Implement bitfield write.
...
llvm-svn: 46258
2008-01-22 22:36:45 +00:00
Lauro Ramos Venancio
2ddcb25a3b
Implement bitfield read.
...
llvm-svn: 46257
2008-01-22 20:17:04 +00:00
Chris Lattner
97ff7763dc
Fix PR1936, a crash on malformed #if. Thanks to Neil for
...
noticing this!
llvm-svn: 46256
2008-01-22 19:34:51 +00:00
Steve Naroff
f9eb598de3
Sema::CheckInitializerTypes(). Start simpliying and cleaning up...
...
llvm-svn: 46234
2008-01-21 23:53:58 +00:00
Fariborz Jahanian
7718e36e25
Elimate bogus warning when va_start is correctly used in
...
a method.
llvm-svn: 46232
2008-01-21 22:59:53 +00:00
Lauro Ramos Venancio
37bae3e8aa
Simplify the bitfield codegen.
...
llvm-svn: 46230
2008-01-21 22:54:57 +00:00
Fariborz Jahanian
eab81cd03f
Synthesize methods with va-arg list correctly.
...
llvm-svn: 46212
2008-01-21 20:14:23 +00:00
Steve Naroff
c7d2df23f8
Fix two bugs with an @throw that doesn't have a statement.
...
- ObjCAtThrowStmt::getSourceRange() needs to check if it has a statement (and not go "boom":-)
- RewriteTest::RewriteObjCThrowStmt() needs to generate refer to the current exception.
llvm-svn: 46184
2008-01-19 00:42:38 +00:00
Steve Naroff
acb6fa6bea
Sema::FinalizeDeclaratorGroup(): Tighten up the tentative definition rule when dealing with arrays.
...
Bug submitted by Eli.
llvm-svn: 46179
2008-01-18 20:40:52 +00:00
Anders Carlsson
60bfc161a0
Assert that the type of the cast is equal to the _unqualified_ type of the subexpression. Fixes a problem spotted by Nuno Lopes.
...
llvm-svn: 46158
2008-01-18 02:25:57 +00:00
Steve Naroff
b716fbab44
Sema::FinalizeDeclaratorGroup()...make sure we emit an diagnostic for tentative definitions with incomplete types. Touch up all test cases that are effected.
...
llvm-svn: 46152
2008-01-18 00:39:39 +00:00
Fariborz Jahanian
9a5124a67e
Don't ICE on missing interface declaration when declaring one of its protocols.
...
llvm-svn: 46141
2008-01-17 20:33:24 +00:00
Steve Naroff
1aa1941889
Declarator::clear(): Null out variable after it's been deleted.
...
This avoids a double free (which is good:-)
Bug submitted by Eli.
llvm-svn: 46105
2008-01-17 00:36:28 +00:00
Steve Naroff
8a0abea999
Type::isArithmeticType(): disallow incomplete enum decls.
...
Bug submitted by Eli.
llvm-svn: 46102
2008-01-16 23:54:22 +00:00
Chris Lattner
a65e1f3b31
Move promoteExprToType from being a static method in SemaExpr.cpp to being
...
a method named ImpCastExprToType in Sema.
Use this method to insert implicit casts for case statements from their
operand type to the condition type of the switch. This fixes a crash on
test/CodeGen/statements.c, reported by Eli Friedman.
llvm-svn: 46083
2008-01-16 19:17:22 +00:00
Steve Naroff
17832a48f8
Sema::MergeFunctionDecl()...make sure diagnostic is accurate (wrt function declarations/definitions). Patch by Carl Lewis!
...
llvm-svn: 46070
2008-01-16 15:01:34 +00:00
Fariborz Jahanian
b860cbf052
Added support for rewriting of continue/break statements inside ObjC2's foreach-stmt.
...
llvm-svn: 46037
2008-01-15 23:58:23 +00:00
Steve Naroff
abefc391dd
Finish up handling all permutations of "complex int" (in Sema::UsualArithmeticConversions()).
...
A FIXME remains to verify the conversion rules are consistent with GCC.
Thanks to Eli for the new/improved test case...
llvm-svn: 46022
2008-01-15 22:21:49 +00:00
Steve Naroff
6fcfd0581d
- Change Type::isComplexType() to exlude GCC's complex integer extension. In general, we will keep the lowest level Type predicates "pure" (i.e. true to the C99 spec).
...
- Modify Sema::UsualArithmeticConversions() to work with the new definition of Type::isComplexType().
This is a nice cleanup and also fixes a bug submitted by Eli (which I've added to the test suite).
llvm-svn: 46005
2008-01-15 19:36:10 +00:00
Chris Lattner
15346fae70
avoid pasting L + "foo" into L"foo".
...
llvm-svn: 46000
2008-01-15 05:22:14 +00:00
Steve Naroff
7f988889ef
Rework commit r45976, which was incorrect.
...
- Add Type::isComplexIntegerType(), Type::getAsComplexIntegerType().
- Don't inlude complex types with Type::isIntegerType(), which is too general.
- Use the new predicates in Sema::UsualArithmeticConversions() to recognize/convert the types.
llvm-svn: 45992
2008-01-15 01:41:59 +00:00
Steve Naroff
d8c7d484af
Make sure Sema::GetTypeForDeclarator() deals with abstract declarators when diagnosing incorrect code.
...
Bug submitted by Eli.
llvm-svn: 45989
2008-01-14 23:33:18 +00:00
Steve Naroff
c28f46c6b4
Teach Type::isIntegerType() about GCC's __complex__ integer extensions...
...
Bug submitted by Eli.
llvm-svn: 45976
2008-01-14 21:38:57 +00:00
Steve Naroff
012484d6c8
Fix crasher when redefining functions. Not 100% pleased with this solution, but it is clearly an improvement. Will discuss with Chris later.
...
llvm-svn: 45975
2008-01-14 20:51:29 +00:00
Steve Naroff
d32419de0d
Record if a compound literal expression is @ file scope. This allows us to implement C99 6.5.2.5p6. This could have been done without modifying the AST (by checking the decl type and passing the info down to isContextExpr), however we concluded this is more desirable.
...
Bug/patch by Eli Friedman!
llvm-svn: 45966
2008-01-14 18:19:28 +00:00
Steve Naroff
4871fe0b8f
Revert r45951, Chris says it violates the C99 spec.
...
llvm-svn: 45961
2008-01-14 16:10:57 +00:00
Anders Carlsson
1ba25ca171
Add codegen upport for implicit casts to aggregate exprs.
...
llvm-svn: 45954
2008-01-14 06:28:57 +00:00
Chris Lattner
fd65291aa3
Fix ASTContext::typesAreCompatible when analyzing a function type with
...
proto and function type without proto. It would never call
'functionTypesAreCompatible' because they have different type classes.
llvm-svn: 45952
2008-01-14 05:45:46 +00:00
Steve Naroff
090353191c
Rewrite Expr::isNullPointerConstant() to deal with multiple levels of explicit casts.
...
Now, isNullPointerConstant() will return true for the following: "(void*)(double*)0"
llvm-svn: 45951
2008-01-14 02:53:34 +00:00
Steve Naroff
826e91ae04
Change Sema::CheckAddressOfOperation() to respect C99-only addressof rules.
...
Remove diagnostics from Sema::CheckIndirectionOperand(). C89/C99 allow dereferencing an incomplete type. clang appears to be emulating some incorrect gcc behavior (see below).
void
foo (void)
{
struct b;
struct b* x = 0;
struct b* y = &*x; // gcc produces an error ("dereferencing pointer to incomplete type")
}
With this patch, the above is now allowed.
Bug/Patch by Eli Friedman!
llvm-svn: 45933
2008-01-13 17:10:08 +00:00
Chris Lattner
317e6ba07f
Tighten up handling of __func__ and friends: it should be an array
...
of const char, and it should error if it occurs outside a function.
Is it valid in an objc method? If so we should handle that too.
llvm-svn: 45910
2008-01-12 18:39:25 +00:00
Chris Lattner
a81a0279cc
Fix the type of predefined identifiers like __func__. Patch by
...
Eli Friedman!
llvm-svn: 45906
2008-01-12 08:14:25 +00:00
Fariborz Jahanian
939776756f
Recover from user typo not having proper @interface decl and a bad foreach decl.
...
llvm-svn: 45839
2008-01-10 20:33:58 +00:00
Fariborz Jahanian
2de9a0be09
Remove non-ascii chaaracter from diagnostic
...
llvm-svn: 45836
2008-01-10 18:10:31 +00:00
Fariborz Jahanian
c644ee4992
Warn (as gcc does) when @end does not close anything.
...
llvm-svn: 45834
2008-01-10 17:58:07 +00:00
Fariborz Jahanian
db701b47d2
Pass rewritten output to 'clang' for verification.
...
llvm-svn: 45794
2008-01-10 00:30:24 +00:00
Fariborz Jahanian
82ae0152a7
Allow messaging expression as foreach's collection expression.
...
llvm-svn: 45793
2008-01-10 00:24:29 +00:00
Steve Naroff
e6b0ec8b5e
Fix Sema::ActOnDeclarator() to call MergeFunctionDecl for function decls that aren't in scope. Since C functions are in a flat namespace, we need to give them special treatment (when compared with variables and typedefs).
...
llvm-svn: 45789
2008-01-09 23:34:55 +00:00
Steve Naroff
c6edcbdb5d
Fix ASTContext::typesAreCompatible to allow for int/enum compatibility (C99 6.7.2.2p4).
...
Fix Sema::MergeFunctionDecl to allow for function type compatibility (by using the predicate on ASTContext). Function types don't have to be identical to be compatible...
llvm-svn: 45784
2008-01-09 22:43:08 +00:00
Steve Naroff
08ddb8c55c
Teach Sema::ActOnCompoundLiteral about constraint C99 6.5.2.5p3.
...
llvm-svn: 45782
2008-01-09 20:58:06 +00:00
Chris Lattner
41a1ef0dfe
implement proper support for _Bool in memory, which is usually i8, not i1.
...
This fixes a crash reported by Seo Sanghyeon
llvm-svn: 45778
2008-01-09 18:47:25 +00:00
Fariborz Jahanian
6fa7516bc9
Type-cast RHS of assignment to prevent warning compiling rewritten foreach code.
...
llvm-svn: 45777
2008-01-09 18:15:42 +00:00
Fariborz Jahanian
22f2347791
Fixed a bug whereby a parethesized collection expression was not being rewritten correctly.
...
llvm-svn: 45776
2008-01-09 17:50:00 +00:00
Fariborz Jahanian
05d2876ec3
Another test case for testing rewriteing of nested foreach-statement.
...
llvm-svn: 45769
2008-01-09 00:47:02 +00:00
Fariborz Jahanian
a305a5609e
Remove dependency on objc.h
...
llvm-svn: 45767
2008-01-09 00:33:05 +00:00
Steve Naroff
66a26044f8
Teach Expr::isConstantExpr() about CompoundLiterals.
...
llvm-svn: 45764
2008-01-09 00:05:37 +00:00
Fariborz Jahanian
965a8961c7
Patch to rewrite ObjC2's foreach-stmt.
...
llvm-svn: 45760
2008-01-08 22:06:28 +00:00
Steve Naroff
039ad3cf90
Fix Sema::CheckConditionalOperands(). The null pointer constant checks need to precede the check for two pointer operands.
...
llvm-svn: 45732
2008-01-08 01:11:38 +00:00
Chris Lattner
a30be59fa2
Fix a nasty corner case that Neil noticed in PR1900, where we would
...
incorrectly apply the multiple include optimization to files with
guards like:
#if !defined(x) MACRO
where MACRO could expand to different things in different contexts.
Thanks Neil!
llvm-svn: 45716
2008-01-07 19:50:27 +00:00
Fariborz Jahanian
d5450b7f07
Limit type of foreach's element and collection to be a pointer to
...
objc object type.
llvm-svn: 45709
2008-01-07 18:14:04 +00:00
Fariborz Jahanian
fef287cb67
Issue diagnostics if more than one declaration in objectove-c's foreach-stmt header.
...
llvm-svn: 45708
2008-01-07 17:52:35 +00:00
Chris Lattner
940cfebf90
add comments for the various AssignConvertType's, and split int->pointer from pointer->int.
...
llvm-svn: 45591
2008-01-04 18:22:42 +00:00
Chris Lattner
9bad62c72a
Merge all the 'assignment' diagnostic code into one routine, decloning
...
it from several places. This merges the diagnostics, making them more
uniform and fewer in number. This also simplifies and cleans up the code.
Some highlights:
1. This removes a bunch of very-similar diagnostics.
2. This renames AssignmentCheckResult -> AssignConvertType
3. This merges PointerFromInt + IntFromPointer which were always treated the same.
4. This updates a bunch of test cases that have minor changes to the produced diagnostics.
llvm-svn: 45589
2008-01-04 18:04:52 +00:00
Fariborz Jahanian
775d5d02af
Patch to add semantics check for ObjC2's foreacn statement.
...
llvm-svn: 45561
2008-01-04 00:27:46 +00:00
Chris Lattner
816dea2fc5
generalize some of the conversion warnings.
...
llvm-svn: 45560
2008-01-03 23:38:43 +00:00
Chris Lattner
166ae81be1
update for changes in diagnostic strings.
...
llvm-svn: 45559
2008-01-03 23:36:08 +00:00
Chris Lattner
0a788433eb
give better diagnostics for converting between function pointer and void*.
...
llvm-svn: 45556
2008-01-03 22:56:36 +00:00
Fariborz Jahanian
5cc21a7e02
Fixed a bug reported by Chris, involving assiging 0 to a qualified object type.
...
llvm-svn: 45542
2008-01-03 18:46:52 +00:00
Chris Lattner
20455f204f
Fix a crash reported by Seo Sanghyeon.
...
llvm-svn: 45530
2008-01-03 06:36:51 +00:00
Chris Lattner
4f20351142
When promoting array to pointer for argument, don't lose type qualifiers.
...
llvm-svn: 45510
2008-01-02 22:50:48 +00:00
Chris Lattner
7977cca8e8
Fix PR1895: a crash on an ugly gcc extension.
...
llvm-svn: 45505
2008-01-02 21:54:09 +00:00
Fariborz Jahanian
056e3a4e90
Issue diagnostic when objective-c's @interface is preceeded by a type specifier.
...
llvm-svn: 45491
2008-01-02 19:17:38 +00:00
Fariborz Jahanian
5e57e1890d
Prevent crash on incorrect objc messaging expression.
...
llvm-svn: 45489
2008-01-02 18:09:46 +00:00
Nate Begeman
330aaa79e0
Allow implicit casts during arithmetic for OCUVector operations
...
Add codegen support and test for said casts.
llvm-svn: 45443
2007-12-30 02:59:45 +00:00
Nate Begeman
16a3a9d5f9
Rename stats to print-stats to avoid conflicting with llvm's
...
stats statistic when clang is built as a dylib.
llvm-svn: 45441
2007-12-30 01:38:50 +00:00
Christopher Lamb
d91c3d4926
Enable CodeGen for member expressions based on call expressions returning aggregate types. This enables expressions like 'foo().member.submember'.
...
llvm-svn: 45395
2007-12-29 05:02:41 +00:00
Chris Lattner
20bc6e06cd
add a file I forgot to svn add.
...
llvm-svn: 45374
2007-12-27 21:46:27 +00:00
Chris Lattner
807979824e
use -emit-llvm-bc
...
llvm-svn: 45372
2007-12-27 20:35:58 +00:00
Chris Lattner
40ad6cd854
no need to verify this, no errors/warnings are expected.
...
llvm-svn: 45371
2007-12-27 20:31:56 +00:00
Chris Lattner
11221033be
Fix a crash on a top-level objc string, patch by Nico Weber
...
llvm-svn: 45370
2007-12-27 20:29:42 +00:00
Chris Lattner
5e530bcee3
- Use Tok.isObjCAtKeyword instead of Tok.getIdentifierInfo()->getObjCKeywordID().
...
The later fails if the token is not an identifier.
- Replace tabs with spaces.
- Various other cleanups.
Patch by Nico Weber!
llvm-svn: 45368
2007-12-27 19:57:00 +00:00
Seo Sanghyeon
acb00f4a73
Remove broken assert from CodeGen. Better check is done in Sema.
...
llvm-svn: 45358
2007-12-26 05:21:37 +00:00
Seo Sanghyeon
6f1b274976
String literal in aggregate expression
...
llvm-svn: 45330
2007-12-23 03:11:58 +00:00
Fariborz Jahanian
4f41b272c9
Another test case, testing a variety of objective-c type comparisons.
...
llvm-svn: 45302
2007-12-22 00:17:49 +00:00
Fariborz Jahanian
24e1a0bd35
Another test for objective-c's type comparison.
...
llvm-svn: 45301
2007-12-21 23:48:59 +00:00
Fariborz Jahanian
a7c705ddca
This patch implements some of the more obscure type-checking involving
...
'id' quallified with protocols and static types which have categories and
inheritance which implement these protocols.
llvm-svn: 45294
2007-12-21 22:22:33 +00:00
Devang Patel
505b4f1fd4
Convert opaque type when struct definition is seen.
...
llvm-svn: 45287
2007-12-21 19:35:28 +00:00
Fariborz Jahanian
56b5c96ef7
Patch to compare to objective-c static types where one or the other
...
(but not both) may be a protocol qualified static type.
llvm-svn: 45283
2007-12-21 17:34:43 +00:00
Fariborz Jahanian
fd6f3a2460
Test case for my last patch.
...
llvm-svn: 45277
2007-12-21 00:35:35 +00:00
Fariborz Jahanian
76fcf32632
Another test for objective-c type comparison.
...
llvm-svn: 45271
2007-12-20 22:53:29 +00:00
Fariborz Jahanian
4368af07a7
More objective-c type checking. This time comparing objective-c known objects.
...
llvm-svn: 45269
2007-12-20 22:37:58 +00:00
Fariborz Jahanian
63b19f1b6e
Patch to do type-checking for objctive-c's object types.
...
More is yet to come.
llvm-svn: 45263
2007-12-20 19:24:10 +00:00
Chris Lattner
2da14fb84f
implement semantic analysis for __builtin_islessequal and friends.
...
llvm-svn: 45239
2007-12-20 00:26:33 +00:00
Chris Lattner
c238331377
Add support for #pragma mark, which shouldn't warn about bogus tokens.
...
llvm-svn: 45212
2007-12-19 19:38:36 +00:00
Fariborz Jahanian
6a128ae962
Minor test twik.
...
llvm-svn: 45208
2007-12-19 19:07:24 +00:00
Chris Lattner
2a70c95387
reenable this code, fix the testcase.
...
llvm-svn: 45205
2007-12-19 18:01:43 +00:00
Fariborz Jahanian
a1e3420c49
This patch concludes implementation of dynamic objective-c type qualified by
...
protocol list.
llvm-svn: 45203
2007-12-19 17:45:58 +00:00
Chris Lattner
ea72f449fe
Implement C99 6.7.5.3p1
...
llvm-svn: 45188
2007-12-19 05:31:29 +00:00
Fariborz Jahanian
9f0e310861
Refactoring work. ObjcQualifiedIdType is now derived from 'Type'.
...
llvm-svn: 45174
2007-12-18 21:33:44 +00:00
Chris Lattner
37bd2ecb11
local static vars are globals also. This fixes a testcase
...
reported by Seo.
llvm-svn: 45156
2007-12-18 08:16:44 +00:00
Chris Lattner
20aad334c7
Fix the location we emit the "not a constant" error for this:
...
int foo() {
typedef int x[foo()];
static int y = sizeof(x);
}
previously we'd emit it on the typedef, which made not sense at all.
llvm-svn: 45154
2007-12-18 07:15:40 +00:00
Chris Lattner
dcb7cc59ae
Fix an nice and subtle parser bug reported by Nico Weber.
...
llvm-svn: 45149
2007-12-18 06:06:23 +00:00
Steve Naroff
b74406ba98
Fixe bogus error for variable argument methods. Sema::ObjcGetTypeForMethodDefinition() wasn't preserving the isVariadic boolean. Another fix is to avoid synthsizing the function decl entirely, however this is a separate issue that I don't want to deal with now. Also added a FIXME to Sema::CheckFunctionCall(), which is currently emitting a bogus warning.
...
llvm-svn: 45146
2007-12-18 03:41:15 +00:00
Steve Naroff
1d2538cb4d
Improve how we find private method decls. This involved:
...
- Changed Sema::ObjcActOnStartOfMethodDef() to register the methods with the global pools.
- Changed Sema::ActOnInstanceMessage() to look in global pools (should be much less error prone).
- Added a test case to message.m (for lookup that was broken).
Misc changes while I was investigating this...
- Changed Sema::ActOnAtEnd() to call AddFactoryMethodToGlobalPool (this looked like a cut/paste error).
- Added a comment and tweaked another where I was using the first person.
llvm-svn: 45142
2007-12-18 01:30:32 +00:00
Fariborz Jahanian
24cb52c9b0
Patch to implemented objective-c's dynamic object pointer qualified with
...
the protocol list (id<P,...> types).
llvm-svn: 45121
2007-12-17 21:03:50 +00:00
Ted Kremenek
3fbeaea7ee
Modified format-string checking to not emit a warning when all of the
...
following hold:
(1) A vprintf-like function is called that takes the argument list via a
via_list argument.
(2) The format string is a non-literal that is the parameter value of
the enclosing function, e.g:
void logmessage(const char *fmt,...) {
va_list ap;
va_start(ap,fmt);
fprintf(fmt,ap); // Do not emit a warning.
}
In the future this special case will be enhanced to consult the "format"
attribute attached to a function declaration instead of just allowing a blank
check for all function parameters to be used as format strings to vprintf-like
functions. This will happen when more support for attributes becomes
available.
llvm-svn: 45114
2007-12-17 19:03:13 +00:00
Steve Naroff
eaaae467c7
Sema::ActOnMemberReferenceExpr() needs to perform the default conversions.
...
Bug and test case provided by Carl Lewis.
llvm-svn: 45078
2007-12-16 21:42:28 +00:00