Anders Carlsson
510d22d097
Simplify the vcall offset calculation and make it give the correct answers :) My test case now has the right values but in the wrong order.
...
llvm-svn: 96877
2010-02-23 03:14:49 +00:00
Anders Carlsson
30f5301e54
More work on vcall offsets. We now emit the right number of vcall offsets in my local test case, but not the right values.
...
llvm-svn: 96874
2010-02-23 02:47:31 +00:00
Ted Kremenek
7296de9ae3
Start moving some of the logic for the unreachable code analysis out of libSema
...
and into libAnalysis.
llvm-svn: 96872
2010-02-23 02:39:16 +00:00
Ted Kremenek
e10ba52be9
Convert use of std::queue to llvm::SmallVector and fix buildbot.
...
llvm-svn: 96855
2010-02-23 01:39:04 +00:00
Anders Carlsson
075056a8f9
Move BaseOffset out of the FinalOverriders class.
...
llvm-svn: 96853
2010-02-23 01:34:28 +00:00
Fariborz Jahanian
afe1386ed9
More support for ivars in class extension.
...
llvm-svn: 96850
2010-02-23 01:26:30 +00:00
Ted Kremenek
ca4be0c10e
Use SmallVectorImpl::iterator.
...
llvm-svn: 96848
2010-02-23 01:19:17 +00:00
Ted Kremenek
bab459eaf4
Simplify logic for determining values of 'ReturnsVoid' and 'HasNoReturn' flags.
...
No functionality change.
llvm-svn: 96847
2010-02-23 01:19:11 +00:00
John McCall
f8ff7b9fd1
Perform two more constructor/destructor code-size optimizations:
...
1) emit base destructors as aliases to their unique base class destructors
under some careful conditions. This is enabled for the same targets that can
support complete-to-base aliases, i.e. not darwin.
2) Emit non-variadic complete constructors for classes with no virtual bases
as calls to the base constructor. This is enabled on all targets and in
theory can trigger in situations that the alias optimization can't (mostly
involving virtual bases, mostly not yet supported).
These are bundled together because I didn't think it worthwhile to split them,
not because they really need to be.
llvm-svn: 96842
2010-02-23 00:48:20 +00:00
Douglas Gregor
46841e1bd9
Implement crazy destructor name lookup semantics differently in
...
C++98/03 and C++0x, since the '0x semantics break valid C++98/03
code. This new mess is tracked by core issue 399, which is still
unresolved.
Fixes PR6358 and PR6359.
llvm-svn: 96836
2010-02-23 00:15:22 +00:00
Fariborz Jahanian
4c172c63e5
Early support for declaring ivars in class extensions. wip.
...
llvm-svn: 96819
2010-02-22 23:04:20 +00:00
Fariborz Jahanian
b8f018d1e9
Fixes a rewriting of byref variable when its initializer is
...
itself rewritten. Radar 7669784.
llvm-svn: 96798
2010-02-22 20:48:10 +00:00
Douglas Gregor
2b76dd9a9e
Don't assert that we have a valid access specifier on an invalid
...
declaration. This is the trivial part of PR6365.
llvm-svn: 96792
2010-02-22 17:53:38 +00:00
Douglas Gregor
dd4831794b
Set access specifiers on imported declarations.
...
llvm-svn: 96788
2010-02-22 17:42:47 +00:00
Douglas Gregor
d28f0412e4
Do not require a complete type when checking for a pointer conversion
...
between cv1 T* and cv2 T*.
llvm-svn: 96787
2010-02-22 17:06:41 +00:00
Douglas Gregor
f4f2e0247f
Change the name of the vtable-debugging environment variable to
...
CLANG_VTABLE_DEBUG.
llvm-svn: 96785
2010-02-22 16:48:26 +00:00
Douglas Gregor
76eb74a1cd
Don't use NamedDecl::getNameAsCString() when dealing with C++ methods,
...
since they may not have normal identifiers for names. Fixes PR6369.
llvm-svn: 96784
2010-02-22 16:44:27 +00:00
Daniel Dunbar
260918ce5c
Revert "Simplify code: Succ is guaranteed to be not NULL.", which turns out to
...
not be guaranteed.
llvm-svn: 96782
2010-02-22 05:58:59 +00:00
Zhongxing Xu
d39620c451
Simplify code: Succ is guaranteed to be not NULL.
...
llvm-svn: 96772
2010-02-22 02:59:27 +00:00
Chris Lattner
dd1cb5b2ec
Add 'previous declaration is here' note for param redefinition
...
errors, e.g.:
t.c:1:21: error: redefinition of parameter 'x'
int test(int x, int x);
^
t.c:1:14: note: previous declaration is here
int test(int x, int x);
^
llvm-svn: 96769
2010-02-22 00:40:25 +00:00
Douglas Gregor
36c569fb33
Eliminate the default arguments to ASTContext::getFunctionType(),
...
fixing up a few callers that thought they were propagating NoReturn
information but were in fact saying something about exception
specifications.
llvm-svn: 96766
2010-02-21 22:15:06 +00:00
Douglas Gregor
90d554ecb3
Implement support for parsing pseudo-destructor expression with a nested-name-specifier, e.g.,
...
typedef int Int;
int *p;
p->Int::~Int();
This weakens the invariant that the only types in nested-name-specifiers are tag types (restricted to class types in C++98/03). However, we weaken this invariant as little as possible, accepting arbitrary types in nested-name-specifiers only when we're in a member access expression that looks like a pseudo-destructor expression.
llvm-svn: 96743
2010-02-21 18:36:56 +00:00
Douglas Gregor
901e717f92
A constructor template cannot be used to copy to an object of the same class type (per C++ [class.copy]p3). Make sure that includes copies that involve a derived-to-base conversion. Fixes PR6141.
...
llvm-svn: 96742
2010-02-21 18:30:38 +00:00
Douglas Gregor
00eace1958
Implement AST import for C++ member functions, including constructors, destructors, and conversions. Unfortunately, this cannot be tested yet, since we don't have C++ PCH support.
...
llvm-svn: 96741
2010-02-21 18:29:16 +00:00
Douglas Gregor
f18a2c7dd1
Implement AST importing for C++ namespaces.
...
llvm-svn: 96740
2010-02-21 18:26:36 +00:00
Douglas Gregor
968d633176
Collect the code that imports all of the members of a declaration context into a single function, ImportDeclContext. Use it rather than explicit loops. No functionality change.
...
llvm-svn: 96739
2010-02-21 18:24:45 +00:00
Douglas Gregor
e31bbd904d
Implement PCH support for C++ namespaces.
...
llvm-svn: 96738
2010-02-21 18:22:14 +00:00
Chandler Carruth
8f2548112e
Commiting a revert from dgregor of a bit of destructor logic until we can
...
figure out how not to break lots of code using this. See PR6358 and PR6359 for
motivating examples. FIXME's left in the code and the test.
llvm-svn: 96733
2010-02-21 10:19:54 +00:00
Chandler Carruth
f50ef6ed9a
Make Decl::isOutOfLine() virtual, and use that to determine when definitions
...
are for out of line declarations more easily. This simplifies the logic and
handles the case of out-of-line class definitions correctly. Fixes PR6107.
llvm-svn: 96729
2010-02-21 07:08:09 +00:00
Ted Kremenek
2fb89539f7
Clang really intends to reject attribute 'warn_unused_result' on Objective-C methods, but
...
instead it crashes on them. We might extend this attribute to work on methods, but for
now fix the crasher. Addresses <rdar://problem/7670939>.
llvm-svn: 96723
2010-02-21 05:15:32 +00:00
Ted Kremenek
1979007ca8
Don't emit a warning about a dllimport attribute being used in a typedef
...
when -fms-extensions is specified. Fixes <rdar://problem/7653870>.
llvm-svn: 96722
2010-02-21 05:12:56 +00:00
Ted Kremenek
a3cfc4d1e1
Don't warn about functions redeclared without the dllimport attribute when
...
-fms-extensions is enabled. Fixes <rdar://problem/7669559>.
llvm-svn: 96721
2010-02-21 05:12:53 +00:00
Fariborz Jahanian
34e3cef483
Start supporting declaration of ivars in @implementation
...
blocks. WIP.
llvm-svn: 96696
2010-02-19 20:58:54 +00:00
Anders Carlsson
350b56eed5
Add the CK_UnusedFunctionPointer component kind for unused function pointers.
...
llvm-svn: 96695
2010-02-19 20:08:13 +00:00
Fariborz Jahanian
c5d61df0a9
Issue extended diagnostic when property dot-syntax is used and
...
there is a setter but no getter (part of radar 7664555).
llvm-svn: 96687
2010-02-19 18:30:30 +00:00
Douglas Gregor
0286b46702
Only parse C++0x attribute specifiers in declarators when in C++0x
...
mode. This allows us to detect invalid VLAs in Objective-C++
mode. This should be the last of <rdar://problem/7660386>.
llvm-svn: 96679
2010-02-19 16:47:56 +00:00
Douglas Gregor
337caf9e3e
Implement C++ name lookup for instance variables of Objective-C classes
...
from an instance method. Previously, we were following the Objective-C
name lookup rules for ivars, which are of course completely different
from and incompatible with the Objective-C++ rules.
For the record, the Objective-C++ rules are the sane ones.
This is another part of <rdar://problem/7660386>.
llvm-svn: 96677
2010-02-19 16:08:35 +00:00
Douglas Gregor
cfd70242ca
Make Sema::ActOnClassMessage robust when name lookup for the receiver
...
name finds something other than a TypedefDecl or an
ObjCInterfaceDecl. This is a small part of <rdar://problem/7660386>.
llvm-svn: 96676
2010-02-19 15:18:45 +00:00
John McCall
b81884d347
More refactoring around constructor/destructor code generation.
...
Fix some bugs with function-try-blocks and simplify normal try-block
code generation.
This implementation excludes a deleting destructor's call to
operator delete() from the function-try-block, which I believe
is correct but which I can't find straightforward support for at
a moment's glance.
llvm-svn: 96670
2010-02-19 09:25:03 +00:00
Anders Carlsson
2d3d903872
Dump this-adjustments for destructors as well.
...
llvm-svn: 96660
2010-02-19 06:03:53 +00:00
John McCall
8517abc30d
Enable -mconstructor-aliases by default on non-darwin platforms.
...
The linker bug holding this back is Darwin-specific.
llvm-svn: 96655
2010-02-19 02:45:38 +00:00
Ted Kremenek
013041eef0
Revert: "Change InitListExpr to allocate the array for holding references"
...
This was causing buildbot breakage.
This reverts commit d46e952cc8cb8d9eed8657d9a0b267910a0f745a.
llvm-svn: 96652
2010-02-19 01:50:18 +00:00
Douglas Gregor
01cc437159
Add a missing break. Cocoa.h can now be merged twice into the same AST context
...
llvm-svn: 96650
2010-02-19 01:36:36 +00:00
John McCall
d4324148d7
Re-introduce the ctor/dtor alias optimization, this time hidden behind a
...
command-line option which defaults off.
llvm-svn: 96649
2010-02-19 01:32:20 +00:00
Douglas Gregor
5481d329a3
AST import for CStyleCastExpr. With this, we can import Cocoa.h into an empty context
...
llvm-svn: 96648
2010-02-19 01:32:14 +00:00
Douglas Gregor
d8552cdc96
AST import for sizeof and alignof expressions
...
llvm-svn: 96647
2010-02-19 01:24:23 +00:00
Douglas Gregor
52f820ead4
AST import for DeclRefExprs
...
llvm-svn: 96646
2010-02-19 01:17:02 +00:00
Douglas Gregor
c74247eddd
AST import of parenthesized expressions, unary operators, binary
...
operators, and compound assignment operators.
llvm-svn: 96643
2010-02-19 01:07:06 +00:00
Ted Kremenek
445a603c78
Change InitListExpr to allocate the array for holding references
...
to initializer expressions in an array allocated using ASTContext.
This plugs a memory leak when ASTContext uses a BumpPtrAllocator to
allocate memory for AST nodes.
In my mind this isn't an ideal solution; it would be nice to have
a general "vector"-like class that allocates memory using ASTContext,
but whose guts could be separated from the methods of InitListExpr
itself. I haven't gone and taken this approach yet because it isn't
clear yet if we'll eventually want an alternate solution for recylcing
memory using by InitListExprs as we are constructing the ASTs.
llvm-svn: 96642
2010-02-19 00:42:33 +00:00
Douglas Gregor
70127c1dcf
Use a little binary header in serialized diagnostics to help the deserializer skip over noise in the stream
...
llvm-svn: 96641
2010-02-19 00:40:40 +00:00
Fariborz Jahanian
aef662206b
Patch removes IVars list from ObjCInterfaceDecl and
...
instead relies on their DeclContext for iteration, etc.
llvm-svn: 96638
2010-02-19 00:31:17 +00:00
Blaine Garst
5421a83e4a
remove unused function & enumerations
...
llvm-svn: 96635
2010-02-19 00:24:37 +00:00
Douglas Gregor
6cb5ba4c4f
Teach ASTUnit to keep track of temporary files, then delete them when
...
the ASTUnit itself is destroyed. Fixes <rdar://problem/7649385>.
llvm-svn: 96628
2010-02-18 23:35:40 +00:00
Douglas Gregor
1e21cc7d19
Re-apply my diagnostics-capture patch for CIndex, with some tweaks to
...
try to address the msvc failures.
llvm-svn: 96624
2010-02-18 23:07:20 +00:00
Ted Kremenek
66f2d6ba7b
Allow GNU attributes to appear in an Objective-C method declaration
...
before the selector name (but after the return type). Among other things,
this allows IBAction to be implemented with an attribute.
llvm-svn: 96623
2010-02-18 23:05:16 +00:00
John McCall
334ce7c1c4
Revert the ctor/dtor alias optimization for now; the buildbots can detect
...
some failure here that I can't.
llvm-svn: 96612
2010-02-18 21:31:48 +00:00
Fariborz Jahanian
ffcfecdc1f
Fixed a crash specific to blocks in c++ uncovered by an internal
...
test suite.
llvm-svn: 96608
2010-02-18 20:31:02 +00:00
John McCall
5c60a6f597
Make deleting and complete dtor variants defer to other dtor variants by
...
calling them as subroutines. This triggers whenever the alias optimization
doesn't, i.e. when the dtor has linkonce linkage or there are virtual bases
or it's the deleting dtor.
llvm-svn: 96605
2010-02-18 19:59:28 +00:00
Anders Carlsson
f8b53536ed
Attempt to fix the 32-bit test failures.
...
llvm-svn: 96595
2010-02-18 18:20:49 +00:00
Douglas Gregor
33cdd81064
Rework how CIndex handles diagnostics. Rather than using a callback,
...
we attach diagnostics to translation units and code-completion
results, so they can be queried at any time.
To facilitate this, the new StoredDiagnostic class stores a diagnostic
in a serializable/deserializable form, and ASTUnit knows how to
capture diagnostics in this stored form. CIndex's CXDiagnostic is a
thin wrapper around StoredDiagnostic, providing a C interface to
stored or de-serialized diagnostics.
I've XFAIL'd one test case temporarily, because currently we end up
storing diagnostics in an ASTUnit that's never returned to the user
(because it contains errors). I'll introduce a temporary fix for this
soon; the real fix will be to allow us to return and query invalid ASTs.
llvm-svn: 96592
2010-02-18 18:08:43 +00:00
Anders Carlsson
e5faca7cda
Fix another bug and add another class.
...
llvm-svn: 96590
2010-02-18 17:32:33 +00:00
Anders Carlsson
8847d9e40a
More work on vcall offsets.
...
llvm-svn: 96587
2010-02-18 17:26:40 +00:00
Anders Carlsson
78277c7705
Start stubbing out vcall offset handling.
...
llvm-svn: 96585
2010-02-18 17:00:09 +00:00
Anders Carlsson
5a7654a9d8
Store the base offset of the final overrider in the OverriderInfo struct, to be used for vcall offsets.
...
llvm-svn: 96582
2010-02-18 16:29:24 +00:00
Anders Carlsson
c8316a2e08
Remove some dead code.
...
llvm-svn: 96581
2010-02-18 16:24:20 +00:00
Benjamin Kramer
26d19c59f8
Try to fix the auroraux buildbot. I suspect it has a "#define SEC" somewhere.
...
llvm-svn: 96577
2010-02-18 13:02:13 +00:00
Charles Davis
9fcead75ee
Also don't warn about force_align_arg_pointer on function typedefs. (This will
...
break if you declare an actual function using that typedef. Come to think of it,
maybe I should make this part of the type.)
llvm-svn: 96570
2010-02-18 04:56:59 +00:00
Charles Davis
cb9572e7b3
Two fixes related to force_align_arg_pointer:
...
- Also recognize __force_align_arg_pointer__.
- Don't warn if it's used on a function pointer typedef.
llvm-svn: 96568
2010-02-18 04:39:19 +00:00
Douglas Gregor
44272ca356
Add some spacing in the code-completion results for a return statement
...
llvm-svn: 96567
2010-02-18 04:06:48 +00:00
John McCall
89b12b34f6
Extract out function-body code generation into its own method. No functionality
...
change.
llvm-svn: 96564
2010-02-18 03:17:58 +00:00
Ted Kremenek
1f672829fb
Change the behavior of ibaction attributes to be attached to methods, not ivars.
...
llvm-svn: 96562
2010-02-18 03:08:58 +00:00
Douglas Gregor
623421d385
AST import for character literals
...
llvm-svn: 96557
2010-02-18 02:21:22 +00:00
Douglas Gregor
8661a72b48
AST import for forward declarations of Objective-C protocols
...
llvm-svn: 96555
2010-02-18 02:12:22 +00:00
Douglas Gregor
06537af873
Implement import of forward declarations of Objective-C classes
...
llvm-svn: 96554
2010-02-18 02:04:09 +00:00
Charles Davis
fea4845609
Allow redefinitions of extern inline functions in GNU89 mode, just as GCC
...
does. Fixes PR5253.
llvm-svn: 96553
2010-02-18 02:00:42 +00:00
Douglas Gregor
84c51c3581
AST import of Objective-C categories.
...
llvm-svn: 96551
2010-02-18 01:47:50 +00:00
Fariborz Jahanian
f50679151b
__typeof should be able to handle block pointer types when
...
rewriting. Fixes radar 7659483.
llvm-svn: 96549
2010-02-18 01:20:22 +00:00
Douglas Gregor
e5ad57a3ed
Don't diagnose overflow in case statements when the conversion is a
...
signed<->unsigned conversion with the same bit width. Fixes
<rdar://problem/7658121>.
llvm-svn: 96545
2010-02-18 00:56:01 +00:00
Ted Kremenek
1fcc56c57a
Recognize attributes ns_returns_not_retained and cf_returns_not_retained
...
in the static analyzer.
llvm-svn: 96539
2010-02-18 00:06:12 +00:00
Ted Kremenek
f2b64ba858
Add __has_feature support for attributes ns_returns_not_retained
...
and cf_returns_not_retained.
llvm-svn: 96538
2010-02-18 00:06:04 +00:00
Ted Kremenek
2b36f3f666
Sort @includes.
...
llvm-svn: 96537
2010-02-18 00:05:58 +00:00
Ted Kremenek
79478e3ef8
Sort cases.
...
llvm-svn: 96536
2010-02-18 00:05:52 +00:00
Ted Kremenek
d9c6663124
Add 'ns_returns_not_retained' and 'cf_returns_not_retained' attributes to
...
match 'ns_returns_retained' and 'cf_returns_retained' respectively. These
are not yet hooked up to the static analyzer.
llvm-svn: 96535
2010-02-18 00:05:45 +00:00
Douglas Gregor
12ea0f4ef9
For -Wswitch-enum warnings, be sure to look through typedefs of enum
...
types. Fixes <rdar://problem/7643909>.
llvm-svn: 96531
2010-02-17 23:29:11 +00:00
Douglas Gregor
c0b8c81a07
When diagnosing enumerator values outside of the range of 'int', be
...
sure that we get the "too large" vs. "too small" part of the
diagnostic correct.
llvm-svn: 96524
2010-02-17 22:40:11 +00:00
Chris Lattner
d2408f78a5
silence warning in a cleaner way
...
llvm-svn: 96520
2010-02-17 21:42:34 +00:00
Douglas Gregor
8b228d7a51
Implement AST importing of ImplicitParamDecls, despite the sad fact
...
that we can't test it yet.
llvm-svn: 96516
2010-02-17 21:22:52 +00:00
Daniel Dunbar
0ac9445098
PR5803: clang++: Treat untyped 'C' inputs as C++.
...
- Patch by Andrzej K. Haczewski, with a tweak by me to emit a 'deprecated'
diagnostic when we do this. We'll see what zee users say.
llvm-svn: 96511
2010-02-17 20:32:58 +00:00
Fariborz Jahanian
999ddbcf8e
Patch to remove arbitrary imporation of 'self' into
...
a block without it being used. This causes over release
of objects in certain runtime-senitive apps.
(fixes radar 7581175).
llvm-svn: 96501
2010-02-17 19:54:08 +00:00
Fariborz Jahanian
586ca163b4
Did not intend to check this in.
...
llvm-svn: 96486
2010-02-17 18:11:55 +00:00
Fariborz Jahanian
c0309cd3d1
Use proper lexcial context for newly added ivars.
...
llvm-svn: 96484
2010-02-17 18:10:54 +00:00
Douglas Gregor
a11c45866e
Implement AST merging for Objective-C properties.
...
llvm-svn: 96483
2010-02-17 18:02:10 +00:00
Anders Carlsson
231461f88f
Make FinalOverriders handle virtual bases correctly. Unfortunately this can't be tested just yet.
...
llvm-svn: 96481
2010-02-17 17:48:25 +00:00
Fariborz Jahanian
20912d644a
Allow for declaration and use of ivars in a stand-alone
...
implementation (toward radar 7547942).
llvm-svn: 96479
2010-02-17 17:00:07 +00:00
Douglas Gregor
98d156a87e
AST import for Objective-C protocols
...
llvm-svn: 96478
2010-02-17 16:12:00 +00:00
Zhongxing Xu
b2ef2f1427
In symbol reaper, a variable is live if its stack frame is the parent of the
...
current stack frame.
When leaving a callee, remove all bindings belonging to that callee.
llvm-svn: 96473
2010-02-17 08:50:05 +00:00
Zhongxing Xu
daf4616455
For inline-based inter-procedural analysis, we will have multiple stack space regions. Use a dense map to store them.
...
llvm-svn: 96472
2010-02-17 08:46:50 +00:00
Zhongxing Xu
86bab2cddd
Add a utility method.
...
llvm-svn: 96471
2010-02-17 08:45:06 +00:00
Daniel Dunbar
4b8ef28400
Driver: Tweak freebsd::Link, by Roman Divacky.
...
llvm-svn: 96469
2010-02-17 08:07:51 +00:00
Anders Carlsson
d2fd302726
Handle primary bases in AddVCallOffsets.
...
llvm-svn: 96461
2010-02-17 06:30:02 +00:00
Chandler Carruth
c20a9586c4
Silence GCC warning by marking an assert-only variable as unused.
...
llvm-svn: 96459
2010-02-17 06:24:18 +00:00
Anders Carlsson
b0a588f038
First cut at emitting vcall offsets.
...
llvm-svn: 96455
2010-02-17 06:07:19 +00:00
Tanya Lattner
339c89bce2
Do not add functions marked with the unused attribute to the list of unused functions to warn about. Update test case.
...
llvm-svn: 96452
2010-02-17 04:48:01 +00:00
John McCall
67cea74745
Emit complete constructors and destructors as aliases to base constructors
...
and destructors when the two entities are semantically identical, i.e. when
the class has no virtual base classes. We only do this for linkage types
for which aliases are supported, i.e. internal and external, i.e. not linkonce.
llvm-svn: 96451
2010-02-17 03:52:49 +00:00
Anders Carlsson
db042200c0
Pass through whether a base is virtual or not.
...
llvm-svn: 96449
2010-02-17 03:11:55 +00:00
Ted Kremenek
06be968942
Add IBAction attribute to keep the IBOutlet attribute company.
...
llvm-svn: 96447
2010-02-17 02:37:45 +00:00
Sanjiv Gupta
ba1e267a4c
implement EmitVAArg. pretty much the same way other targets do.
...
llvm-svn: 96446
2010-02-17 02:25:52 +00:00
Tanya Lattner
8aefcbed49
Fix unused function warning to handle used attributes and redeclarations. Update test case.
...
llvm-svn: 96444
2010-02-17 02:17:21 +00:00
Douglas Gregor
43f54796ab
Implement AST importing and checking for Objective-C method declarations.
...
llvm-svn: 96442
2010-02-17 02:12:47 +00:00
Anders Carlsson
03db9e9cd3
Correctly calculate base offsets for 'this' pointer adjustments involving virtual bases. This can't be tested yet due to lack of vcall offsets :)
...
llvm-svn: 96441
2010-02-17 02:05:23 +00:00
Charles Davis
61170a19e3
Revert r95939, as suggested by Alexandre Julliard from the Wine project (and
...
our own Chris Lattner).
llvm-svn: 96431
2010-02-17 00:44:47 +00:00
Douglas Gregor
7244b0bb86
Implement AST importing of Objective-C instance variables.
...
Check superclasses when merging two Objective-C @interfaces.
llvm-svn: 96420
2010-02-17 00:34:30 +00:00
John McCall
347132b32f
IRgen optimization: cache the value of 'this' and 'vtt' instead of
...
repeatedly reloading from an alloca. We still need to create the alloca
for debug info purposes (although we currently create it in all cases
because of some abstraction boundaries that're hard to break down).
llvm-svn: 96403
2010-02-16 22:04:33 +00:00
Devang Patel
7585580ccc
Distinguish two lexical blocks at the same level.
...
llvm-svn: 96397
2010-02-16 21:41:20 +00:00
Douglas Gregor
b154fdc974
Introduce a new kind of failed result for isLvalue/isModifiableLvalue
...
which describes temporary objects of class type in C++. Use this to
provide a more-specific, remappable diagnostic when takin the address
of such a temporary.
llvm-svn: 96396
2010-02-16 21:39:57 +00:00
Daniel Dunbar
fd09df7839
IRgen: Switch 'retval' to use CreateIRTemp.
...
llvm-svn: 96376
2010-02-16 19:45:20 +00:00
Daniel Dunbar
d004918ccb
IRgen: Add CreateIRTemp, which creates a temporary alloca but with type converted "not-for-memory". Dunno a better name.
...
llvm-svn: 96374
2010-02-16 19:44:13 +00:00
Daniel Dunbar
27bacafb71
IRgen: Switch EmitCompoundLiteralLValue to use CreateMemTemp.
...
llvm-svn: 96373
2010-02-16 19:43:39 +00:00
Douglas Gregor
71ad477ab3
Do not try to instantiate invalid declarations. It's a recipe for
...
disaster. Fixes PR6161.
llvm-svn: 96371
2010-02-16 19:28:15 +00:00
Douglas Gregor
fe17d2550b
Improve parsing and instantiation of destructor names, so that we can
...
now cope with the destruction of types named as dependent templates,
e.g.,
y->template Y<T>::~Y()
Nominally, we implement C++0x [basic.lookup.qual]p6. However, we don't
follow the letter of the standard here because that would fail to
parse
template<typename T, typename U>
X0<T, U>::~X0() { }
properly. The problem is captured in core issue 339, which gives some
(but not enough!) guidance. I expect to revisit this code when the
resolution of 339 is clear, and/or we start capturing better source
information for DeclarationNames.
Fixes PR6152.
llvm-svn: 96367
2010-02-16 19:09:40 +00:00
Chris Lattner
fff5ed4b55
when a diagnostic is an extension and has no other -W flag,
...
indicate that it was enabled with -pedantic so people know
why they're getting them:
$ printf "int x;" | clang -xc - -pedantic
<stdin>:1:7: warning: no newline at end of file [-pedantic]
int x;
^
llvm-svn: 96365
2010-02-16 18:29:31 +00:00
Charles Davis
163855f46d
dllimport and dllexport are declspec attributes, too. They're also
...
Win32-specific.
Also, fix a test to use FileCheck instead of grepping LLVM IR.
llvm-svn: 96364
2010-02-16 18:27:26 +00:00
Chris Lattner
e983eae273
add two aliases for SSE functions we already have, fixing PR6316.
...
llvm-svn: 96363
2010-02-16 18:21:25 +00:00
Chris Lattner
db5c16bc9c
add freebsd/ppc[64] support, patch by Nathan Whitehorn, PR6318
...
llvm-svn: 96362
2010-02-16 18:14:57 +00:00
Fariborz Jahanian
b6a68c0465
Minor rewriter cleanup and a test for a block rewriting bug.
...
llvm-svn: 96361
2010-02-16 17:26:03 +00:00
Anders Carlsson
13f0f66223
Handle layout of vtables for virtual bases.
...
llvm-svn: 96355
2010-02-16 16:49:35 +00:00
Anders Carlsson
b716a543c9
Move some code around in preparation for virtual base vtables.
...
llvm-svn: 96354
2010-02-16 16:26:28 +00:00
Fariborz Jahanian
e1ff123214
Fix rewriter bug when function call inside block with block parameter
...
causes C++ compile error (radar 7651312).
llvm-svn: 96352
2010-02-16 16:21:26 +00:00
Anders Carlsson
14157939ab
Fix a bug where we would not emit secondary vtables for bases of a primary base.
...
llvm-svn: 96351
2010-02-16 16:02:57 +00:00
Benjamin Kramer
64aae50539
Rename argument so the name reflects what it's doing.
...
llvm-svn: 96342
2010-02-16 10:07:31 +00:00
Ted Kremenek
228639746a
Add simpler checker to check if variables captured by a block are uninitialized.
...
llvm-svn: 96341
2010-02-16 08:33:59 +00:00
John McCall
d8d0d43fa3
Support local namespace aliases and permit them to be instantiated.
...
llvm-svn: 96335
2010-02-16 06:53:13 +00:00
Anders Carlsson
77904f1d5b
Emit vbase offsets.
...
llvm-svn: 96329
2010-02-16 04:59:55 +00:00
Anders Carlsson
dc2dba306c
More work on the new layout code.
...
llvm-svn: 96328
2010-02-16 04:49:44 +00:00
John McCall
6ce747220a
When emitting complete destructors for classes with virtual bases, compute
...
the offset to the virtual bases statically inside of relying on the virtual
base offsets in the object's vtable(s). This is both more efficient and
sound against the destructor's manipulation of the vtables.
Also extract a few helper routines.
Oh and we seem to pass all tests with an optimized clang now.
llvm-svn: 96327
2010-02-16 04:15:37 +00:00
John McCall
1e3715acc3
White-list comma expressions with the literal 0 as their RHS against
...
unused-value warnings. This is a common macro idiom.
llvm-svn: 96326
2010-02-16 04:10:53 +00:00
John McCall
81e38507bd
Make the various type-decl Types (and their associated ASTContext routines)
...
accept const decls.
llvm-svn: 96325
2010-02-16 03:57:14 +00:00
Sanjiv Gupta
ecd2600c52
Re-applying 96173. Looks like finally I got the test case right.
...
llvm-svn: 96321
2010-02-16 03:37:11 +00:00
Daniel Dunbar
1951192213
ASTUnit: Constant fold UseBumpAllocator to true, we don't care to support this as an argument.
...
llvm-svn: 96316
2010-02-16 01:55:04 +00:00
Daniel Dunbar
7f21a7f7ce
ASTUnit::LoadFromCompilerInvocation - Take ownership of the provided invocation.
...
llvm-svn: 96315
2010-02-16 01:54:54 +00:00
Daniel Dunbar
e922d9bdf0
CompilerInstance: Move LLVMContext member out of constructor.
...
llvm-svn: 96314
2010-02-16 01:54:47 +00:00
Ted Kremenek
c8b188d541
Refactor the logic for printf argument type-checking into analyze_printf::ArgTypeResult.
...
Implement printf argument type checking for '%s'.
Fixes <rdar://problem/3065808>.
llvm-svn: 96310
2010-02-16 01:46:59 +00:00
Douglas Gregor
4563532043
Skeleton for importing Objective-C classes
...
llvm-svn: 96306
2010-02-16 01:20:57 +00:00
Douglas Gregor
9503c46a2e
Don't import __va_list_tag or __builtin_va_list when merging
...
llvm-svn: 96299
2010-02-16 00:04:46 +00:00
Douglas Gregor
b4964f7705
Cope with anonymous tags defined within declarators by structurally
...
comparing their types under the assumption that they are equivalent,
rather than importing the types and then checking for compatibility. A
few minor tweaks here:
- Teach structural matching to handle compatibility between
function types with prototypes and those without prototypes.
- Teach structural matching that an incomplete record decl is the
same as any other record decl with the same name.
- Keep track of pairs of declarations that we have already checked
(but failed to find as structurally matching), so we don't emit
diagnostics repeatedly.
- When importing a typedef of an anonymous tag, be sure to link the
imported tag type to its typedef.
With these changes, we survive a repeated import of <stdlib.h> and
<stdio.h>. Alas, the ASTNodeImporter is getting a little grotty.
llvm-svn: 96298
2010-02-15 23:54:17 +00:00
Ted Kremenek
d51217e968
Convert GRExprEngine's handling of ObjCMessageExprs to use a worklist
...
to evaluate arguments.
llvm-svn: 96293
2010-02-15 23:02:46 +00:00
Benjamin Kramer
634fc10fe1
Add Sema support for __builtin_fpclassify by extending the existing check for __builtin_isinf and friends. Part of PR6083.
...
llvm-svn: 96291
2010-02-15 22:42:31 +00:00
Fariborz Jahanian
8efe0ec899
Issue a bettter diagnostics for incorrect property setter name.
...
(radar 7647953).
llvm-svn: 96284
2010-02-15 22:20:11 +00:00
Chandler Carruth
3e0c140c50
Fix instantiation of template functions with local classes that contain virtual
...
methods.
llvm-svn: 96283
2010-02-15 22:12:26 +00:00
Douglas Gregor
522e22d352
Tell ASTMerge to merge every declaration it sees, rather than cherry-picking those declarations that we know will work.
...
llvm-svn: 96280
2010-02-15 22:05:17 +00:00
Douglas Gregor
3996e249ed
Reimplement the structural-equality checks used to determine whether
...
two types in different AST contexts are equivalent. Rather than
transforming the type from one context into the other context, we
perform a deep structural comparison of the types. This change
addresses a serious problem with recursive data types like
struct ListNode {
int value;
struct ListNode *Next;
} xList;
llvm-svn: 96278
2010-02-15 22:01:00 +00:00
Fariborz Jahanian
30a42923d3
Class continuation now has its own property ast for
...
those declared in it. This is to allow duplicate
property diagnostics for properties declared in class extensions
multiple times (radar 7629420) and for future use.
llvm-svn: 96276
2010-02-15 21:55:26 +00:00
Fariborz Jahanian
02d964babe
Fix a broken rewritin of @implementation keyword.
...
(fixes radar 7649577).
llvm-svn: 96270
2010-02-15 21:11:41 +00:00
John McCall
5f5cbf5d1d
Optimize the implementation of IdDeclInfo pooling in the IdentifierResolver.
...
llvm-svn: 96253
2010-02-15 19:38:00 +00:00
Devang Patel
e8814ce0a6
Use getLocStart(), instead of getLocEnd(), to record starting location of objc method. :)
...
llvm-svn: 96245
2010-02-15 18:08:38 +00:00
Sanjiv Gupta
9d23f93d52
reverting back 96242 as it still causes a test failure.
...
llvm-svn: 96244
2010-02-15 18:02:12 +00:00
Sanjiv Gupta
af56d377f1
Re-applying 96173 with corresponding changes in test.
...
llvm-svn: 96242
2010-02-15 17:19:13 +00:00
Duncan Sands
998f9d975b
Uniformize the names of type predicates: rather than having isFloatTy and
...
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!
llvm-svn: 96224
2010-02-15 16:14:01 +00:00
Chandler Carruth
284bb2ec72
Defer covariance checks for dependent types. Add test cases that also ensure
...
they are re-checked on instantiation.
llvm-svn: 96217
2010-02-15 11:53:20 +00:00
Zhongxing Xu
ec345b7ecb
Simplify code. If we can reach here, the base must be virtual.
...
llvm-svn: 96211
2010-02-15 04:28:35 +00:00
John McCall
7538eec67b
When emitting an aggregate into a temporary, make sure we set the alignment
...
on the alloca.
The fact that codegen makes this class of bug so wonderfully easy to make is
embarrassing.
llvm-svn: 96204
2010-02-15 01:23:36 +00:00
Ted Kremenek
4ba99bee2a
clang::Attr objects should be treated as AST nodes as well by
...
the LLVMConventionsChecker.
llvm-svn: 96202
2010-02-14 22:58:16 +00:00
Ted Kremenek
4853131459
Add LLVM conventions check that scans for AST elements (types, stmts, decls)
...
that allocate heap memory.
llvm-svn: 96184
2010-02-14 19:09:13 +00:00
Ted Kremenek
988805c81e
Change LLVMConventionsChecker to accept an entire translation unit instead
...
of operating on each code decl. This exposes two flaws in AnalysisConsumer
that should eventually be fixed:
(1) It is not possible to associate multiple "actions" with a single
command line argument. This will require the notion of an
"analysis" group, and possibly tablegen support. (although eventually
we want to support dynamically loading analyses as well)
(2) AnalysisConsumer may not actually be scanning the declarations in namespaces.
We'll experiment first in LLVMConventionsChecker before changing the
behavior in AnalysisConsumer.
llvm-svn: 96183
2010-02-14 19:09:05 +00:00
Ted Kremenek
39df94b00d
Rework translation unit actions to actually take an entire translation unit
...
as imput.
llvm-svn: 96182
2010-02-14 19:08:51 +00:00
Ted Kremenek
c968e5e9b9
For the StringRef check, also visit the children of DeclStmts.
...
llvm-svn: 96181
2010-02-14 19:08:43 +00:00
Ted Kremenek
4806a833a7
Place type-checking static methods at type of file (where they will congregate).
...
No functionality change.
llvm-svn: 96180
2010-02-14 19:08:36 +00:00
Chris Lattner
d0413848cc
temporarily revert 96173, it is causing test failures.
...
llvm-svn: 96176
2010-02-14 18:38:38 +00:00
Sanjiv Gupta
1ef8cdd29b
renamed pic16 specifiic macros.
...
llvm-svn: 96173
2010-02-14 18:20:18 +00:00
Anders Carlsson
033d48697f
Don't compute final overriders or build vtables for bases that don't need a vtable.
...
llvm-svn: 96171
2010-02-14 17:05:59 +00:00
Benjamin Kramer
88ab94e7a3
Pass StringRefs to InsertText/ReplaceText in RewriteObjC and remove a ton of unnecessary length arguments.
...
llvm-svn: 96164
2010-02-14 14:14:16 +00:00
Zhongxing Xu
be36ecbb60
Fix pr6293. If ptr is NULL, no operation is preformed.
...
llvm-svn: 96154
2010-02-14 06:49:48 +00:00
Ted Kremenek
184b3383bf
Add new static analyzer for checking LLVM coding conventions: -analyzer-check-llvm-conventions
...
Currently these checks are intended to be largely syntactical, but may get more
sophisticated over time.
As an initial foray into this brave new world, emit a static analyzer warning
when binding a temporary 'std::string' to an 'llvm::StringRef' where the
lifetime of the 'std::string' does not outlive the 'llvm::StringRef'.
llvm-svn: 96147
2010-02-14 02:45:18 +00:00
Ted Kremenek
eff72bb134
Two changes to AnalysisConsumer::HandleTopLevelSingleDecl():
...
(1) Since CXXMethodDecl subclasses FunctionDecl (and CXXDestructorDecl
and CXXConversion subclass CXXMethodDecl), refactor switch statement
to handle them all in one spot.
(2) Use 'DeclarationName::getAsString()' to handle all functions that
don't have simple identifiers (fixing a null dereference when scanning
for specific functions).
llvm-svn: 96146
2010-02-14 02:44:52 +00:00
John McCall
38200b081a
Improve the diagnostic given when referring to a tag type without a tag (in C)
...
or that's been hidden by a non-type (in C++).
The ideal C++ diagnostic here would note the hiding declaration, but this
is a good start.
llvm-svn: 96141
2010-02-14 01:03:10 +00:00
Anders Carlsson
073a0c88cc
Build fix.
...
llvm-svn: 96140
2010-02-14 00:44:19 +00:00
Anders Carlsson
6a7e6a4c3c
Baby steps towards teaching FinalOverriders about virtual bases.
...
llvm-svn: 96139
2010-02-14 00:37:35 +00:00
Anders Carlsson
1888b44988
Don't try to layout construction vtables for now.
...
llvm-svn: 96138
2010-02-14 00:22:59 +00:00
Anders Carlsson
258a1e35e8
Improve support for non-virtual 'this' pointer adjustments. With this, it should be possible to use the new vtable layout code for all class hierarchies that do not involve virtual bases.
...
llvm-svn: 96137
2010-02-14 00:16:19 +00:00
Anders Carlsson
d3adb0ced9
Add basic support for simple non-virtual 'this' pointer adjustments.
...
llvm-svn: 96136
2010-02-13 23:40:17 +00:00
Anders Carlsson
cce9ee8970
Add support for very simple non-virtual this adjustments in the FinalOverriders class.
...
llvm-svn: 96133
2010-02-13 23:17:31 +00:00
Anders Carlsson
c809cbdc3f
Cleanup; remove some duplicated code.
...
llvm-svn: 96131
2010-02-13 22:39:18 +00:00
Anders Carlsson
a678aa1e51
Assert if we encounter this adjustments.
...
llvm-svn: 96125
2010-02-13 22:23:31 +00:00
Anders Carlsson
e75aaa97b3
Start laying out secondary vtables.
...
llvm-svn: 96123
2010-02-13 22:05:23 +00:00
Anders Carlsson
3f9917de6e
Merge base offsets and dump them.
...
llvm-svn: 96121
2010-02-13 21:33:22 +00:00
Anders Carlsson
c1290adab7
Don't make return adjustments for pure virtual member functions.
...
llvm-svn: 96120
2010-02-13 21:16:54 +00:00
Anders Carlsson
cf5a882da1
Handle virtual bases in return adjustment types.
...
llvm-svn: 96119
2010-02-13 21:07:32 +00:00
Anders Carlsson
f3f67846c8
Handle virtual bases in ComputeBaseOffset.
...
llvm-svn: 96117
2010-02-13 20:41:15 +00:00
Daniel Dunbar
9ced542c8a
Add newline.
...
llvm-svn: 96116
2010-02-13 20:24:39 +00:00
Anders Carlsson
6a6cbfc55f
More work on covariant return types. We now handle non-virtual adjustments fine.
...
llvm-svn: 96114
2010-02-13 20:11:51 +00:00
Chris Lattner
ef538b52a3
add support for t Fedora 12 (February 2010), patch by
...
Dyachenko Dmitry. Our system is "not so elegant" here.
llvm-svn: 96111
2010-02-13 19:18:26 +00:00
Charles Davis
4ea31ab369
Emit the 'alignstack' LLVM function attribute when we encounter a function
...
marked 'force_align_arg_pointer'. Almost there; now all I need to do is finish
up the backend.
llvm-svn: 96100
2010-02-13 15:54:06 +00:00
Chandler Carruth
a932bbca75
Fix think-o, attributes can't come *within* the type of the variable.
...
llvm-svn: 96099
2010-02-13 10:42:55 +00:00
Chandler Carruth
94eab4ad04
Silence unused variable warning in a build without assertions.
...
llvm-svn: 96098
2010-02-13 10:38:52 +00:00
Chandler Carruth
6b4756a224
Skip implicit instantiation of templated variables where a more recent
...
redeclaration provides an explicit instantiation or is invalid.
llvm-svn: 96097
2010-02-13 10:17:50 +00:00
Benjamin Kramer
e047e11189
Remove dead {include, semicolon, variable}.
...
llvm-svn: 96087
2010-02-13 09:15:07 +00:00
Benjamin Kramer
02c673781d
Use a different name for this iterator. MSVC and clang++ didn't like "I" in the same scope twice.
...
llvm-svn: 96086
2010-02-13 09:11:28 +00:00
Chandler Carruth
dfe198b588
Silence a GCC warning about a possibly uninitialized variable. It's data flow
...
only flows so far it seems.
llvm-svn: 96085
2010-02-13 07:23:01 +00:00
Douglas Gregor
04922cbb46
Fix a fiendinshly fun little type-canonicalization bug, where we were
...
rebuilding a typename type terminating in a template-id (with
dependent template name, naturally) as a TypenameType when, because
its context could be fully resolved, we should have been building it
as a QualifiedNameType. Fixes PR6268.
llvm-svn: 96084
2010-02-13 06:05:33 +00:00
Douglas Gregor
af050cb73a
Permit the use of typedefs of class template specializations in
...
qualified declarator-ids. This patch is actually due to Cornelius;
fixes PR6179.
llvm-svn: 96082
2010-02-13 05:23:25 +00:00