Douglas Gregor
75644d5729
Introduce an egregious hack for modules to cope with headers that come
...
from unfriendly (== not at all modularized) directories. This is
temporary, and it only affects module construction until I'll figured
out how to deal with system headers.
llvm-svn: 140159
2011-09-20 18:13:03 +00:00
Peter Collingbourne
9a8f1534d9
Remove redundant break statements, and replace asserts with llvm_unreachable
...
Per John's review comments for r140068.
llvm-svn: 140142
2011-09-20 12:40:26 +00:00
Chandler Carruth
9a797578dc
Fix a pretty nasty bug in noreturn destructors that cascaded into lots
...
of false positive warnings that depend on noreturn destructors pruning
the CFGs, but only in C++0x mode!
This was really surprising as the debugger quickly reveals that the
attributes are parsed correctly (and using the same code) in both modes.
The warning fires in the same way in both modes. But between parsing and
building the destructor declaration with the noreturn attribute and the
warning, it magically disappears. The key? The 'noexcept' appears!
When we were rebuilding the destructor type with the computed implicit
noexcept we completely dropped the old type on the floor. This almost
makes sense (as the arguments and return type to a destructor aren't
exactly unpredictable), but lost any function type attributes as well.
The fix is simple, we build the new type off of the old one rather than
starting fresh.
Testing this is a bit awkward. I've done it by running the
noreturn-sensitive tests in both modes, which previous failed and now
passes, but if anyone has ideas about how to more specifically and
thoroughly test that the extended info on a destructor is preserved when
adding noexcept, I'm all ears.
llvm-svn: 140138
2011-09-20 04:55:26 +00:00
Eli Friedman
6b9c41ea68
Add list initialization for complex numbers in C. Essentially, this allows "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description.
...
<rdar://problem/9397672>.
llvm-svn: 140090
2011-09-19 23:17:44 +00:00
Peter Collingbourne
2dbb708b8a
OpenCL: introduce support for function scope __local variables
...
llvm-svn: 140068
2011-09-19 21:14:35 +00:00
Argyrios Kyrtzidis
e6e67deeed
Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
...
It already works (and is useful with) macro locs as well.
llvm-svn: 140057
2011-09-19 20:40:19 +00:00
Fariborz Jahanian
e20c0a5a66
objc - some refactoring of my last 'self' patch.
...
llvm-svn: 140031
2011-09-19 18:06:07 +00:00
Fariborz Jahanian
a195a5182c
CurContext cannot be null ever.
...
llvm-svn: 140022
2011-09-19 16:32:32 +00:00
Erik Verbruggen
631dfc6229
Removed an unused field and its accessors methods.
...
llvm-svn: 140017
2011-09-19 15:10:40 +00:00
Richard Smith
c94ec84a3d
In constructors, don't generate implicit initializers for members of anonymous structs contained within anonymous unions.
...
llvm-svn: 140015
2011-09-19 13:34:43 +00:00
Richard Smith
b83e3eb37d
Remove function which is unused as of r139996. Thanks to David Blaikie for bringing this to my attention.
...
llvm-svn: 140013
2011-09-19 11:19:27 +00:00
Francois Pichet
39cba5343d
Move the "jump bypasses variable initialization" error -> warning downgrade from -fms-extensions to -fms-compatibility.
...
llvm-svn: 140008
2011-09-18 21:48:27 +00:00
Francois Pichet
08d2fa0a78
In Microsoft mode(-fms-compatibility), prefer an integral conversion to a floating-to-integral conversion if the integral conversion is between types of the same size.
...
For example:
void f(float);
void f(int);
int main {
long a;
f(a);
}
Here, MSVC will call f(int) instead of generating a compile error as clang will do in standard mode.
This fixes a few errors when parsing MFC code with clang.
llvm-svn: 140007
2011-09-18 21:37:37 +00:00
Richard Smith
20104048be
PR10304: Do not call destructors for data members from union destructors. Prior to C++11, this
...
has no effect since any such destructors must be trivial, and in C++11 such destructors must not
be called.
llvm-svn: 139997
2011-09-18 12:11:43 +00:00
Richard Smith
12d5ed8850
PR10954: variant members should not be implicitly initialized in constructors if no
...
mem-initializer is specified for them, unless an in-class initializer is specified.
llvm-svn: 139996
2011-09-18 11:14:50 +00:00
Richard Smith
4037235429
Fix PR10531. Attach an initializer to anonymous unions, since the default constructor might not be trivial (if there is an in-class initializer for some member) and might be deleted.
...
llvm-svn: 139991
2011-09-18 00:06:34 +00:00
Nico Weber
7c29980d20
Let -Warray-bounds handle casted array types without false positives.
...
Fixes PR10771.
llvm-svn: 139990
2011-09-17 22:59:41 +00:00
Fariborz Jahanian
db8015c449
objc - Treat type of 'self' in class methods as root of
...
class of this method. // rdar://10109725
llvm-svn: 139989
2011-09-17 19:23:40 +00:00
Fariborz Jahanian
8b148bb5b7
objc: Don't crash with decl context for property impl.
...
is missing. // rdar//10127639
llvm-svn: 139988
2011-09-17 18:48:50 +00:00
Francois Pichet
0706d203cf
Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag.
...
Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag.
llvm-svn: 139987
2011-09-17 17:15:52 +00:00
Francois Pichet
2f55019bf0
In Microsoft mode, warn if an indirect goto jump over a variable initialization.
...
Also add a test case for the non Microsoft case because such test didn't exist.
llvm-svn: 139971
2011-09-16 23:15:32 +00:00
Richard Trieu
f8916e118a
Moves calls of checkArithmeticNull() from CreateBuiltinBinOp() into the individual Check*Operands() functions.
...
llvm-svn: 139895
2011-09-16 00:53:10 +00:00
Caitlin Sadowski
086fb95da5
Thread safety: Adding FIXMEs and a couple cleanups
...
llvm-svn: 139894
2011-09-16 00:35:54 +00:00
Richard Trieu
7a5c27276e
Remove no longer needed LHSType and RHSType from checkArithmeticNull()
...
llvm-svn: 139879
2011-09-15 23:57:21 +00:00
Richard Trieu
a25995dbb4
Change checkArithmeticNull() to use a NonNullType, instead of checking both the
...
LHSType and RHSType for everything.
llvm-svn: 139878
2011-09-15 23:51:29 +00:00
Richard Trieu
82402a06f1
Finish the lex->LHS and rex->RHS cleanup in Sema.
...
llvm-svn: 139856
2011-09-15 21:56:47 +00:00
Fariborz Jahanian
d923eb0d1e
reverse patch in r139818 to focus on 'self'
...
instead of 'Class'.
llvm-svn: 139834
2011-09-15 20:40:18 +00:00
Fariborz Jahanian
b7d278ba77
Objective-c: Conversion from type Class to any root class type is allowed
...
in class methods with no warning. //rdar://10109725
llvm-svn: 139818
2011-09-15 18:30:22 +00:00
Caitlin Sadowski
bf06c72aa9
Thread safety: cleaning up FIXME for trylocks
...
llvm-svn: 139805
2011-09-15 17:50:19 +00:00
Caitlin Sadowski
af9b7c5f8b
Thread safety: refactoring various out of scope warnings to use the same inteface. This eliminates a lot of unnecessary duplicated code.
...
llvm-svn: 139801
2011-09-15 17:25:19 +00:00
Caitlin Sadowski
e50d8c3415
Thread safety: reverting to use separate warning for requirement to hold any lock
...
llvm-svn: 139723
2011-09-14 20:09:09 +00:00
Kaelyn Uhrain
7fbe2f78d7
Plug an abstraction leak and fix a crasher in DiagnoseInvalidRedeclaration
...
llvm-svn: 139718
2011-09-14 19:37:32 +00:00
Eli Friedman
8eac6c2187
PR10864: make sure we correctly delay type-checking for inline asm tied operands with dependent type. Patch by Likai Liu.
...
llvm-svn: 139716
2011-09-14 19:20:00 +00:00
Fariborz Jahanian
1723e17b78
objc-arc: warn when a 'retain' block property is
...
declared which does not force a 'copy' of the block literal
object. // rdar://9829425
llvm-svn: 139706
2011-09-14 18:03:46 +00:00
Argyrios Kyrtzidis
8db67df663
Add the location of the interface reference to IBOutletCollectionAttr.
...
Depends on a llvm tablegen commit.
llvm-svn: 139618
2011-09-13 18:41:59 +00:00
John McCall
4319286337
Refactoring, mostly to give ObjCPropertyDecls stronger invariants for
...
their semantic attributes and then to take advantage of that.
llvm-svn: 139615
2011-09-13 18:31:23 +00:00
Caitlin Sadowski
427f42e04a
Thread safety: Initializing var before exhaustive switch statement to deal with extraneous warning produced by gcc but not clang
...
llvm-svn: 139611
2011-09-13 18:01:58 +00:00
Douglas Gregor
79a91418bd
Switch LangOptions over to a .def file that describes header of the
...
language options. Use that .def file to declare the LangOptions class
and initialize all of its members, eliminating a source of annoying
initialization bugs.
AST serialization changes are next up.
llvm-svn: 139605
2011-09-13 17:21:33 +00:00
Argyrios Kyrtzidis
309b4c49e4
Keep the source range of attributes. Depends on a llvm tablegen commit.
...
llvm-svn: 139600
2011-09-13 16:05:58 +00:00
Argyrios Kyrtzidis
635a9b4dcf
Record the full source range of an attribute.
...
llvm-svn: 139599
2011-09-13 16:05:53 +00:00
Francois Pichet
051f5e5cba
In Microsoft mode, downgrade "goto into protected scope" from error to warning if we are jumping over a variable initialization via a goto.
...
This fixes a few errors when parsing MFC code with clang.
llvm-svn: 139595
2011-09-13 10:26:51 +00:00
Chandler Carruth
03faf78953
Switch -Wreturn-type to completely rely on the CFG model of no-return.
...
This deletes a bunch of crufty code, and allows more logic sharing
between the analyzer and the warnings.
llvm-svn: 139594
2011-09-13 09:53:58 +00:00
Douglas Gregor
7bfedd69c5
Kill off an irrelevant FIXME
...
llvm-svn: 139523
2011-09-12 18:58:37 +00:00
Richard Trieu
b420bcaeb0
Refactor CheckAdditionOperands() to use early return for pointer addition.
...
llvm-svn: 139520
2011-09-12 18:37:54 +00:00
Douglas Gregor
41866816ce
Diagnose attempt to mark function-local declarations as __module_private__.
...
llvm-svn: 139519
2011-09-12 18:37:38 +00:00
Richard Trieu
993f3ab07b
Fix two comments from warn to emit error to match the actual diagnostic used.
...
llvm-svn: 139510
2011-09-12 18:08:02 +00:00
Douglas Gregor
3baa6702ab
Allow __module_private__ on fields
...
llvm-svn: 139499
2011-09-12 16:11:24 +00:00
Douglas Gregor
fc33bcfc4a
Remove the restriction on module-private friends. Since the friend
...
declaration may be the first declaration, we want the ability to that
declaration to be marked module-private.
llvm-svn: 139497
2011-09-12 15:48:15 +00:00
Hans Wennborg
be207b3c74
Silence ?: precendence warning when parenthesis are present.
...
Fixes PR10898. The warning should be silent when there are parenthesis
around the condition expression.
llvm-svn: 139492
2011-09-12 12:07:30 +00:00
Benjamin Kramer
8a8051f2cd
Silence "end of non-void function" warnings with llvm_unreachable and add an assert.
...
llvm-svn: 139474
2011-09-10 21:52:04 +00:00