John McCall
b86a6b830e
Allow pseudo-destructors to be called on qualified pointers. Patch by
...
Troy Straszheim!
llvm-svn: 105823
2010-06-11 17:36:40 +00:00
John McCall
dad856dba3
Provide an Objective C mangling for wchar_t. Patch by Nico Weber!
...
llvm-svn: 105818
2010-06-11 10:11:05 +00:00
John McCall
6d1116ac49
Conversions from Objective C object pointers to bool are "pointer conversions
...
to bool" in the sense of C++ [over.ics.rank]p4 bullet 1. I have decreed it.
llvm-svn: 105817
2010-06-11 10:04:22 +00:00
Jeffrey Yasskin
2b99c6fc4f
Add an option -fshow-overloads=best|all to limit the number of overload
...
candidates printed. We default to 'all'. At the moment, 'best' prints only
the first 4 overloads, but we'll improve that over time.
llvm-svn: 105815
2010-06-11 05:57:47 +00:00
Charles Davis
b6a5a0d9e1
When mangling for the Microsoft C++ ABI, mangle variables in the global
...
namespace, too.
llvm-svn: 105809
2010-06-11 04:25:47 +00:00
Tom Care
00554634db
Small fixes regarding printf fix suggestions.
...
- Added some handling of flags that become invalid when changing the conversion specifier.
- Changed fixit behavior to remove unnecessary length modifiers.
- Separated some tests out and added some comments.
modified:
lib/Analysis/PrintfFormatString.cpp
test/Sema/format-strings-fixit.c
llvm-svn: 105807
2010-06-11 04:22:02 +00:00
Charles Davis
9af2d4a614
Start implementing the Microsoft-style name mangler. Mangle simple names
...
(but not their types; that's later).
NOTE: Right now, variables in the global namespace don't get mangled, even
though they're supposed to be. This is because the default mangler
implements the shouldMangleDeclName() method that tells clang not to mangle
them. This will be fixed in a later patch.
llvm-svn: 105805
2010-06-11 03:07:32 +00:00
Daniel Dunbar
1d3c2fa9be
Driver: Also mark -F as RenderJoined, the linker doesn't like "-F FOO" either.
...
llvm-svn: 105789
2010-06-10 15:53:17 +00:00
Daniel Dunbar
ed8f06e860
tests: Update test for previous change.
...
llvm-svn: 105766
2010-06-09 23:24:59 +00:00
Daniel Dunbar
bfe71f2416
Driver: Change Option parsing to always create arguments referring to unaliased
...
options.
- This matches the intent of the .td files, and will simplify alias handling.
- PR7321.
llvm-svn: 105763
2010-06-09 22:44:34 +00:00
Sebastian Redl
c3eba8f547
Commit my WIP on constexpr support. This commit: an XFAILed test and treating constexpr as a top-level const.
...
llvm-svn: 105752
2010-06-09 21:19:43 +00:00
Daniel Dunbar
c656d3e111
Revert "Driver: Change Option parsing to always create arguments referring to
...
unaliased", this isn't quite right yet.
llvm-svn: 105747
2010-06-09 19:27:07 +00:00
Daniel Dunbar
aea0620b89
Driver: Change Option parsing to always create arguments referring to unaliased
...
options.
- This matches the intent of the .td files, and will simplify alias handling.
- PR7321.
llvm-svn: 105744
2010-06-09 19:19:01 +00:00
Zhongxing Xu
1225aacacf
Merge StackAddrLeakChecker and ReturnStackAddressChecker.
...
llvm-svn: 105687
2010-06-09 06:08:24 +00:00
Zhongxing Xu
4200be5e76
Directly compare the StackFrameContext. This greatly simplifies logic and
...
improves generality. Thanks Ted.
llvm-svn: 105686
2010-06-09 05:50:38 +00:00
Tom Care
b704270779
Added FixIt support to printf format string checking.
...
- Refactored LengthModifier to be a class.
- Added toString methods in all member classes of FormatSpecifier.
- FixIt suggestions keep user specified flags unless incorrect.
Limitations:
- The suggestions are not conversion specifier sensitive. For example, if we have a 'pad with zeroes' flag, and the correction is a string conversion specifier, we do not remove the flag. Clang will warn us on the next compilation.
A test/Sema/format-strings-fixit.c
M include/clang/Analysis/Analyses/PrintfFormatString.h
M lib/Analysis/PrintfFormatString.cpp
M lib/Sema/SemaChecking.cpp
llvm-svn: 105680
2010-06-09 04:11:11 +00:00
Douglas Gregor
1fc3d66da4
Tweak our handling of the notion of a standard conversion sequence
...
being a subsequence of another standard conversion sequence. Instead
of requiring exact type equality for the second conversion step,
require type *similarity*, which is type equality with cv-qualifiers
removed at all levels. This appears to match the behavior of EDG and
VC++ (albeit not GCC), and feels more intuitive. Big thanks to John
for the line of reasoning that supports this change: since
cv-qualifiers are orthogonal to the second conversion step, we should
ignore them in the type comparison.
llvm-svn: 105678
2010-06-09 03:53:18 +00:00
Anders Carlsson
13f7c7dd77
Fix test.
...
llvm-svn: 105668
2010-06-09 01:42:52 +00:00
Anders Carlsson
642da419a6
Try to fix buildbot tests.
...
llvm-svn: 105660
2010-06-08 23:10:20 +00:00
Anders Carlsson
044cab3325
Add test case.
...
llvm-svn: 105651
2010-06-08 22:48:02 +00:00
Douglas Gregor
6f2e095f06
When referring to a tag that was previously declared only as a friend,
...
build a new declaration for that tag type that will be visible for
future lookups of that tag.
llvm-svn: 105643
2010-06-08 21:27:36 +00:00
Douglas Gregor
ce21919bd6
A built-in overload candidate is consider a non-template function when
...
determining whether one overload candidate is better than
another. Fixes PR7319.
llvm-svn: 105642
2010-06-08 21:03:17 +00:00
Fariborz Jahanian
3b83618054
Block Code Gen. API. Call destructor on descriptior
...
entry previously constructed via copy constructor.
llvm-svn: 105641
2010-06-08 20:57:22 +00:00
Daniel Dunbar
e6c1daa8fd
Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
...
- This eliminates most dependencies on how Clang is installed relative to LLVM.
llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Douglas Gregor
ec170db73d
Warn about comparisons between arrays and improve self-comparison
...
warnings, from Troy Straszheim! Fixes PR6163.
llvm-svn: 105631
2010-06-08 19:50:34 +00:00
Anders Carlsson
446872069f
Correctly handle fields with virtual bases containing empty subobjects.
...
llvm-svn: 105628
2010-06-08 19:09:24 +00:00
Fariborz Jahanian
8e73928f52
Fixes a typo which prevented proper code gen. for
...
copy-in of c++ class objects into blocks.
llvm-svn: 105622
2010-06-08 17:52:11 +00:00
Douglas Gregor
4038cf4b57
Implement a warning when converting the literal 'false' to a
...
pointer. Original patch by Troy D. Straszheim; fixes PR7283.
llvm-svn: 105621
2010-06-08 17:35:15 +00:00
Anders Carlsson
248704c517
Correctly mangle static variables of anonymous struct/union type.
...
llvm-svn: 105606
2010-06-08 14:49:03 +00:00
Zhongxing Xu
87e7fc5dc2
Add a checker check if a global variable holds a local variable's address after
...
the function call is left where the local variable is declared.
llvm-svn: 105602
2010-06-08 10:00:00 +00:00
Rafael Espindola
2569885963
Add a test to the previous commit.
...
llvm-svn: 105596
2010-06-08 03:59:28 +00:00
Rafael Espindola
85dc7e0909
Add test for previous commit.
...
llvm-svn: 105594
2010-06-08 03:29:31 +00:00
Daniel Dunbar
24e52992c0
Driver: Support invoking Clang on .ll or .bc inputs.
...
- We actually pretend that we have two separate types for LLVM assembly/bitcode because we need to use the standard suffixes with LTO ('clang -O4 -c t.c' should generate 't.o').
It is now possible to do something like:
$ clang -emit-llvm -S t.c -o t.ll ... assorted other compile flags ...
$ clang -c t.ll -o t.o ... assorted other compile flags ...
and expect that the output will be almost* identical to:
$ clang -c t.c -o t.o ... assorted other compile flags ...
because all the target settings (default CPU, target features, etc.) will all be initialized properly by the driver/frontend.
*: This isn't perfect yet, because in practice we will end up running the optimization passes twice. It's possible to get something equivalent out with a well placed -mllvm -disable-llvm-optzns, but I'm still thinking about the cleanest way to solve this problem more generally.
llvm-svn: 105584
2010-06-07 23:28:45 +00:00
Daniel Dunbar
6f8362c6bf
Frontend: Add CodeGenAction support for handling LLVM IR.
...
- This magically enables using 'clang -cc1' as a replacement for most of 'llvm-as', 'llvm-dis', 'llc' and 'opt' functionality.
For example, 'llvm-as' is:
$ clang -cc1 -emit-llvm-bc FOO.ll -o FOO.bc
and 'llvm-dis' is:
$ clang -cc1 -emit-llvm FOO.bc -o -
and 'opt' is, e.g.:
$ clang -cc1 -emit-llvm -O3 -o FOO.opt.ll FOO.ll
and 'llc' is, e.g.:
$ clang -cc1 -S -o - FOO.ll
The nice thing about using the backend tools this way is that they are guaranteed to exactly match how the compiler generates code (for example, setting the same backend options).
llvm-svn: 105583
2010-06-07 23:27:59 +00:00
Fariborz Jahanian
be21aa34a0
When using property-dot assignment syntax to call a setter method,
...
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778
llvm-svn: 105560
2010-06-07 22:02:01 +00:00
Fariborz Jahanian
a2d7c34e93
Fixed a block regression caused by trying to use
...
an existing ir for load of a bock variable. This cannot be
done across basic blocks.
Fixes radar 8064140.
llvm-svn: 105549
2010-06-07 19:39:39 +00:00
Jordy Rose
3597b21f20
Catch free()s on non-regions and regions known to be not from malloc(), by checking the symbol type and memory space.
...
llvm-svn: 105547
2010-06-07 19:32:37 +00:00
Jeffrey Yasskin
caa710dfd2
PR7245: Make binding a reference to a temporary without a usable copy
...
constructor into an extension warning into the error that C++98 requires.
llvm-svn: 105529
2010-06-07 15:58:05 +00:00
Jeffrey Yasskin
2f96e9f5c9
Add an extension to avoid an error when a global template has the same name as
...
a member template, and you try to call the member template with an explicit
template argument. See PR7247
For example, this downgrades the error to a warning in:
template<typename T> struct set{};
struct Value {
template<typename T>
void set(T value) {
}
};
void foo() {
Value v;
v.set<double>(3.2); // Warning here.
}
llvm-svn: 105518
2010-06-05 01:39:57 +00:00
Rafael Espindola
e971b9a260
Correctly align large arrays in x86-64. This fixes PR5599.
...
llvm-svn: 105500
2010-06-04 23:15:27 +00:00
Anders Carlsson
76f513f862
When deciding whether reinterpret_cast casts away constness we need to look at array qualifiers. Fixes rdar://problem/8018292.
...
llvm-svn: 105494
2010-06-04 22:47:55 +00:00
John McCall
a3cecb628f
Add indexing support for the block and @property type location information
...
I just implemented.
llvm-svn: 105491
2010-06-04 22:33:30 +00:00
Fariborz Jahanian
ea882cd92e
Build AST for copy-construction of copied-in
...
class object in blocks and carry it to IRGen.
llvm-svn: 105487
2010-06-04 21:35:44 +00:00
John McCall
8e346702b6
Preserve more information from a block's original function declarator, if one
...
was given. Remove some unnecessary accounting from BlockScopeInfo. Handle
typedef'ed function types until such time as we decide not.
llvm-svn: 105478
2010-06-04 19:02:56 +00:00
Daniel Dunbar
7f3d95054b
Driver: Change -dwarf-debug-flags option to pass the original command line
...
arguments after translation, instead of the -cc1 level arguments.
llvm-svn: 105476
2010-06-04 18:47:06 +00:00
Daniel Dunbar
6beaf5110f
Driver/Darwin: Model dsymutil properly, as a separate action/tool kind which is
...
added as the last output step, instead of just hacking it into the link step.
- Among other things, this fixes dSYM generation when using multiple -arch options.
llvm-svn: 105475
2010-06-04 18:28:41 +00:00
Fariborz Jahanian
64176c2c97
For C++ copied in objects, use copy constructors in
...
setting up block's descriptor. This is on going work to
support c++ specific issues in setting up blocks
various APIs.
llvm-svn: 105469
2010-06-04 16:10:00 +00:00
Douglas Gregor
2e87ca218f
When checking for equality of template parameter lists, a template
...
type parameter pack is distinct from a template type parameter.
llvm-svn: 105464
2010-06-04 08:34:32 +00:00
Douglas Gregor
71b209dea6
Properly disambiguate between an elaborated-type-specifier and a
...
type-parameter within a template parameter list. Found by inspection.
llvm-svn: 105462
2010-06-04 07:30:15 +00:00
Jordy Rose
2e22268904
Assignments to reference variables shouldn't kill the variable.
...
llvm-svn: 105452
2010-06-04 01:14:56 +00:00
David Chisnall
b190a2c74a
Fixed Objective-C type encoding for bitfields for the GNU runtime to match the encoding used by GCC.
...
llvm-svn: 105451
2010-06-04 01:10:52 +00:00
Eli Friedman
986b6ae96a
Check the output of this test.
...
llvm-svn: 105434
2010-06-03 23:34:11 +00:00
Eli Friedman
4e7bd4a8a1
Think through my commit this time.
...
llvm-svn: 105433
2010-06-03 23:31:53 +00:00
Eli Friedman
cd70980c8e
Make sure this test doesn't break when we disallow throwing an exception
...
in -fno-exceptions mode.
llvm-svn: 105432
2010-06-03 23:22:25 +00:00
Eli Friedman
91a3d27ec0
Make sure to check the accessibility of and mark the destructor for the
...
operand of a throw expression. Fixes PR7281.
llvm-svn: 105408
2010-06-03 20:39:03 +00:00
Eli Friedman
cce5b81ce1
Don't intentionally try to ignore the value of a scalar expression when we
...
actually care about it. Fixes PR7291.
llvm-svn: 105404
2010-06-03 19:58:07 +00:00
John McCall
1c70e99a2c
Hack in some really terrible C++ record PCH support that I need right now.
...
This is required in order to test:
The ASTImporter should set base classes after formally entering the definition.
llvm-svn: 105401
2010-06-03 19:28:45 +00:00
Anders Carlsson
bcb2e4cb63
Don't try to explicitly zero out bit-fields.
...
llvm-svn: 105391
2010-06-03 15:36:07 +00:00
Zhongxing Xu
41cdf585c2
CFG: add all LHS of assingments as lvalue. This improves support for C++ reference. Patch by Jordy.
...
llvm-svn: 105383
2010-06-03 06:23:18 +00:00
Jeffrey Yasskin
c9b9bdcc20
There is no dcl.init.ref p16. This test deals with p5.
...
llvm-svn: 105351
2010-06-02 22:01:22 +00:00
Fariborz Jahanian
d1b378e08d
Block C++ code gen. Adds support for block reference argument
...
types. Executable test will be added to LLVM test suite.
(radar 8041962).
llvm-svn: 105347
2010-06-02 21:35:17 +00:00
John McCall
6a7f9f5c8f
Don't try to emit the vtable for a class just because we're emitting a
...
virtual function from it.
Fixes PR7241.
llvm-svn: 105345
2010-06-02 21:22:02 +00:00
Anders Carlsson
b4d2cdbb46
Don't substitute 'St' for 'std' when the namespace is nested inside another namespace.
...
llvm-svn: 105330
2010-06-02 15:58:27 +00:00
Anders Carlsson
a85c1469c7
When building RTTI descriptors for pointer types, we need to get the unqualified array type and the qualifiers from it.
...
llvm-svn: 105326
2010-06-02 15:44:35 +00:00
Douglas Gregor
876cec2898
typeid() produces type information for the cv-unqualified version of
...
the type. Thanks to Anders for the bug report!
llvm-svn: 105314
2010-06-02 06:16:02 +00:00
Anders Carlsson
d951a7ebf8
Correctly mangle unsigned integer literals where the high bit is set.
...
llvm-svn: 105312
2010-06-02 05:07:26 +00:00
Anders Carlsson
728fe444f1
Correctly mangle variadic functions that don't have any other parameters.
...
llvm-svn: 105311
2010-06-02 04:40:13 +00:00
Anders Carlsson
d563923cf1
When mangling member function pointers, fake adding a substitution corresponding to the function type.
...
llvm-svn: 105310
2010-06-02 04:29:50 +00:00
Zhongxing Xu
527ff6d1dc
Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my
...
modification.
llvm-svn: 105264
2010-06-01 03:01:33 +00:00
Douglas Gregor
952cf9414f
Tweak test for non-64-bit Darwin
...
llvm-svn: 105222
2010-05-31 14:58:57 +00:00
Douglas Gregor
990ccace5b
When we see the a '[' in a postfix expression in Objective-C, perform
...
a simple, quick check to determine whether the expression starting
with '[' can only be an Objective-C message send. If so, don't parse
it as an array subscript expression. This improves recovery for, e.g.,
[a method1]
[a method2]
so that we now produce
t.m:10:13: error: expected ';' after expression
[a method]
^
instead of some mess about expecting ']'.
llvm-svn: 105221
2010-05-31 14:40:22 +00:00
Ted Kremenek
4708f5a89b
After conversations with Zhongxing Xu and Jordy Rose, refine the logic in
...
RegionStoreManager::RetrieveElement() that handles indexing into a larger scalar
object to only consult the direct binding of a super region if it is a scalar.
This isn't perfect yet, and a big FIXME is attached to the code. This causes
the test case for PR 7218 now to pass.
llvm-svn: 105195
2010-05-31 01:22:04 +00:00
Douglas Gregor
fe4a4107d8
Improve our handling of NULL after an escaping '\' in a string
...
literal. Fixes <rdar://problem/8044135>.
llvm-svn: 105181
2010-05-30 22:59:50 +00:00
Douglas Gregor
d5a479cbb5
Don't try to parse class template specializations in C. It can only
...
lead to heartache. Fixes <rdar://problem/8044088>.
llvm-svn: 105178
2010-05-30 22:30:21 +00:00
Douglas Gregor
2683c28ff6
Improve parser recovery when we try to parse a call expression but the
...
called function itself is invalid (e.g., because of a semantic error
referring to that declaration). Fixes <rdar://problem/8044142>.
llvm-svn: 105175
2010-05-30 22:23:08 +00:00
Anders Carlsson
b1fcdd063c
Turn on the new empty base subobject tracking code. It's a bit faster than the previous code. However, it still has quadratic performance, something which I intend to fix shortly in a subsequent patch.
...
llvm-svn: 105161
2010-05-30 06:52:33 +00:00
Eli Friedman
c8731be34d
Fix for PR7040: Don't try to compute the LLVM type for a function where it
...
isn't possible to compute.
This patch is mostly refactoring; the key change is the addition of the code
starting with the comment, "Check whether the function has a computable LLVM
signature." The solution here is essentially the same as the way the
vtable code handles such functions.
llvm-svn: 105151
2010-05-30 06:03:20 +00:00
Douglas Gregor
ad98fc9733
Unbreak non-Darwin builds
...
llvm-svn: 105137
2010-05-30 04:00:50 +00:00
Douglas Gregor
7aa6b229fe
Teach code completion to adjust its completion priorities based on the
...
type that we expect to see at a given point in the grammar, e.g., when
initializing a variable, returning a result, or calling a function. We
don't prune the candidate set at all, just adjust priorities to favor
things that should type-check, using an ultra-simplified type system.
llvm-svn: 105128
2010-05-30 01:49:25 +00:00
Anders Carlsson
6b0d914ad0
Rework the way virtual primary bases are added when laying out classes. Instead of doing it as a separate step, we now use the BaseSubobjectInfo and use it when laying out the bases. This fixes a bug where we would either not add a primary virtual base at all, or add it at the wrong offset.
...
llvm-svn: 105110
2010-05-29 19:44:50 +00:00
Zhongxing Xu
94aec9381d
Revert r105097. Thinking about a better fix.
...
llvm-svn: 105099
2010-05-29 06:49:04 +00:00
Zhongxing Xu
928a190a8e
Fix PR7218. Patch by Jordy Rose.
...
llvm-svn: 105097
2010-05-29 06:23:24 +00:00
Fariborz Jahanian
9f718743a1
Changed text of 'empty enum' diagnostics to say so.
...
llvm-svn: 105013
2010-05-28 22:43:53 +00:00
Fariborz Jahanian
6e81492151
Empty enum in c is now error to match gcc's behavior.
...
(radar 8040068).
llvm-svn: 105011
2010-05-28 22:23:22 +00:00
Daniel Dunbar
5794c6fa43
Sema: Just ignore '#pragma options align=power' for now, this is no worse than
...
what we used to be doing, and makes sure that paired '#pragma options
align=reset' won't fail.
llvm-svn: 104998
2010-05-28 19:43:33 +00:00
Fariborz Jahanian
93bef10131
Fix a miscompile of wchar pascal strings.
...
(radar 8020384)
llvm-svn: 104996
2010-05-28 19:40:48 +00:00
John McCall
f24d7bbbcd
A more minimal fix for PR6762.
...
llvm-svn: 104991
2010-05-28 18:45:08 +00:00
John McCall
61d8258fa3
Roll back r104941.
...
llvm-svn: 104990
2010-05-28 18:25:28 +00:00
John McCall
f9c94093f9
Disable exception-spec compatibility checking under -fno-exceptions.
...
Fixes PR7243.
llvm-svn: 104942
2010-05-28 08:37:35 +00:00
John McCall
2177a9b65a
Add a new attribute on records, __attribute__((adl_invisible)), and define
...
the x86-64 __va_list_tag with this attribute. The attribute causes the
affected type to behave like a fundamental type when considered by ADL.
(x86-64 is the only target we currently provide with a struct-based
__builtin_va_list)
Fixes PR6762.
llvm-svn: 104941
2010-05-28 08:20:36 +00:00
John McCall
cd4b3ba316
Test case for r104938.
...
llvm-svn: 104939
2010-05-28 06:14:52 +00:00
Douglas Gregor
ed2540d205
When we complain about a member being inaccessible due to a constraint
...
along an access path, add another note pointing at the member we
actually found.
llvm-svn: 104937
2010-05-28 04:34:55 +00:00
John McCall
4583186b8b
When filtering out previous declarations of friend functions, consider the
...
lookup context, not the direct semantic context. Fixes PR7230.
llvm-svn: 104917
2010-05-28 01:41:47 +00:00
Douglas Gregor
d37c59dae7
Don't put method bodies into code completions unless code patterns are
...
turned on.
llvm-svn: 104909
2010-05-28 00:57:46 +00:00
Douglas Gregor
70febae768
Do not produce types as valid code completions when we're in an
...
expression context in C/Objective-C, or when we're in an
@interface/@implementation/@protocol in Objective-C(++).
llvm-svn: 104908
2010-05-28 00:49:12 +00:00
Dan Gohman
04f8720118
Add several more predefines from modern versions of GCC.
...
llvm-svn: 104906
2010-05-28 00:27:15 +00:00
Douglas Gregor
f4c33349b5
Make -code-completion-patterns only cover multi-line code
...
completions. Plus, tweak a few completion patterns to better reflect
the language grammar.
llvm-svn: 104905
2010-05-28 00:22:41 +00:00
Douglas Gregor
a817a19bc6
Implement a code-completion hook for the receiver of an Objective-C
...
message. This completion gives better results than just using the
"expression" completion, which is effectively what happened before.
llvm-svn: 104895
2010-05-27 23:06:34 +00:00
Anders Carlsson
da265b8d63
When null-initializing bases with data member pointers, don't assert on virtual bases. Just initialize them to null.
...
llvm-svn: 104868
2010-05-27 18:51:01 +00:00
John McCall
02269a66b3
Enable the implementation of __builtin_setjmp and __builtin_longjmp. Not all
...
LLVM backends support these yet.
llvm-svn: 104867
2010-05-27 18:47:06 +00:00