Ted Kremenek
cb5a95f3a4
Temporarily revert r61956 and r61957 (PTH tests failing).
...
llvm-svn: 61960
2009-01-09 00:27:29 +00:00
Ted Kremenek
510b4da49d
Enhance -fsyntax-only test of Carbon.h to also include testing for PTH.
...
llvm-svn: 61958
2009-01-08 23:42:56 +00:00
Douglas Gregor
82ac25e4a7
Unify the code for defining tags in C and C++, so that we always
...
introduce a Scope for the body of a tag. This reduces the number of
semantic differences between C and C++ structs and unions, and will
help with other features (e.g., anonymous unions) in C. Some important
points:
- Fields are now in the "member" namespace (IDNS_Member), to keep
them separate from tags and ordinary names in C. See the new test
in Sema/member-reference.c for an example of why this matters. In
C++, ordinary and member name lookup will find members in both the
ordinary and member namespace, so the difference between
IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but
only in C++!).
- We always introduce a Scope and push a DeclContext when we're
defining a tag, in both C and C++. Previously, we had different
actions and different Scope/CurContext behavior for enums, C
structs/unions, and C++ structs/unions/classes. Now, it's one pair
of actions. (Yay!)
There's still some fuzziness in the handling of struct/union/enum
definitions within other struct/union/enum definitions in C. We'll
need to do some more cleanup to eliminate some reliance on CurContext
before we can solve this issue for real. What we want is for something
like this:
struct X {
struct T { int x; } t;
};
to introduce T into translation unit scope (placing it at the
appropriate point in the IdentifierResolver chain, too), but it should
still have struct X as its lexical declaration
context. PushOnScopeChains isn't smart enough to do that yet, though,
so there's a FIXME test in nested-redef.c
llvm-svn: 61940
2009-01-08 20:45:30 +00:00
Sebastian Redl
a2b5e31cb1
Diagnose declarations that don't declare anything, and fix PR3020.
...
Examples:
int;
typedef int;
llvm-svn: 61454
2008-12-28 15:28:59 +00:00
Sebastian Redl
85cd7bac29
Fix filename typo.
...
llvm-svn: 61453
2008-12-28 14:19:27 +00:00
Anton Korobeynikov
b46e3a8d3b
Complete the test after adding handling of merged attributes on decls.
...
llvm-svn: 61438
2008-12-26 00:52:17 +00:00
Anton Korobeynikov
d72f47aa05
Add full dllimport / dllexport support: both sema checks and codegen.
...
Patch by Ilya Okonsky
llvm-svn: 61437
2008-12-26 00:52:02 +00:00
Anton Korobeynikov
3112c877c1
Testcase for stdcall/fastcall sema checks.
...
Patch by Ilya Okonsky!
llvm-svn: 61436
2008-12-26 00:51:21 +00:00
Chris Lattner
b6ec4e75ad
Clean up the C89/C++ warnings about C99 array features to not
...
emit duplicate diags (some in parser and some in sema) and to
warn about use of typequals in array sizes. This implements
PR2759.
llvm-svn: 61197
2008-12-18 06:50:14 +00:00
Chris Lattner
27e5beff70
Merge function-return.c into function.c
...
Fix PR2790 by making a warning an EXTWARN instead of EXTENSION.
Add a new EXTENSION warning for "return (some void expression);"
llvm-svn: 61187
2008-12-18 02:01:17 +00:00
Chris Lattner
3d72297909
diagnose C99 6.9.1p5, C arguments in definitions that are lacking
...
a name. This implements PR3208.
llvm-svn: 61127
2008-12-17 07:32:46 +00:00
Eli Friedman
bb2b3be9e1
Make error handling for va_start a bit more robust. Fixes PR3213.
...
llvm-svn: 61055
2008-12-15 22:05:35 +00:00
Douglas Gregor
c811d8f055
Create new EnumDecl nodes for redeclarations of enums, linking them
...
together in the same way that we link RecordDecl/CXXRecordDecl nodes.
Unify ActOnTag and ActOnTagStruct.
Fixes PR clang/2753.
llvm-svn: 61034
2008-12-15 16:32:14 +00:00
Chris Lattner
04397358ec
Implement the final (hopefully) wrinkle to i-c-e + builtin_constant_p
...
processing: it allows arbitrary foldable constants as the operand of ?: when
builtin_constant_p is the condition.
llvm-svn: 60954
2008-12-12 18:00:51 +00:00
Chris Lattner
4bf85ffe83
merge these testcases into one file.
...
llvm-svn: 60936
2008-12-12 07:01:24 +00:00
Chris Lattner
85b25bc344
implement rdar://6091492 - ?: with __builtin_constant_p as the operand is an i-c-e.
...
llvm-svn: 60934
2008-12-12 06:55:44 +00:00
Chris Lattner
dca17ceb19
add expected diag
...
llvm-svn: 60927
2008-12-12 05:59:56 +00:00
Chris Lattner
053441f39d
Fix rdar://6095061 - gcc allows __builtin_choose_expr as an lvalue
...
llvm-svn: 60924
2008-12-12 05:35:08 +00:00
Chris Lattner
54139445ba
Testcase for something that already works. Clang agrees with Comeau,
...
and this makes sense. likely a gcc bug that it doesn't diagnose the bad
restrict.
llvm-svn: 60923
2008-12-12 05:25:55 +00:00
Chris Lattner
f45c5ecb3b
fix rdar://6097892 - gcc incompat: clang rejects __func__, __FUNCTION__, and __PRETTY_FUNCTION__ outside func
...
Yeah, this is "useful".
llvm-svn: 60921
2008-12-12 05:05:20 +00:00
Chris Lattner
81ed6805db
Implement rdar://6138816 - [sema] named bitfields cannot have 0 width
...
llvm-svn: 60920
2008-12-12 04:56:04 +00:00
Chris Lattner
ece9ae718b
add annotation
...
llvm-svn: 60907
2008-12-11 23:11:52 +00:00
Anders Carlsson
591b2224cb
Add another complex promotion test.
...
llvm-svn: 60863
2008-12-10 23:57:51 +00:00
Anders Carlsson
b05961c700
Make sure to promote expressions of the form (floating point + complex integer) correctly, to (complex floating point + complex floating point)
...
llvm-svn: 60862
2008-12-10 23:30:05 +00:00
Steve Naroff
68e167df8e
Fix <rdar://problem/6418623> Bogus block type compatibility warning.
...
llvm-svn: 60842
2008-12-10 17:49:55 +00:00
Eli Friedman
14fb8587be
Workaround for PR3173. The fix is correct in the sense that if the enum
...
code were working correctly, it would be a no-op, but it's not really a
proper fix. That said, I don't really want to touch the enum code at
the moment because I don't understand it very well, and this seems to
be a relatively visible regression.
llvm-svn: 60680
2008-12-08 02:21:03 +00:00
Chris Lattner
b3582b939e
a minor grammar fix
...
llvm-svn: 60646
2008-12-07 00:59:53 +00:00
Anders Carlsson
0d8f0ba6ed
Improve VLA diagnostics/sema checking. Fixes PR2361 and PR2352.
...
llvm-svn: 60638
2008-12-07 00:20:55 +00:00
Anders Carlsson
3bb1ffca94
Simplify test.
...
llvm-svn: 60631
2008-12-06 22:27:22 +00:00
Anders Carlsson
5df391e5c7
Add diagnostics for bitfields.
...
llvm-svn: 60628
2008-12-06 20:33:04 +00:00
Anders Carlsson
1aa679227b
Use VerifyIntegerConstantExpression instead of isIntegerConstantExpr. Fixes PR2963
...
llvm-svn: 60591
2008-12-05 16:33:57 +00:00
Anders Carlsson
1e495d9860
Make Sema::CheckForConstantInitializer use Expr::Evaluate. This fixes PR3130.
...
llvm-svn: 60580
2008-12-05 05:09:56 +00:00
Chris Lattner
79413956d4
change getCurFunctionDecl to skip through Block contexts to find
...
the containing block. Introduce a new getCurFunctionOrMethodDecl
method to check to see if we're in a function or objc method.
Minor cleanups to other related places. This fixes rdar://6405429.
llvm-svn: 60564
2008-12-04 23:50:19 +00:00
Chris Lattner
2ca529ce61
instead of forcing blocks on by default, make them default to off, but let
...
specific targets default them to on. Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.
llvm-svn: 60563
2008-12-04 23:20:07 +00:00
Sebastian Redl
fb5df7235a
int-arith-convert.c makes assumptions about integer sizes, so force a specific architecture
...
llvm-svn: 60420
2008-12-02 16:34:01 +00:00
Anders Carlsson
0309d904f7
Fix test. (0 && (a(),1)) is a valid I-C-E according to C99.
...
llvm-svn: 60331
2008-12-01 06:27:38 +00:00
Anders Carlsson
1dbffc6e36
Add Sema::isNullPointerConstant which extwarns if necessary. Use it in Sema::CheckConditionalOperands.
...
llvm-svn: 60319
2008-12-01 02:17:22 +00:00
Anders Carlsson
f7fba46331
Use VerifyIntegerConstantExpression for case values.
...
llvm-svn: 60317
2008-12-01 02:13:02 +00:00
Nuno Lopes
8c6fbc04ee
add missing RUN lines
...
llvm-svn: 60107
2008-11-26 15:50:12 +00:00
Chris Lattner
1e5665e6be
Change a whole lot of diagnostics to take QualType's directly
...
instead of converting them to strings first. This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.
llvm-svn: 59948
2008-11-24 06:25:27 +00:00
Anders Carlsson
a42ee44aab
The address of a variable is only constant if the variable has global storage.
...
llvm-svn: 59939
2008-11-24 04:41:22 +00:00
Anders Carlsson
4c76e93507
Fix bug in the constant evaluator. Fixes PR3115.
...
llvm-svn: 59938
2008-11-24 04:21:33 +00:00
Chris Lattner
4fc69799f5
Rewrite FindDiagnostics to be more strict about the formatting of the
...
expected-foo strings. Now the only allowed characters between
expected-error and {{ is whitespace.
llvm-svn: 59925
2008-11-24 01:28:17 +00:00
Chris Lattner
f3ab014308
clean up -verify mode output. If the expected-error string is
...
mangled, report it using the diagnostics machinery instead of printf.
llvm-svn: 59924
2008-11-23 23:38:26 +00:00
Chris Lattner
03c4041cb5
make the 'to match this' diagnostic a note.
...
llvm-svn: 59921
2008-11-23 23:17:07 +00:00
Chris Lattner
0369c57ac6
Make all the 'redefinition' diagnostics more consistent, and make the
...
"previously defined here" diagnostics all notes.
llvm-svn: 59920
2008-11-23 23:12:31 +00:00
Sebastian Redl
632ab20e1e
Fix test cases broken by quote normalization in diagnostics.
...
llvm-svn: 59888
2008-11-22 22:39:41 +00:00
Anders Carlsson
475f4bce36
Case values must be evaluated
...
llvm-svn: 59884
2008-11-22 21:50:49 +00:00
Anders Carlsson
59689ed764
Use Expr::Evaluate for case statements. Fixes PR2525
...
llvm-svn: 59881
2008-11-22 21:04:56 +00:00
Chris Lattner
8cd9b96ee1
add a silly testcase
...
llvm-svn: 59877
2008-11-22 19:57:03 +00:00