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