Douglas Gregor
13d190ffbc
Don't emit name-lookup tables for functions or methods in the PCH files
...
llvm-svn: 69449
2009-04-18 15:49:20 +00:00
Douglas Gregor
f21701b70c
Fix test to output LLVM to a temporary file, which we grep as part of the test
...
llvm-svn: 69448
2009-04-18 15:48:37 +00:00
Chris Lattner
960cc525ec
rewrite the goto scope checking code to be more efficient, simpler,
...
produce better diagnostics, and be more correct in ObjC cases (fixing
rdar://6803963).
An example is that we now diagnose:
int test1(int x) {
goto L;
int a[x];
int b[x];
L:
return sizeof a;
}
with:
scope-check.c:15:3: error: illegal goto into protected scope
goto L;
^
scope-check.c:17:7: note: scope created by variable length array
int b[x];
^
scope-check.c:16:7: note: scope created by variable length array
int a[x];
^
instead of just saying "invalid jump". An ObjC example is:
void test1() {
goto L;
@try {
L: ;
} @finally {
}
}
t.m:6:3: error: illegal goto into protected scope
goto L;
^
t.m:7:3: note: scope created by @try block
@try {
^
There are a whole ton of fixme's for stuff to do, but I believe that this
is a monotonic improvement over what we had.
llvm-svn: 69437
2009-04-18 09:36:27 +00:00
Chris Lattner
33b9cb2eec
add accessor.
...
llvm-svn: 69436
2009-04-18 09:27:30 +00:00
Daniel Dunbar
41595d43d5
Use getAsPointerType instead of using getCanonicalType directly.
...
- <rdar://problem/6803995>
llvm-svn: 69435
2009-04-18 08:54:40 +00:00
Daniel Dunbar
508a7dda4a
Fix a bug found by inspection, class/meta references could be emitted
...
into the wrong section (they shared the same lookup table).
llvm-svn: 69433
2009-04-18 08:51:00 +00:00
Chris Lattner
9f3e711503
add another testcase
...
llvm-svn: 69432
2009-04-18 07:54:11 +00:00
Chris Lattner
7a845306aa
don't evaluate ->child_end() every time through the loop, or *i frequently within it.
...
llvm-svn: 69431
2009-04-18 07:53:55 +00:00
Chris Lattner
9512c2fb77
split code out into a new CheckFunctionJumpScopes routine,
...
add some comments, change type from void* -> Stmt*, use
smallvector instead of vector.
llvm-svn: 69430
2009-04-18 07:47:21 +00:00
Chris Lattner
40cc0044e7
make scope checking be static functions instead of sema methods.
...
llvm-svn: 69429
2009-04-18 07:36:39 +00:00
Chris Lattner
c2e868fd14
fix incorrect lowering of __builtin_ia32_shufpd, rdar://6803924
...
llvm-svn: 69428
2009-04-18 07:01:54 +00:00
Chris Lattner
032f7665d0
rename file.
...
llvm-svn: 69427
2009-04-18 07:00:54 +00:00
Chris Lattner
85e4dd4055
don't dump .ll file in this dir.
...
llvm-svn: 69426
2009-04-18 07:00:06 +00:00
Chris Lattner
24ad8621a4
__builtin_prefetch should be declared as "void __builtin_prefetch(const void *)",
...
not "const void __builtin_prefetch(void *)". This fixes PR3912.
llvm-svn: 69425
2009-04-18 06:51:21 +00:00
Chris Lattner
974e1f40b3
rename test
...
llvm-svn: 69424
2009-04-18 06:49:47 +00:00
Chris Lattner
35dd5056fc
fix PR3927 by being more careful about the pp test for identifier.
...
llvm-svn: 69423
2009-04-18 06:44:18 +00:00
Chris Lattner
5ca5d40cf4
second half of PR3940: #line requires simple digit sequence.
...
llvm-svn: 69422
2009-04-18 06:38:24 +00:00
Douglas Gregor
652d82a096
Store the type ID for __builtin_va_list in the PCH file, so that the
...
AST context's __builtin_va_list type will be set when the PCH file is
loaded. This fixes the crash when CodeGen'ing a va_arg expression
pulled in from a PCH file.
llvm-svn: 69421
2009-04-18 05:55:16 +00:00
Chris Lattner
751f045e32
this is really just a recommendation, not a requirement.
...
llvm-svn: 69416
2009-04-18 02:25:14 +00:00
Chris Lattner
2425bcb49a
enforce requirements imposed by C90 6.8 TC1, fixing PR3919.
...
llvm-svn: 69415
2009-04-18 02:23:25 +00:00
Chris Lattner
bc63de144f
Fix PR3938 by taking into account C99 6.10p4.
...
llvm-svn: 69413
2009-04-18 01:34:22 +00:00
Chris Lattner
b547394ba5
convert test to -verify style.
...
llvm-svn: 69412
2009-04-18 01:33:54 +00:00
Chris Lattner
c17925da61
Substantially restructure function-like macro argument parsing.
...
Highlights: PP::isNextPPTokenLParen() no longer eats the (
when present. We now simplify slightly the logic parsing
macro arguments. We now handle PR3937 and other related cases
correctly.
llvm-svn: 69411
2009-04-18 01:13:56 +00:00
Douglas Gregor
111af7d7b4
Preliminary PCH support in the driver
...
llvm-svn: 69410
2009-04-18 00:34:01 +00:00
Douglas Gregor
3c3aa61758
Lazy deserialization of function bodies for PCH files. For the Carbon
...
"Hello, World!", this takes us from deserializing 6469
statements/expressions down to deserializing 1
statement/expression. It only translated into a 1% improvement on the
Carbon-prefixed 403.gcc, but (a) it's the right thing to do, and (b)
we expect this to matter more once we lazily deserialize identifiers.
llvm-svn: 69407
2009-04-18 00:07:54 +00:00
Douglas Gregor
e3dcb2ddd1
FunctionDecl::getBody() is getting an ASTContext argument for use in
...
lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.
llvm-svn: 69406
2009-04-18 00:02:19 +00:00
Chris Lattner
7d59a92b45
remove dead diagnostic.
...
llvm-svn: 69405
2009-04-17 23:57:31 +00:00
Chris Lattner
b40289b2b8
Fix two problems from PR3916, and one problem I noticed while hacking
...
on the code.
llvm-svn: 69404
2009-04-17 23:56:52 +00:00
Chris Lattner
ca556cb3e3
implement PR3940: #line numbers not fully checked
...
llvm-svn: 69403
2009-04-17 23:37:49 +00:00
Chris Lattner
0003c27f5e
#line is allowed to have macros that expand to nothing after them.
...
llvm-svn: 69401
2009-04-17 23:30:53 +00:00
Douglas Gregor
08f0129003
Keep track of the number of statements/expressions written to and read
...
from a PCH file. It turns out that "Hello, World!" is bringing in 19%
of all of the statements in Carbon.h, so we need to be lazy.
llvm-svn: 69393
2009-04-17 22:13:46 +00:00
Chris Lattner
6fdd57cba8
fix a crash compiling code with its own definition of objc_assign_weak.
...
rdar://6800430
llvm-svn: 69392
2009-04-17 22:12:36 +00:00
Chris Lattner
2581fc3fa9
tweak redefinition of a typedef a bit to fix a couple of problems:
...
1. We had logic in sema to decide whether or not to emit the error
based on manually checking whether in a system header file.
2. we were allowing redefinitions of typedefs in class scope in C++
if in header file.
3. there was no way to force typedef redefinitions to be accepted
by the C compiler, which annoys me when stripping linemarkers out
of .i files.
The fix is to split the C++ class typedef redefinition path from the
C path, and change the C path to be a warning that normally maps to
error. This causes it to properly be ignored in system headers,
etc. and gives us a way to control it. Passing
-Wtypedef-redefinition now turns the error into a warning.
One behavior change is that we now diagnose cases where you redefine
a typedef in your .c file that was defined in a header file. This
seems like reasonable behavior, and the diagnostic now indicates that
it can be controlled with -Wtypedef-redefinition.
llvm-svn: 69391
2009-04-17 22:04:20 +00:00
Douglas Gregor
ba6e557378
Fix two embarrassing PCH bugs:
...
1) Accidentally used delete [] on an array of statements that was allocated with ASTContext's allocator
2) Deserialization of names with multiple declarations (e.g., a struct and a function) used the wrong mangling constant, causing it to view declaration IDs as Decl*s.
403.gcc builds and links properly.
llvm-svn: 69390
2009-04-17 21:46:47 +00:00
Devang Patel
12f0dea922
Use PresumedLoc to record line number in debug info entries.
...
llvm-svn: 69389
2009-04-17 21:35:15 +00:00
Daniel Dunbar
66b13dac0a
Don't put msgrefs in used globals (in particular, we don't want
...
no-dead-strip set on them).
llvm-svn: 69388
2009-04-17 21:10:58 +00:00
Devang Patel
75009454e3
Appropriately set file name and directory name in debug info compile units.
...
llvm-svn: 69387
2009-04-17 21:06:59 +00:00
Chris Lattner
6395285306
implement a new clang-cc option -dump-build-information=filename which causes the
...
compiler to dump random stuff from the build into the file. Right now this
amounts to dumping command line arguments and diagnostics to the file.
The idea is that you can set an envvar, do a world build of an OS, then grep
through all the logs for interesting things or something.
Daniel, please wire the driver up to do something with this.
llvm-svn: 69386
2009-04-17 21:05:01 +00:00
Douglas Gregor
f994f062fd
PCH support for inline assembly statements.
...
This completes support for all of C (+ extensions). We can (again)
build a PCH file for Carbon.h.
llvm-svn: 69385
2009-04-17 20:57:14 +00:00
Chris Lattner
25ef69a36e
refactor htmldiags to be created up front like the other diag clients.
...
llvm-svn: 69379
2009-04-17 20:40:01 +00:00
Chris Lattner
c6b5613460
add a virtual method to DiagnosticClient to get rid of some fragile
...
casting in clang-cc.
llvm-svn: 69377
2009-04-17 20:16:08 +00:00
Douglas Gregor
5ceb1a2dd9
PCH tests for va_arg expressions. Verified that the blocks test does create a BlockDeclRefExpr
...
llvm-svn: 69376
2009-04-17 20:06:59 +00:00
Chris Lattner
fbbf539c45
fix a crash on invalid by making ActOnDeclarator create decl with
...
a dummy *function* type when it is recovering and knows it needs
a function. rdar://6802350 - clang crash on invalid input
llvm-svn: 69374
2009-04-17 19:32:54 +00:00
Douglas Gregor
c95701da6c
PCH support for blocks
...
llvm-svn: 69373
2009-04-17 19:21:43 +00:00
Chris Lattner
b63e1db6bc
wire up comment diagnostics to -Wcomment, add it to -Wall. Now
...
you can silence these with -Wno-all or -Wno-comment, but they
still default to on.
llvm-svn: 69372
2009-04-17 19:09:26 +00:00
Douglas Gregor
af97671954
PCH support for GNU statement expressions
...
llvm-svn: 69370
2009-04-17 19:05:30 +00:00
Douglas Gregor
779d865b48
PCH support for indirect gotos and address-of-label expressions.
...
llvm-svn: 69369
2009-04-17 18:58:21 +00:00
Chris Lattner
70a42144ca
adjust for the new -Wvector-conversions option
...
llvm-svn: 69366
2009-04-17 18:39:25 +00:00
Chris Lattner
cce935edfe
move a vector conversion warning to be diabled by default (like gcc),
...
but add it to -Wall (unlike gcc) and give it a controlling group
(-Wvector-conversions).
llvm-svn: 69365
2009-04-17 18:28:37 +00:00
Douglas Gregor
6cc68a47b5
PCH support for labels and goto.
...
llvm-svn: 69364
2009-04-17 18:18:49 +00:00
Steve Naroff
059c6f6293
Update Xcode project with some PCH related headers.
...
llvm-svn: 69363
2009-04-17 18:02:59 +00:00
Chris Lattner
ff8a9e6ee4
fix misspelt attribute.
...
llvm-svn: 69362
2009-04-17 17:55:23 +00:00
Chris Lattner
10dae30049
Fix rdar://6800926 - crash compiling non-fragile _Bool bitfield ivar,
...
the functional change here is changing ConvertType -> ConvertTypeForMem
so that we handle i1 fields properly as memory.
llvm-svn: 69361
2009-04-17 17:46:19 +00:00
Chris Lattner
c4688d21f7
tidy some code.
...
llvm-svn: 69360
2009-04-17 17:44:48 +00:00
Chris Lattner
ead1e0002f
clean up run lines.
...
llvm-svn: 69359
2009-04-17 17:43:56 +00:00
Chris Lattner
e49652b1c8
add basic support for building DiagnosticGroups.inc with cmake
...
llvm-svn: 69357
2009-04-17 17:04:48 +00:00
Douglas Gregor
915b6c663d
PCH support for declaration statements, and a test for PredefinedExpr
...
llvm-svn: 69356
2009-04-17 16:55:36 +00:00
Douglas Gregor
f961e5921f
PCH support for return statements.
...
Optimize PCH encoding for switch-case statements slightly, by making
the switch-case numbering local to a particular statement.
llvm-svn: 69355
2009-04-17 16:34:57 +00:00
Sebastian Redl
5775af1afd
Implement lvalue test for conditional expressions.
...
Add a few commented lines to the test case that point out things that don't work yet.
llvm-svn: 69354
2009-04-17 16:30:52 +00:00
Fariborz Jahanian
493d4e080d
Added -print-ivar-layout option. No change in functionality
...
yet.
llvm-svn: 69346
2009-04-17 03:04:15 +00:00
Anders Carlsson
6dc3575220
Add support for the __has_trivial_destructor type trait.
...
llvm-svn: 69345
2009-04-17 02:34:54 +00:00
Anders Carlsson
eaa28f7e18
Add support for generating (very basic) C++ destructors. These aren't called by anything yet.
...
llvm-svn: 69343
2009-04-17 01:58:57 +00:00
Daniel Dunbar
3f4a2c286e
Support QA_OVERRIDE_GCC3_OPTIONS
...
- Cover your eyes...
- This is a simple but effective way to allow developers to build a
project with clang while manipulating the command line, without
having to edit the project itself.
llvm-svn: 69342
2009-04-17 01:54:00 +00:00
Daniel Dunbar
c3e7cff6d3
Attributes on block functions were not being set.
...
- <rdar://problem/6800351> clang not producing correct large struct
return code for Blocks
llvm-svn: 69337
2009-04-17 00:48:04 +00:00
Douglas Gregor
71517c47e6
PCH support for do-while and for loops
...
llvm-svn: 69334
2009-04-17 00:29:51 +00:00
Douglas Gregor
e24cbc0f4b
PCH support for while and continue statements
...
llvm-svn: 69332
2009-04-17 00:16:09 +00:00
Mike Stump
5c3285b6fb
Fixup semantic analysis for nested blocks, and allow block literal
...
expressions that can be of static duration to be returned.
Radar 6786551
llvm-svn: 69331
2009-04-17 00:09:41 +00:00
Anders Carlsson
b7f8f594f3
Implement basic code generation of constructor calls. We can now compile:
...
struct S {
S(int, int);
};
void f() {
S s(10, 10);
}
llvm-svn: 69330
2009-04-17 00:06:03 +00:00
Douglas Gregor
a9af1d13da
PCH support for the first batch of statements, including null,
...
compound, case, default, if, switch, and break statements.
llvm-svn: 69329
2009-04-17 00:04:06 +00:00
Anders Carlsson
e8eeffdf16
Add GetAddrOfCXXConstructor and use it.
...
llvm-svn: 69328
2009-04-16 23:57:24 +00:00
Anders Carlsson
2f3278bc09
Add constructor getter to CXXTemporaryObjectExpr.
...
llvm-svn: 69327
2009-04-16 23:53:22 +00:00
Anders Carlsson
e6840d84df
If a class has a non-trivial constructor that doesn't take any arguments, we will now make an implicit CXXTemporaryObjectExpr. So
...
struct S {
S();
};
void f() {
S s;
}
's' here will implicitly be declared as.
S s = S();
llvm-svn: 69326
2009-04-16 23:50:50 +00:00
Chris Lattner
302279ed06
-Wall is -Wmost -Wparentheses
...
llvm-svn: 69324
2009-04-16 23:30:16 +00:00
Daniel Dunbar
f2df7c283f
Driver: Allow using clang as a precompiler, even if it is an
...
unsupported arch.
llvm-svn: 69322
2009-04-16 23:10:13 +00:00
Douglas Gregor
573b92468e
Clean up the declaration-decoding step in the PCH reader, using the
...
same ueber-easy visitor scheme used for expressions/statements.
llvm-svn: 69320
2009-04-16 22:29:51 +00:00
Douglas Gregor
8f45df58b3
Prepare PCH reader and writer for (de-)serialization of statements. No
...
functionality change.
llvm-svn: 69319
2009-04-16 22:23:12 +00:00
Fariborz Jahanian
68c4c61be8
Removed a no longer needed FIXME comment.
...
llvm-svn: 69315
2009-04-16 21:49:16 +00:00
Steve Naroff
a0c32704e2
Fix <rdar://problem/6765383> clang-6: clang does not appear to support declaring a static Block 'const'.
...
llvm-svn: 69306
2009-04-16 19:02:57 +00:00
Fariborz Jahanian
bcf548760e
Category method synbols must be qualified by gategory name to
...
match gcc's.
llvm-svn: 69305
2009-04-16 18:34:20 +00:00
Sebastian Redl
1a99f441e6
Fix a crash bug when comparing overload quality of conversion operators with conversion constructors.
...
Remove an atrocious amount of trailing whitespace in the overloaded operator mangler. Sorry, couldn't help myself.
Change the DeclType parameter of Sema::CheckReferenceInit to be passed by value instead of reference. It wasn't changed anywhere.
Let the parser handle C++'s irregular grammar around assignment-expression and conditional-expression.
And finally, the reason for all this stuff: implement C++ semantics for the conditional operator. The implementation is complete except for determining lvalueness.
llvm-svn: 69299
2009-04-16 17:51:27 +00:00
Eli Friedman
8d25b096fa
Attempt to fix a read-after-free running test/Sema/designated-initializers.c.
...
Douglas, can you check that this is doing the right thing?
llvm-svn: 69298
2009-04-16 17:49:48 +00:00
Eli Friedman
027aa3cb0e
Force target triple for test depending on __weak.
...
llvm-svn: 69297
2009-04-16 17:33:37 +00:00
Anders Carlsson
8798bd1bf9
When we create an implicit CXXTemporaryObjectExpr we don't need to check that it's a valid init. Instead, just set it as the VarDecl's initializer.
...
llvm-svn: 69292
2009-04-16 15:50:16 +00:00
Daniel Dunbar
426b5cf16a
Ensure that the most recent declaration of a tentative definition wins
...
when generating a common definition.
llvm-svn: 69287
2009-04-16 15:34:14 +00:00
Daniel Dunbar
092f0ccd9c
Pass -fdiagnostics-show-option to clang-cc by default.
...
- <rdar://problem/6796848> implement -fdiagnostics-show-option
llvm-svn: 69276
2009-04-16 06:32:38 +00:00
Chris Lattner
f9c2dbb233
other half of 69274
...
llvm-svn: 69275
2009-04-16 06:17:55 +00:00
Chris Lattner
b666a27d24
split diagnostic group definitions out into their own file.
...
llvm-svn: 69274
2009-04-16 06:17:18 +00:00
Chris Lattner
2d49eed816
optimize and comment GetDiagInfo.
...
llvm-svn: 69273
2009-04-16 06:13:46 +00:00
Chris Lattner
6c440329f1
merge several scattered tables into StaticDiagInfo.
...
llvm-svn: 69272
2009-04-16 06:07:15 +00:00
Chris Lattner
6a64cc6776
Implement Diagnostic::getWarningOptionForDiag with information from tblgen,
...
this implements -fdiagnostics-show-option in clang-cc.
llvm-svn: 69271
2009-04-16 06:00:24 +00:00
Chris Lattner
a538967177
tblgen is now passing diagnostic group information in the .inc file, ignore it everywhere.
...
llvm-svn: 69269
2009-04-16 05:52:14 +00:00
Chris Lattner
22cb818913
implement framework for -fdiagnostics-show-option, but tblgen isn't
...
passing down the right info yet.
llvm-svn: 69268
2009-04-16 05:44:38 +00:00
Anders Carlsson
805ab5a746
Disable the code I added before until I understand what's causing default2.cpp to fail.
...
llvm-svn: 69267
2009-04-16 05:35:41 +00:00
Chris Lattner
b8e73158e1
move handling of -pedantic and -pedantic-errors into Diagnostics,
...
out of Warnings.cpp. This simplifies warnings.cpp and makes it more
efficient.
llvm-svn: 69266
2009-04-16 05:04:32 +00:00
Chris Lattner
f9150bac01
arrange for -Wno-error=foo warnings to be immune to -Werror as
...
they are supposed to be.
llvm-svn: 69265
2009-04-16 04:32:54 +00:00
Chris Lattner
411c0ffe5d
change mappings to distinguish between "unset", "set by the user" and
...
"set to the default value".
llvm-svn: 69264
2009-04-16 04:12:40 +00:00
Daniel Dunbar
08e82f955a
Driver: Remove the majority of -W* options, the driver doesn't
...
generally need to know about these now we don't have to hold
clang-cc's hand.
llvm-svn: 69263
2009-04-16 04:00:30 +00:00
Chris Lattner
af73cf6363
use getDiagnosticLevel instead of getDiagnosticMapping, which
...
is about to become private.
llvm-svn: 69262
2009-04-16 03:59:32 +00:00
Daniel Dunbar
b4b3709c5b
Driver: Forward -W* to clang, it can handle all these itself now.
...
Remove clang_W_Group and clang_ignored_W_Group.
llvm-svn: 69261
2009-04-16 03:44:10 +00:00
Chris Lattner
e4f753233b
switch DiagMappings *back* to 4 bits per diag.
...
llvm-svn: 69260
2009-04-16 03:41:37 +00:00
Chris Lattner
169fd70999
implement -Wno-#warnings etc.
...
llvm-svn: 69259
2009-04-16 03:27:53 +00:00
Douglas Gregor
6d955a9d25
Eliminate pch::TYPE_ATTR, which is never used
...
llvm-svn: 69256
2009-04-16 02:45:14 +00:00
Douglas Gregor
4c5cd33527
PCH support for CompoundLiteralExpr. This is the last C expression
...
that does not require PCH support for statements. Only AddrLabelExpr,
StmtExpr, and BlockExpr remain (for C).
llvm-svn: 69255
2009-04-16 02:33:48 +00:00
Douglas Gregor
38676d50dc
PCH support for InitListExpr, DesignatedInitExpr, and ImplicitValueInitExpr.
...
llvm-svn: 69251
2009-04-16 00:55:48 +00:00
Chris Lattner
e82c3cc848
when tblgen fills in all the subgroup info, clang is ready for it.
...
This depends on r69249 of llvm.
llvm-svn: 69250
2009-04-16 00:53:55 +00:00
Chris Lattner
de1423883a
add scafolding to represent heirarchical warnings, start with -Wall.
...
llvm-svn: 69246
2009-04-16 00:23:21 +00:00
Anders Carlsson
fe63dc52f9
Add support for the __has_trivial_constructor type trait.
...
llvm-svn: 69245
2009-04-16 00:08:20 +00:00
Douglas Gregor
a3c5590ec2
PCH support for ShuffleVectorExpr and BlockDeclRefExpr
...
llvm-svn: 69244
2009-04-16 00:01:45 +00:00
Douglas Gregor
8693ec4e58
PCH support for TypesCompatibleExpr, ChooseExpr, and GNUNullExpr.
...
llvm-svn: 69242
2009-04-15 23:33:31 +00:00
Douglas Gregor
2ebf8717a5
PCH support for ExtVectorElementExpr and VAArgExpr.
...
llvm-svn: 69240
2009-04-15 23:02:49 +00:00
Chris Lattner
3fd869cc6c
make unknown warnings a warning, not an error.
...
llvm-svn: 69239
2009-04-15 22:48:58 +00:00
Chris Lattner
eb8ec21dc9
add anonymous groups for all the warning command line flags that the clang
...
driver accepts and discards.
llvm-svn: 69238
2009-04-15 22:47:03 +00:00
Douglas Gregor
d4ed114e23
PCH support for CompoundAssignOperator and ConditionalOperator
...
llvm-svn: 69237
2009-04-15 22:40:36 +00:00
Chris Lattner
7836eefefc
add support for -Wextra and -W
...
llvm-svn: 69236
2009-04-15 22:38:06 +00:00
Chris Lattner
9ac5f22fc7
comment out IsGroup: tblgen isn't instantiating these dependent defs quite right yet.
...
llvm-svn: 69234
2009-04-15 22:32:37 +00:00
Douglas Gregor
978887b6b0
PCH support for ImaginaryLiteral and ArraySubscriptExpr
...
llvm-svn: 69233
2009-04-15 22:19:53 +00:00
Mike Stump
3b65ac2696
Fixup codegen for copy/dispose for block literals. Radar 6791245
...
llvm-svn: 69232
2009-04-15 22:11:36 +00:00
Daniel Dunbar
7dd749e6fd
Defer generation of tentative definitions.
...
- PR3980.
- <rdar://problem/6762287> [irgen] crash when generating tentative
definition of incomplete structure
- This also avoids creating common definitions for things which are
later overwritten.
- XFAIL'ed external-defs.c, it isn't completing types properly yet.
llvm-svn: 69231
2009-04-15 22:08:45 +00:00
Douglas Gregor
455b8f4106
PCH support for ExtQualType
...
llvm-svn: 69230
2009-04-15 22:00:08 +00:00
Fariborz Jahanian
3453f7d410
Fix decl type merges when they have
...
__string/__weak attributes.
llvm-svn: 69229
2009-04-15 21:54:48 +00:00
Devang Patel
9074ed8c6a
Set DebugInfo at the beginning of GenerateBlockFunction().
...
llvm-svn: 69228
2009-04-15 21:51:44 +00:00
Anders Carlsson
332ef55cf2
When declaring a variable that has a constructor and a direct initializer, for example:
...
struct X {
X(int, int);
};
X x(10, 10);
we model that as
X x = X(10, 10);
inserting a temporary object expr.
llvm-svn: 69227
2009-04-15 21:48:18 +00:00
Daniel Dunbar
c7ba533378
Add warning when a tentative array definition is assumed to have one element.
...
- Also, fixed one to actually be one (instead of zero). :)
llvm-svn: 69226
2009-04-15 21:35:27 +00:00
Douglas Gregor
bc8a78d5a4
PCH support for declaration attributes
...
llvm-svn: 69225
2009-04-15 21:30:51 +00:00
Anders Carlsson
617482c666
Actually generate code for the simple constructors we know we can generate code for.
...
llvm-svn: 69222
2009-04-15 21:02:13 +00:00
Chris Lattner
680eb1b893
use tablgen-generated warning groups.
...
llvm-svn: 69221
2009-04-15 20:58:49 +00:00
Chris Lattner
ddf228dc47
generate diagnostic group tables, this requires llvm r69219 or later.
...
llvm-svn: 69220
2009-04-15 20:55:31 +00:00
Chris Lattner
ccc68f8fb1
fix a name shadowing problem in tblgen.
...
llvm-svn: 69218
2009-04-15 20:54:55 +00:00
Chris Lattner
76784d70bc
use slightly more verbose to work around a tblgen bug for now.
...
llvm-svn: 69214
2009-04-15 20:29:48 +00:00
Chris Lattner
f4192b3346
move clang specific makefile goop to clang instead of llvm. This may require
...
updating the llvm tree.
llvm-svn: 69207
2009-04-15 19:58:08 +00:00
Daniel Dunbar
4b68d26a93
Don't use \01 in symbol name if unnecessary.
...
- This was particularly bad since I fixed one instance of this name
and not another, meaning we got an LLVM module with the same
effective name in two different globals!
llvm-svn: 69205
2009-04-15 19:52:32 +00:00
Steve Naroff
439a3e4106
Fix <rdar://problem/6786597> varargs not supported for Blocks under clang.
...
Teach Sema::SemaBuiltinVAStart() about blocks.
llvm-svn: 69201
2009-04-15 19:33:47 +00:00
Fariborz Jahanian
47b21081cb
Patch to remove a bogus warning which pointed to underlying AST
...
gen. issue for property in continuation class declared readwrite
but which did not generate the declaration for the setter. Fix also
removed a FIXME and resulted in code cleanup.
llvm-svn: 69200
2009-04-15 19:19:03 +00:00
Daniel Dunbar
24645c9ff4
Fix alignment on obj_msgrefs to match llvm-gcc.
...
llvm-svn: 69199
2009-04-15 19:04:46 +00:00
Daniel Dunbar
e60aa05d34
Add test case for superrefs section (and make spacing consistent).
...
llvm-svn: 69198
2009-04-15 19:03:14 +00:00
Chris Lattner
d9ecb8e279
fix some out of bounds array access problems, which manifest particularly
...
spectacularly when built for x86-64.
llvm-svn: 69197
2009-04-15 18:48:23 +00:00
Douglas Gregor
e95304ac93
PCH support for the string literal of a FileScopeAsmDecl.
...
Some minor cleanup.
llvm-svn: 69196
2009-04-15 18:43:11 +00:00
Chris Lattner
001e994495
move some pp diags to the right .td file.
...
llvm-svn: 69193
2009-04-15 18:13:28 +00:00
Chris Lattner
d9dadc7d30
annotate diagnostics with which groups they belong to. Each
...
diagnostic can belong to at most one group. Each group can
contain multiple diags, but we have nice syntax for the common
case of "1 diag to one group".
llvm-svn: 69192
2009-04-15 18:08:55 +00:00
Douglas Gregor
8324327993
For source location entries that describe instantiations, encode the
...
token length in the PCH file rather than trying (and failing) to
reconstruct it be getting the spelling token's length.
llvm-svn: 69191
2009-04-15 18:05:10 +00:00
Douglas Gregor
e20a2e5fa3
PCH support for MemberExpr and CallExpr.
...
llvm-svn: 69186
2009-04-15 17:43:59 +00:00
Steve Naroff
bb99c5c933
Fixup http://llvm.org/viewvc/llvm-project?rev=69165&view=rev (based on feedback from Eli).
...
llvm-svn: 69184
2009-04-15 17:31:31 +00:00
Chris Lattner
76732c2fca
now that we've decoupled diagnostic classes from default mappings,
...
move the remaining default mapping exceptions from C++ code into
the .td files.
llvm-svn: 69183
2009-04-15 17:20:11 +00:00
Chris Lattner
2fe292076e
move {'s
...
llvm-svn: 69179
2009-04-15 17:13:42 +00:00
Steve Naroff
6f84266619
Revert previous patch (will commit a fix soon).
...
llvm-svn: 69178
2009-04-15 16:58:41 +00:00
Chris Lattner
e6c831deb2
Make diagnostic class explicit in the diag record instead of
...
implicit from its parenting. Now that diag mapping is
explicit, eliminate the fatal and extwarn classes.
llvm-svn: 69177
2009-04-15 16:56:26 +00:00
Chris Lattner
1b595624a8
Tblgen now passes the default mapping explicitly, instead of having it
...
be tied to the diag class. This requires an LLVM tree update.
llvm-svn: 69175
2009-04-15 16:44:12 +00:00
Chris Lattner
485626c5f5
add a bunch of files.
...
llvm-svn: 69174
2009-04-15 16:43:37 +00:00
Douglas Gregor
958dfc9bbd
PCH support for string literals
...
llvm-svn: 69172
2009-04-15 16:35:07 +00:00
Daniel Dunbar
a7b5e219bb
Driver: Add --help-hidden
...
llvm-svn: 69171
2009-04-15 16:34:29 +00:00
Fariborz Jahanian
f5e8ddd550
__objc_superrefs belongs to __DATA segment.
...
llvm-svn: 69170
2009-04-15 16:31:36 +00:00
Douglas Gregor
0253c83610
PCH support for UnaryOperator, SizeOfAlignOfExpr
...
llvm-svn: 69169
2009-04-15 15:58:59 +00:00
Anders Carlsson
f747524819
Start attempting to generate code for C++ ctors.
...
llvm-svn: 69168
2009-04-15 15:55:24 +00:00
Steve Naroff
635168aa33
Fix <rdar://problem/6789707> "warning: 'extern' variable has an initializer" not correct for __private_extern__.
...
llvm-svn: 69167
2009-04-15 15:20:03 +00:00
Chris Lattner
5a8c8df08c
rename variable in comment, not just in code :).
...
llvm-svn: 69166
2009-04-15 14:42:02 +00:00
Steve Naroff
fab0262047
Fix <rdar://problem/6791490> [clang10 regression] [sema] invalid illegal jump diagnostic.
...
caused by: <rdar://problem/6252084> [sema] jumps into Obj-C exception blocks should be disallowed.
Sema::RecursiveCalcLabelScopes() and Sema::RecursiveCalcJumpScopes() need to pop the ScopeStack within the statement iteration loop (was outside the loop).
Eli, please review (thanks).
llvm-svn: 69165
2009-04-15 14:38:36 +00:00
Chris Lattner
9428a21067
this should be private
...
llvm-svn: 69158
2009-04-15 07:06:34 +00:00
Chris Lattner
f5f049b548
add another sanity check for -Werror=xx
...
llvm-svn: 69157
2009-04-15 07:05:12 +00:00
Chris Lattner
5ea5dc8a3a
add a missing &&
...
llvm-svn: 69156
2009-04-15 07:03:57 +00:00
Chris Lattner
e9dba48684
fix a broken test, that passed for the wrong reason. Two wrongs make a right! :)
...
llvm-svn: 69155
2009-04-15 07:02:57 +00:00
Chris Lattner
e007de3b9a
Rejigger how -pedantic and -pedantic-errors work and their interaction
...
with other diagnostic mapping. In the new scheme, -Wfoo or -Wno-foo or
-Werror=foo all override the -pedantic options, and __extension__
robustly silences all extension diagnostics in their scope.
An added bonus of this change is that MAP_DEFAULT goes away, meaning that
per-diagnostic mapping information can now be stored in 2 bits, doubling
the density of the Diagnostic::DiagMapping array. This also
substantially simplifies Diagnostic::getDiagnosticLevel.
OTOH, this temporarily introduces some "macro intensive" code in
Diagnostic.cpp. This will be addressed in a later patch.
llvm-svn: 69154
2009-04-15 07:01:18 +00:00
Douglas Gregor
d5846a1eb5
Implement support for designated initializers that refer to members of
...
anonymous structs or unions. Fixes PR3778.
llvm-svn: 69153
2009-04-15 06:41:24 +00:00
Anders Carlsson
e4c40c8baf
Add support for mangling C++ constructors. Review appreciated (I'm looking at you, Doug)
...
llvm-svn: 69150
2009-04-15 05:36:58 +00:00
Chris Lattner
28bb15f16d
make default diagnostic mapping more explicit in .td file.
...
llvm-svn: 69149
2009-04-15 05:15:08 +00:00
Chris Lattner
ce682d9ea5
remove some commented out -Wstrict-selector-match stuff.
...
llvm-svn: 69148
2009-04-15 04:57:48 +00:00
Douglas Gregor
a532416d39
Switch designated-initializer checking from using designator iterators
...
to using designator indices. No functionality change.
llvm-svn: 69147
2009-04-15 04:56:10 +00:00
Douglas Gregor
534b6f27a0
Don't tip-to around BitstreamReader::JumpToBit jumping to the end of the stream. LLVM has been updated to allow this
...
llvm-svn: 69146
2009-04-15 04:54:29 +00:00
Chris Lattner
8a1dc20756
clean up error messages.
...
llvm-svn: 69142
2009-04-15 04:51:48 +00:00
Chris Lattner
00364c38d7
add Diagnostic.td to proj
...
llvm-svn: 69141
2009-04-15 04:51:29 +00:00
Chris Lattner
384a59cac1
Add support for -Werror=foo and -Wno-error=foo
...
llvm-svn: 69138
2009-04-15 04:37:12 +00:00
Anders Carlsson
375d6beb6c
Add CGCXX.h with ctor/dtor type enumerations. No functionality change.
...
llvm-svn: 69137
2009-04-15 04:36:55 +00:00
Chris Lattner
4c73b67efb
refactor a bunch of the warning parsing stuff to simplify it. This removes the
...
-Wfoo=ignore syntax. GCC supports -Wno-foo, no need to invent our own stuff.
llvm-svn: 69136
2009-04-15 04:27:38 +00:00
Chris Lattner
e94e13ca35
remove #include of system header, making this a) not apple specific, and
...
b) test dramatically faster.
llvm-svn: 69135
2009-04-15 04:26:10 +00:00
Anders Carlsson
c483bd0724
Simplify CodeGenFunction::GenerateCode.
...
llvm-svn: 69134
2009-04-15 04:10:19 +00:00
Zhongxing Xu
55b6908f00
remove dead code.
...
llvm-svn: 69133
2009-04-15 03:36:15 +00:00
Daniel Dunbar
b25452a98e
Tweaks to Objective-C metadata (32 & 64-bit) to match llvm-gcc.
...
- Set alignment on property lists.
- 32-bit:
o Set section on property lists.
o Fix section name for category class methods.
o Fix symbol name for property lists.
o Fix section name for class method.
o Set alignment and section on class extension structure.
o Set alignment on a number of things: instance variables, methods,
method descriptions, the symbols structure.
- 64-bit:
o Fix section flags for protocol list.
I doubt most of these were problems in practice, but it is nice to
match llvm-gcc.
llvm-svn: 69132
2009-04-15 02:56:18 +00:00
Daniel Dunbar
2edd923c90
Driver: For clang, accept -fsigned-bitfields and reject
...
-funsigned-bitfields for now (clang defaults to -fsigned-bitfields).
- <rdar://problem/6790309> ER: Support
-fsigned-bitfields/-funsigned-bitfields
llvm-svn: 69131
2009-04-15 02:37:43 +00:00
Douglas Gregor
67fdb085b9
PCH support for CStyleCastExpr and BinaryOperator expression kinds.
...
llvm-svn: 69119
2009-04-15 00:25:59 +00:00
Daniel Dunbar
c2223ab255
Improve "assignment to cast" diagnostic.
...
- Strip off extra parens when looking for casts.
- Change the location info to point at the cast (instead of the
assignment).
For example, on
int *b;
#define a ((void*) b)
void f0() {
a = 10;
}
we now emit:
/tmp/t.c:4:3: error: assignment to cast is illegal, lvalue casts are not supported
a = 10;
^ ~
/tmp/t.c:2:12: note: instantiated from:
#define a ((void*) b)
~^~~~~~~~~~
instead of:
/tmp/t.c:4:5: error: expression is not assignable
a = 10;
~ ^
llvm-svn: 69114
2009-04-15 00:08:05 +00:00
Douglas Gregor
954a830eca
PCH support for ParenExpr
...
llvm-svn: 69106
2009-04-14 23:59:37 +00:00
Douglas Gregor
f0b575f79d
Add PCH support for ImplicitCastExprs. This is the first expression
...
kind PCH handles that has an expression as an operand, so most of this
work is in the infrastructure to rebuild expression trees from the
serialized representation. We now store expressions in post-order
(e.g., Reverse Polish Notation), so that we can easily rebuild the
appropriate expression tree.
llvm-svn: 69101
2009-04-14 23:32:43 +00:00
Daniel Dunbar
9351c02bef
Strip paren expressions when trying to diagnose "cast as lvalue"
...
extension.
llvm-svn: 69100
2009-04-14 23:26:44 +00:00
Chris Lattner
184e65d363
Change Lexer::MeasureTokenLength to take a LangOptions reference.
...
This allows it to accurately measure tokens, so that we get:
t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~~^
instead of the woefully inferior:
t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~ ^
Most of this is just plumbing to push the reference around.
llvm-svn: 69099
2009-04-14 23:22:57 +00:00
Fariborz Jahanian
6c6aea914a
Diagnose properties which have no implementations;
...
either unimplemented setter/getter or no
implementation directive.
llvm-svn: 69098
2009-04-14 23:15:21 +00:00
Daniel Dunbar
3241fae46c
Set alignment on __cstring metadata variables to 1 (matching
...
llvm-gcc).
llvm-svn: 69097
2009-04-14 23:14:47 +00:00
Daniel Dunbar
729df96bf5
Avoid use of magic \01 prefix when unneeded.
...
llvm-svn: 69093
2009-04-14 22:44:26 +00:00
Chris Lattner
faa1dbb4d0
add fixitrewriter to xcode proj
...
llvm-svn: 69092
2009-04-14 22:44:23 +00:00
Daniel Dunbar
346892aafc
Comment fix.
...
llvm-svn: 69091
2009-04-14 22:41:13 +00:00
Chris Lattner
b4a8fe8dcc
Make the implicit-int handling error recovery stuff handle C++
...
nested name specifiers. Now we emit stuff like:
t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~ ^
instead of:
t.cpp:8:16: error: invalid token after top level declarator
static foo::X P;
^
This is inspired by a really awful error message I got from
g++ when I misspelt diag::kind as diag::Kind.
llvm-svn: 69086
2009-04-14 22:17:06 +00:00
Douglas Gregor
e0a3a51637
Add PCH support for PredefinedExpr and FloatingLiteral expressions
...
llvm-svn: 69084
2009-04-14 21:55:33 +00:00
Chris Lattner
20a0c61487
refactor "implicit int error recovery" code out of
...
ParseDeclarationSpecifiers into its own function, no
functionality change.
llvm-svn: 69083
2009-04-14 21:34:55 +00:00
Douglas Gregor
feb84b0074
PCH support for a few very, very simple kinds of expressions. Hook up
...
expression (de-)serialization for VLAs, variable initializers,
enum constant initializers, and bitfield widths.
llvm-svn: 69075
2009-04-14 21:18:50 +00:00
Chris Lattner
a723ba97db
Fix a regression in a previous patch that broke implicit
...
int in a bitfield. Shantonu found this in a gcc testsuite file.
llvm-svn: 69074
2009-04-14 21:16:09 +00:00
Steve Naroff
5196c618fb
Fix <rdar://problem/6252084> [sema] jumps into Obj-C exception blocks should be disallowed.
...
This builds on Eli's work from http://llvm.org/viewvc/llvm-project?view=rev&revision=65678 .
llvm-svn: 69073
2009-04-14 20:53:38 +00:00
Chris Lattner
b874dbd478
add support for -W[no-]extra-tokens
...
llvm-svn: 69071
2009-04-14 20:36:01 +00:00
Chris Lattner
28549de12c
remove dead enum
...
llvm-svn: 69070
2009-04-14 20:30:29 +00:00
Chris Lattner
bae0e68930
Fix PR3988: extern inline functions get strong symbol definitions in
...
C99 mode. This is a regression from an earlier patch of mine.
This also simplifies the linkage enums a bit.
llvm-svn: 69069
2009-04-14 20:25:53 +00:00
Fariborz Jahanian
899e7eb6c7
Do not dead code strip global meta-data objects.
...
This will match gcc's behavior in the arena.
llvm-svn: 69061
2009-04-14 18:41:56 +00:00
Mike Stump
d73e4419f5
Fixup whitespacing.
...
llvm-svn: 69055
2009-04-14 18:24:37 +00:00
Chris Lattner
66037791b1
temporarily revert r69046
...
llvm-svn: 69054
2009-04-14 18:05:08 +00:00
Daniel Dunbar
4527d30c3d
Fix comment.
...
llvm-svn: 69053
2009-04-14 17:42:51 +00:00
Douglas Gregor
db908332e3
Add a tricky, tricky test case for PCH that we currently don't handle. Committed with a FIXME so that we don't forget it
...
llvm-svn: 69052
2009-04-14 17:10:28 +00:00
Chris Lattner
4225e23e62
implement some sema for gnuc_inline attribute. Reject always_inline and no_inline on objc methods.
...
llvm-svn: 69051
2009-04-14 17:02:11 +00:00
Anders Carlsson
a5d077df73
Support code generation of 'this' exprs
...
llvm-svn: 69050
2009-04-14 16:58:56 +00:00
Sanjiv Gupta
69650b099a
Literal value calculation isn't likely to overflow on targets having int as 32 or less. Fixing the assert as it otherwise triggers for PIC16 which as i16 as int.
...
llvm-svn: 69046
2009-04-14 16:46:37 +00:00
Chris Lattner
02e987f3e8
implement codegen support for __attribute((__gnuc_inline__)),
...
pulling some attribute munging stuff into GetLinkageForFunction.
This should fix PR3986
llvm-svn: 69045
2009-04-14 16:44:36 +00:00
Chris Lattner
eaad6b70a9
recognize the gnuc_inline attribute.
...
llvm-svn: 69044
2009-04-14 16:30:50 +00:00
Douglas Gregor
54feb84489
When building a PCH file, don't perform end-of-translation-unit
...
wrap-up (e.g., turning tentative definitions into definitions). Also,
very that, when we actually use the PCH file, we get the ride code
generation for tentative definitions and definitions that show up in
the PCH file.
llvm-svn: 69043
2009-04-14 16:27:31 +00:00
Steve Naroff
06f440dd7b
ASTContext::mergeTypes(): Loosen up the type checking for 'Class' (treating it like 'id').
...
This fixes <rdar://problem/6782722> XCDataTipsManager.m registers, observes notifications in class methods.
The radar above is the result of clang typing 'self' in a class method as 'Class', which results in some spurious warnings (GCC types 'self' in a class method as 'id').
I considered changing the type of 'self' to 'id' (to conform to GCC), however this resulted in *many* test cases breaking. In addition, I really prefer a more strongly typed 'self'.
All in all, this is the least obtrusive fix I could find for removing the spurious warnings (though we do loose some valid warnings).
llvm-svn: 69041
2009-04-14 15:11:46 +00:00
Daniel Dunbar
389325715b
Refactor how attributes are set on values.
...
- Pull out SetCommonAttributes, which handles the things common to
aliases, methods, functions, and variables.
- Pull out SetLLVMFunctionAttributesForDefinition, which handles the
LLVM attributes which we only want to apply to a definition (like
noinline and alwaysinline).
- Kill SetGVDeclarationAttributes (inlined into SetFunctionAttributes
and specialized).
- Kill SetFunctionAttributesForDefinition (inlined into sole caller).
- Inline SetGVDefinitionAttributes into SetMethodAttributes and
specialize.
- Rename SetGVDefinitionAttributes to SetFunctionDefinitionAttributes.
This is supposed to be a no functionality change commit, but I may
have made a mistake.
llvm-svn: 69036
2009-04-14 08:05:55 +00:00
Daniel Dunbar
81a3f1bdf3
Split SetGlobalValueAttributes into definition/declaration halves.
...
- No functionality change.
llvm-svn: 69035
2009-04-14 07:19:20 +00:00
Daniel Dunbar
aeddffc99d
Rename (one) SetFunctionAttributes to SetLLVMFunctionAttributes to
...
disambiguate it.
- No functionality change.
llvm-svn: 69034
2009-04-14 07:08:30 +00:00
Daniel Dunbar
64a41cb39e
Reduce indentation, no functionality change.
...
llvm-svn: 69033
2009-04-14 07:02:17 +00:00
Chris Lattner
92028dad66
defer emission of always_inline, extern_inline, and inline functions (when
...
not in c89 mode).
llvm-svn: 69032
2009-04-14 06:44:48 +00:00
Chris Lattner
169a5c963f
give always_inline functions internal linkage. If they cannot be
...
inlined for some reason, then we don't want a strong or even weak
definition.
llvm-svn: 69031
2009-04-14 06:32:05 +00:00
Chris Lattner
256c9507c8
set the linkage of an inline function according to its language rules.
...
llvm-svn: 69030
2009-04-14 06:27:57 +00:00
Daniel Dunbar
29eff88fc8
Add a comment on SetGlobalValueAttributes.
...
llvm-svn: 69029
2009-04-14 06:19:49 +00:00
Chris Lattner
3e031f4121
add a new enum type for linkage, no functionality change.
...
llvm-svn: 69028
2009-04-14 06:04:17 +00:00
Daniel Dunbar
f5f359fb73
Clean up handling of visibility.
...
llvm-svn: 69027
2009-04-14 06:00:08 +00:00
Chris Lattner
73920ce565
reduce indentation, no functionality change.
...
llvm-svn: 69026
2009-04-14 05:33:52 +00:00
Chris Lattner
6a0f907a5e
do not set visibility on "private" or "available externally" linkage objects.
...
llvm-svn: 69025
2009-04-14 05:27:13 +00:00
Chris Lattner
825676afdf
Offer a fixit hint for our warning about tokens at the end of a directive:
...
t.c:3:8: warning: extra tokens at end of #endif directive
#endif foo
^
//
Don't do this in strict-C89 mode because bcpl comments aren't
valid there, and it is too much trouble to analyze whether
C block comments are safe.
llvm-svn: 69024
2009-04-14 05:15:20 +00:00
Chris Lattner
ce2ab6f425
Fix the #import / #include_next "extra tokens at end of #foo directive"
...
Warning to properly report that it is an import/include_next instead of
claiming it is a #include.
llvm-svn: 69023
2009-04-14 05:07:49 +00:00
Mike Stump
4c0dc0e48a
Use hasAttr instead of getAttr for conditionals.
...
llvm-svn: 69021
2009-04-14 02:45:29 +00:00
Daniel Dunbar
0ca1660129
Audit __private_extern__ handling.
...
- Exposed quite a few Sema issues and a CodeGen crash.
- See FIXMEs in test case, and in SemaDecl.cpp (PR3983).
I'm skeptical that __private_extern__ should actually be a storage
class value. I think that __private_extern__ basically amounts to
extern A __attribute__((visibility("hidden")))
and would be better off handled (a) as that, or (b) with an extra bit
in the VarDecl.
llvm-svn: 69020
2009-04-14 02:25:56 +00:00
Daniel Dunbar
b76b745707
Add VarDecl::getStorageClassSpecifierString (StorageClass -> const char*).
...
- No functionality change.
llvm-svn: 69019
2009-04-14 02:08:49 +00:00
Mike Stump
ca5ae66122
Fixup CodeGen for __weak __block variables. Radar 6756266
...
llvm-svn: 69010
2009-04-14 00:57:29 +00:00
Mike Stump
d74673133d
Fix build error.
...
llvm-svn: 69009
2009-04-14 00:56:59 +00:00
Steve Naroff
323827e8d0
Change dyn_cast<> to isa<>. Pointed out by Anders (thanks).
...
llvm-svn: 69007
2009-04-14 00:40:09 +00:00
Douglas Gregor
1a0d0b9acc
When writing a PCH file, keep track of all of the non-static,
...
non-inline external definitions (and tentative definitions) that are
found at the top level. The corresponding declarations are stored in a
record in the PCH file, so that they can be provided to the
ASTConsumer (via HandleTopLevelDecl) when the PCH file is read.
llvm-svn: 69005
2009-04-14 00:24:19 +00:00
Steve Naroff
e4e55d2706
Fix crasher in ASTContext::getObjCEncodingForMethodDecl().
...
This was exposed as a result of something else that was recently fixed.
llvm-svn: 69004
2009-04-14 00:03:58 +00:00
Douglas Gregor
a541485bab
Partial PCH support for FileScopeAsmDecl and BlockDecl. Both require
...
expression or statement serialization before we can test them.
llvm-svn: 69002
2009-04-13 22:49:25 +00:00
Douglas Gregor
92f056fadf
PCH support for functions and their parameters.
...
llvm-svn: 68997
2009-04-13 22:18:37 +00:00
Eli Friedman
20bb5e02a5
Minor work related to removing the assumption that value initialization
...
implies an all-zero bit pattern.
llvm-svn: 68994
2009-04-13 21:47:26 +00:00
Eli Friedman
c08711e840
Minor simplification.
...
llvm-svn: 68992
2009-04-13 21:41:57 +00:00
Eli Friedman
337cd3a536
PR3461: reject initializer for incomplete type. Based on patch by Tim
...
Northover.
llvm-svn: 68991
2009-04-13 21:28:54 +00:00
Daniel Dunbar
c0a4ea0c02
Remove CheckBuiltinMacros script, obsoleted since we support -dM now.
...
llvm-svn: 68990
2009-04-13 21:26:41 +00:00
Douglas Gregor
183671e2d2
PCH support for record decls/types and their fields. Now that we can
...
handle the definition of __builtin_va_list on x86-64, eliminate the
forced -triple in PCH tests to get better coverage.
llvm-svn: 68988
2009-04-13 21:20:57 +00:00
Daniel Dunbar
4184ac847f
Update to use hasAttr() instead of getAttr().
...
- No functionality change.
llvm-svn: 68987
2009-04-13 21:08:27 +00:00
Douglas Gregor
c3b1dd163b
Print the number (and percentage) of identifiers read from the PCH file as part of its statistics
...
llvm-svn: 68985
2009-04-13 20:50:16 +00:00
Douglas Gregor
85c0fcd66d
Introduce PCH (de-)serialization for most compound types, excluding
...
Objective-C types and record types for the moment.
llvm-svn: 68984
2009-04-13 20:46:52 +00:00
Daniel Dunbar
a431deb03c
Reapply 68936, turned out to that clang's better debug info exposed a
...
codegenerator bug.
llvm-svn: 68983
2009-04-13 20:46:33 +00:00
Steve Naroff
fb46e8658c
Move/update recent FIXME (wrt UTF-8 checking for ObjC @-strings).
...
llvm-svn: 68982
2009-04-13 20:26:29 +00:00
Chris Lattner
648fa92fe1
upgrade "extra tokens at end of directive" to warn by default.
...
llvm-svn: 68980
2009-04-13 20:19:36 +00:00
Fariborz Jahanian
b6d5b54839
In objc2's None-Fragile ABI, one cannot use the super class ivar for
...
setter/getter synthesis.
llvm-svn: 68976
2009-04-13 19:30:37 +00:00
Steve Naroff
84073ec51f
Fixed crasher in <rdar://problem/6780904> [irgen] Assertion failed: (Result == conversionOK && "UTF-8 to UTF-16 conversion failed"), function GetAddrOfConstantCFString, file CodeGenModule.cpp, line 1063.
...
Still a diagnostic related FIXME (will discuss with Daniel/Fariborz offline).
llvm-svn: 68975
2009-04-13 19:08:08 +00:00
Douglas Gregor
1daeb69f95
Add PCH support for enumerations and enumerators.
...
llvm-svn: 68974
2009-04-13 18:14:40 +00:00
Daniel Dunbar
f3d0dccfff
Revert 68936, LLVM still isn't ready to handle debug info + optimization.
...
llvm-svn: 68972
2009-04-13 18:03:39 +00:00
Anders Carlsson
1235bbce7e
Use the new guard variable mangling function and get rid of the old code.
...
llvm-svn: 68971
2009-04-13 18:03:33 +00:00
Anders Carlsson
0c08f6fdde
Add support for mangling guard variables.
...
llvm-svn: 68969
2009-04-13 18:02:10 +00:00
Steve Naroff
42959b2660
Change diagnostic as a result of researching <rdar://problem/6779809> missing interface name in "error: cannot declare variable inside a class, protocol or category ''.
...
Since ObjC 2.0 class "extensions" have a null name, the diagnostic above is actually "correct". Nevertheless, it is confusing. Decided to remove the name entirely (from my perspective, it didn't add any value). Also simplified the text of the diagnostic a bit.
llvm-svn: 68967
2009-04-13 17:58:46 +00:00
Daniel Dunbar
2cba6be499
Fix assertion failure in PTH when tokens followed a closing #endif.
...
- Ted, please check.
- Missing test case because PTH won't reliably cache the tokens in a
test case. *cough*
llvm-svn: 68966
2009-04-13 17:57:49 +00:00
Douglas Gregor
a8854654ac
Make the reading of the line table from a PCH file more robust against
...
the unlikely event that the filename IDs in the stored line table end
up being different from the filename IDs in the newly-created line
table.
llvm-svn: 68965
2009-04-13 17:12:42 +00:00
Douglas Gregor
4c7626e7b6
Include the SourceManager's line table in the PCH file. We can now
...
properly cope with #line directives in PCH files.
llvm-svn: 68963
2009-04-13 16:31:14 +00:00
Douglas Gregor
a07ebc5b95
Factor the internals of SourceManager (specially, LineTableInfo) into a separate Internals header. No functionality change
...
llvm-svn: 68960
2009-04-13 15:31:25 +00:00
Douglas Gregor
712a351c42
Make the selection of type declarations in Sema::getTypeName
...
deterministic when faced with an ambiguity. This eliminates the
annoying test/SemaCXX/using-directive.cpp failure.
llvm-svn: 68952
2009-04-13 15:14:38 +00:00
Chris Lattner
1050b99f8c
the driver caught up. This makes -msse3 correctly set __SSE3__ etc.
...
llvm-svn: 68943
2009-04-13 06:33:49 +00:00
Chris Lattner
5c6160d019
fix rdar://6774906, a crash handling implicit conversions between pointers
...
in different address spaces.
llvm-svn: 68941
2009-04-13 06:04:39 +00:00
Devang Patel
e8f66b3ed0
Enable debug info generation while optimizing.
...
llvm-svn: 68936
2009-04-13 04:22:59 +00:00
Chris Lattner
7de6456593
mention the non-standard builtin macros we support.
...
llvm-svn: 68935
2009-04-13 02:45:46 +00:00
Chris Lattner
0af3ba1748
implement the microsoft/gnu "__COUNTER__" macro: rdar://4329310
...
llvm-svn: 68933
2009-04-13 01:29:17 +00:00
Chris Lattner
0d6c061401
Improve error recovery for calls, fixing:
...
PR3972: Poor diagnostic with missing ')'
llvm-svn: 68932
2009-04-13 00:10:38 +00:00
Chris Lattner
bc670459ad
fix PR3932: [ObjC]Type defined as 'id' is not recognized as a valid object type.
...
by making ASTContext::isObjCObjectPointerType accept typedefs of id.
llvm-svn: 68931
2009-04-12 23:51:02 +00:00
Chris Lattner
1e2f763c4c
rename test
...
llvm-svn: 68930
2009-04-12 23:49:38 +00:00
Chris Lattner
bdccb0393c
add some more coverage.
...
llvm-svn: 68928
2009-04-12 23:29:27 +00:00
Chris Lattner
e1b4174a9a
clean up test.
...
llvm-svn: 68927
2009-04-12 23:27:53 +00:00
Chris Lattner
0177518897
rename test
...
llvm-svn: 68926
2009-04-12 23:27:31 +00:00
Chris Lattner
a2ca03a908
if we already know that a decl is invalid in an @catch , don't verify its type.
...
llvm-svn: 68925
2009-04-12 23:26:56 +00:00
Chris Lattner
eb4373df60
fix some out of date comments pointed out by Sebastian
...
llvm-svn: 68923
2009-04-12 22:37:57 +00:00
Chris Lattner
1d37dcc986
fix a comment typo Sebastian noticed.
...
llvm-svn: 68921
2009-04-12 22:30:22 +00:00
Chris Lattner
2b988c12fb
add support for handling C++'0x unified initializer syntax
...
to isValidAfterIdentifierInDeclarator, as suggested by Sebastian.
llvm-svn: 68920
2009-04-12 22:29:43 +00:00
Chris Lattner
869c6610c7
Fix some C++ error recovery problems in init declarator parsing
...
that I noticed working on other things.
Instead of emitting:
t2.cc:1:8: error: use of undeclared identifier 'g'
int x(*g);
^
t2.cc:1:10: error: expected ')'
int x(*g);
^
t2.cc:1:6: note: to match this '('
int x(*g);
^
We now only emit:
t2.cc:1:7: warning: type specifier missing, defaults to 'int'
int x(*g);
^
Note that the example in SemaCXX/nested-name-spec.cpp:f4 is still
not great, we now produce both of:
void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} \
expected-error {{variable has incomplete type 'void'}}
The second diagnostic should be silenced by something getting marked invalid.
I don't plan to fix this though.
llvm-svn: 68919
2009-04-12 22:23:27 +00:00
Chris Lattner
090d34c692
fix another case that assumed that GetTypeForDeclarator would never return null.
...
llvm-svn: 68918
2009-04-12 22:15:02 +00:00
Chris Lattner
67b0d6afaa
mark the declspec as invalid when we recover instead of forcing to int,
...
this allows downstream diags to be properly silenced.
llvm-svn: 68917
2009-04-12 22:12:26 +00:00
Chris Lattner
38d7919cac
fix code that incorrectly assumed that GetTypeForDeclarator cannot
...
return null.
llvm-svn: 68916
2009-04-12 22:12:06 +00:00
Chris Lattner
ffaa0e6919
Diagnose invalid uses of tagged types with a missing tag. For example, in:
...
struct xyz { int y; };
enum abc { ZZZ };
static xyz b;
abc c;
we used to produce:
t2.c:4:8: error: unknown type name 'xyz'
static xyz b;
^
t2.c:5:1: error: unknown type name 'abc'
abc c;
^
we now produce:
t2.c:4:8: error: use of tagged type 'xyz' without 'struct' tag
static xyz b;
^
struct
t2.c:5:1: error: use of tagged type 'abc' without 'enum' tag
abc c;
^
enum
GCC produces the normal:
t2.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘b’
t2.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c’
rdar://6783347
llvm-svn: 68914
2009-04-12 21:49:30 +00:00
Chris Lattner
14bdb78430
fix a valgrind problem I noticed while developing another patch,
...
if a decl is invalid, it isn't added to the Decls array, so we
need to pass in Decls.size() to avoid reading uninit memory.
llvm-svn: 68913
2009-04-12 20:51:10 +00:00
Chris Lattner
6cc055af1d
Implement the first set of changes for PR3963 and rdar://6759604,
...
which tries to do better error recovery when it is "obvious" that an
identifier is a mis-typed typename. In this case, we try to parse
it as a typename instead of as the identifier in a declarator, which
gives us several options for better error recovery and immediately
makes diagnostics more useful. For example, we now produce:
t.c:4:8: error: unknown type name 'foo_t'
static foo_t a = 4;
^
instead of:
t.c:4:14: error: invalid token after top level declarator
static foo_t a = 4;
^
Also, since we now parse "a" correctly, we make a decl for it,
preventing later uses of 'a' from emitting things like:
t.c:12:20: error: use of undeclared identifier 'a'
int bar() { return a + b; }
^
I'd really appreciate any scrutiny possible on this, it
is a tricky area.
llvm-svn: 68911
2009-04-12 20:42:31 +00:00
Chris Lattner
cbafe8d75c
add a new isNull() method to DeclGroupRef.
...
llvm-svn: 68909
2009-04-12 20:13:14 +00:00
Chris Lattner
8279ceab12
a few cleanups to StatementCreatesScope: unnest the whole thing,
...
exit at the first decl found that creates a scope, don't evaluate
decl_end() every iteration.
llvm-svn: 68908
2009-04-12 20:09:42 +00:00
Chris Lattner
423bcb53f7
add a new Decl::hasAttr<T>() predicate.
...
llvm-svn: 68907
2009-04-12 20:07:59 +00:00
Fariborz Jahanian
8e23171fbc
OS dependent code removed.
...
llvm-svn: 68904
2009-04-12 17:43:53 +00:00
Sebastian Redl
d1309a3c4d
Add deleted functions and rvalue references to C++ status.
...
llvm-svn: 68903
2009-04-12 17:41:24 +00:00
Sebastian Redl
42e92c4bc3
Parse deleted member functions. Parsing member declarations goes through a different code path that I forgot previously.
...
Implement the rvalue reference overload dance for returning local objects. Returning a local object first tries to find a move constructor now.
The error message when no move constructor is defined (or is not applicable) and the copy constructor is deleted is quite ugly, though.
llvm-svn: 68902
2009-04-12 17:16:29 +00:00
Chris Lattner
fa6059ff2f
rename test
...
llvm-svn: 68900
2009-04-12 09:04:18 +00:00
Chris Lattner
0d5640c7be
Fix rdar://6770142 - Class and qualified id's are compatible, just like
...
Class and unqualified id's are.
llvm-svn: 68899
2009-04-12 09:02:39 +00:00
Chris Lattner
baa405fc4c
rename test
...
llvm-svn: 68898
2009-04-12 08:47:09 +00:00
Chris Lattner
98b30412ab
merge protocol-test-1.m -> protocol-test-2.m
...
llvm-svn: 68897
2009-04-12 08:46:44 +00:00
Chris Lattner
7a9c6d2973
Merge forward-circular into protocol-test-2
...
llvm-svn: 68896
2009-04-12 08:45:55 +00:00
Chris Lattner
10644fac2f
this test is subsumed by protocol-test-2.m
...
llvm-svn: 68895
2009-04-12 08:44:47 +00:00
Chris Lattner
dac168d2a6
Fix rdar://6771034: don't warn on use of forward declared protocol in protocol
...
list of another protocol definition. This warning is very noisy and GCC doesn't
produce it so existing code doesn't expect it.
llvm-svn: 68894
2009-04-12 08:43:13 +00:00
Chris Lattner
1c7b885f5f
fix typo in test name.
...
llvm-svn: 68893
2009-04-12 08:37:16 +00:00
Chris Lattner
261b6a5c3a
call objc interfaces just "interfaces" in diagnostics, not "Objective-C types"
...
or "Objective-C interface types" etc.
llvm-svn: 68892
2009-04-12 08:25:48 +00:00
Chris Lattner
a8a7d0f371
implement rdar://6780761, making sema reject some code that otherwise
...
crashes codegen.
llvm-svn: 68891
2009-04-12 08:11:20 +00:00
Chris Lattner
cac63f359e
Implement support for GCC's -dD mode, which dumps -E output *and*
...
macro definitions.
llvm-svn: 68884
2009-04-12 01:56:53 +00:00
Chris Lattner
928e9096cb
add a ppcallback hook for macro definitions.
...
llvm-svn: 68883
2009-04-12 01:39:54 +00:00
Chris Lattner
c523d8e88c
now that we have an identifier table in the PCH file, finish hooking up
...
macro deserialization. We now correctly install II's in tokens, handle
function-like macros, etc.
llvm-svn: 68882
2009-04-11 21:15:38 +00:00
Chris Lattner
28d198177f
test this in non-pch mode as well as in pch mode.
...
llvm-svn: 68881
2009-04-11 20:52:19 +00:00
Chris Lattner
5300accc7a
improve location info for property stuff. In a property like this:
...
@property int x;
associate the location of X with the property decl, not the location
of the @. Also, pass this info along to the synthesized ParmVarDecls
so that redefinition and other diagnostics can use it. This eliminates
a fixme.
llvm-svn: 68880
2009-04-11 20:14:49 +00:00
Chris Lattner
67f35b051b
improve the 'conflicting types' diagnostics to include correct location info, now
...
that it is plumbed through Sema. On a file from growl, we used to emit:
t.mi:107059:1: warning: conflicting types for 'removePluginHandler:forPluginTypes:'
- (void) removePluginHandler:(id <GrowlPluginHandler>)handler forPluginTypes:(NSSet *)extensions {
^
t.mi:105280:1: note: previous definition is here
- (void) removePluginHandler:(id <NSObject>)handler forPluginTypes:(NSSet *)types;
^
now we produce:
t.mi:107059:55: warning: conflicting parameter types in implementation of 'removePluginHandler:forPluginTypes:': 'id<NSObject>' vs 'id<GrowlPluginHandler>'
- (void) removePluginHandler:(id <GrowlPluginHandler>)handler forPluginTypes:(NSSet *)extensions {
^
t.mi:105280:45: note: previous definition is here
- (void) removePluginHandler:(id <NSObject>)handler forPluginTypes:(NSSet *)types;
^
We still don't have proper loc info for properties, hence the FIXME.
rdar://6782494
llvm-svn: 68879
2009-04-11 19:58:42 +00:00