Commit Graph

23652 Commits

Author SHA1 Message Date
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
Richard Smith c82fae6070 constexpr: Fix implementation of DR1311: check for volatile qualifiers in
lvalue-to-rvalue conversions on the source type of the conversion, not the
target type (which has them removed for non-class types).

llvm-svn: 149796
2012-02-05 01:23:16 +00:00
Bob Wilson 49708d41a6 Preserve alignment for Neon vld1_lane/dup and vst1_lane intrinsics.
We had been generating load/store instructions with the default alignment
for the vector element type, even when the pointer argument had less alignment.
<rdar://problem/10538555>

llvm-svn: 149794
2012-02-04 23:58:08 +00:00
Sebastian Redl 860eb7cf12 A useful approximation of initializer list constructors.
llvm-svn: 149792
2012-02-04 21:27:47 +00:00
Sebastian Redl ab3f7a4e3d Factor out the actual overload resolution from TryConstructorInitialization, since it needs to be used again for list constructor resolution.
llvm-svn: 149791
2012-02-04 21:27:39 +00:00
Sebastian Redl 88e4d4933a Don't unwrap initializer lists before calling TryConstructorInitialization, instead doing a little more work inside. This should make finding initializer list constructors easier, as well as fix one place where the ({}) vs {} issue was probably poorly handled.
llvm-svn: 149790
2012-02-04 21:27:33 +00:00
Benjamin Kramer 4903802fbf Move a method from IdentifierTable.h out of line and remove the SmallString include.
Fix all the transitive include users.

llvm-svn: 149783
2012-02-04 13:45:25 +00:00
Benjamin Kramer 02c746de10 Remove Diagnostic.h include from Preprocessor.h.
- Move the offending methods out of line and fix transitive includers.
- This required changing an enum in the PPCallback API into an unsigned.

llvm-svn: 149782
2012-02-04 13:02:15 +00:00
Benjamin Kramer 3307c508c9 Move various diagnostic operator<< overloads out of line and remove includes of Diagnostic.h.
Fix all the files that depended on transitive includes of Diagnostic.h.
With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer.

llvm-svn: 149781
2012-02-04 12:31:12 +00:00
Benjamin Kramer 728ed3f386 Move Storage and StorageAllocator out of the PartialDiagnostic class so we can forward declare them.
Let ASTContext allocate the storage in its BumpPtrAllocator.
This will help us remove ASTContext's depedency on PartialDiagnostic.h soon.

llvm-svn: 149780
2012-02-04 12:30:46 +00:00
Richard Smith f4c51d9d76 In C++11 mode, when an integral constant expression is desired and we have a
value of class type, look for a unique conversion operator converting to
integral or unscoped enumeration type and use that. Implements [expr.const]p5.

Sema::VerifyIntegerConstantExpression now performs the conversion and returns
the converted result. Some important callers of Expr::isIntegralConstantExpr
have been switched over to using it (including all of those required for C++11
conformance); this switch brings a side-benefit of improved diagnostics and, in
several cases, simpler code. However, some language extensions and attributes
have not been moved across and will not perform implicit conversions on
constant expressions of literal class type where an ICE is required.

In passing, fix static_assert to perform a contextual conversion to bool on its
argument.

llvm-svn: 149776
2012-02-04 09:53:13 +00:00
Richard Smith 8dd3425077 Don't allow a value of a scoped enumeration to be used as the first bound for an
array new expression. This lays some groundwork for the implicit conversion to
integral or unscoped enumeration which C++11 ICEs undergo.

llvm-svn: 149772
2012-02-04 07:07:42 +00:00
Anna Zaks 88598248f9 [analyzer] Make sure Containers OutOfBounds checker does not crash on undefined arguments, when CF functions are called with wrong number of arguments.
llvm-svn: 149771
2012-02-04 06:40:52 +00:00
Richard Smith 3f333f2edf Disallow constexpr main.
llvm-svn: 149770
2012-02-04 06:10:17 +00:00
Richard Smith bcc9bcb65f Fix a rejects-valid in C++11: array new of a negative size, or overflowing array
new, is well-formed with defined semantics of throwing (a type which can be
caught by a handler for) std::bad_array_new_length, unlike in C++98 where it is
somewhere nebulous between undefined behavior and ill-formed.

If the array size is an integral constant expression and satisfies one of these
criteria, we would previous the array new expression, but now in C++11 mode, we
merely issue a warning (the code is still rejected in C++98 mode, naturally).

We don't yet implement new C++11 semantics correctly (see PR11644), but we do
implement the overflow checking, and (for the default operator new) convert such
expressions to an exception, so accepting such code now does not seem especially
unsafe.

llvm-svn: 149767
2012-02-04 05:35:53 +00:00
Argyrios Kyrtzidis 275a671b2a ArrayRef goodness in MultiplexConsumer, no functionality change.
llvm-svn: 149764
2012-02-04 05:23:00 +00:00
Nick Lewycky 96ed7b62f9 Don't warn on use of default allocator with an over-aligned type when the
allocator is given the pointer to allocate into.

llvm-svn: 149760
2012-02-04 03:30:14 +00:00
Argyrios Kyrtzidis bd6a7d4c6c Fix ASTMerge tests that I broke in my previous commit.
llvm-svn: 149759
2012-02-04 03:26:16 +00:00
Anna Zaks 8e009df96e [analyzer] Turn on by default two checkers:
- osx.coreFoundation.containers.IndexOutOfBounds
 - osx.cocoa.SelfInit

llvm-svn: 149747
2012-02-04 02:31:57 +00:00
Anna Zaks 00790d9a3b [analyzer] Minor cleanups to the ObjCSelfInitChecker.
(Also renames in other ObjC checkers to create one category of checks.)

llvm-svn: 149745
2012-02-04 02:31:37 +00:00
Nick Lewycky d0ba3793aa Comment mystery code.
llvm-svn: 149742
2012-02-04 02:16:48 +00:00
Argyrios Kyrtzidis 3d97a9beb9 Use variable in place of multiple CI.getFrontendOpts() calls and use a bit
of ArrayRef goodness. No functionality change.

llvm-svn: 149739
2012-02-04 01:36:04 +00:00
Sean Callanan 1ce3a6b650 Clang has existing support for debuggers that
want to provide "po"-like functionality which
treats the result of an expression implicitly as
"id" (if it is not otherwise known) and prints
it as an Objective-C object.

This has in the past been gated by the
"DebuggerSupport" language option, but that is
too general.  Debuggers also provide other commands
like "print" that do not make any assumptions
about whether the object is an Objective-C object.

This patch makes the assumption conditional on a
new language option: DebuggerCastResultToId.  I
have also made corresponding modifications to the
testsuite.

llvm-svn: 149735
2012-02-04 01:29:37 +00:00
Devang Patel a21bbb2423 Create new tag for the property. This is a work in progress.
llvm-svn: 149734
2012-02-04 01:15:04 +00:00
Eli Friedman 130bbd0302 Suppress the used-but-not-defined warning for static data members while I look into a rather nasty bug in the new odr-use marking code.
llvm-svn: 149731
2012-02-04 00:54:05 +00:00
Richard Smith 74388b4ec0 constexpr:
The recent support for potential constant expressions exposed a bug in the
  implementation of libstdc++4.6, where numeric_limits<int>::min() is defined
  as (int)1 << 31, which isn't a constant expression. Disable the 'constexpr
  function never produces a constant expression' error inside system headers
  to compensate.

llvm-svn: 149729
2012-02-04 00:33:54 +00:00
Nick Lewycky 51a009092c Make _mm_cmpgt_epi8 immute to -funsigned-char.
llvm-svn: 149725
2012-02-03 23:57:48 +00:00
Eli Friedman a023e0c619 Make explicit captures which cause implicit captures work correctly.
llvm-svn: 149719
2012-02-03 23:06:43 +00:00
Eli Friedman 24af850470 Implement implicit capture for lambda expressions.
Still left: explicit captures in lambdas need to cause implicit capture, and I need to take a look at the diagnostics for some cases.

llvm-svn: 149718
2012-02-03 22:47:37 +00:00
Douglas Gregor 3dd5fe2006 Make sure that the layout-override parser grabs the size, not the data
size. Otherwise, we can end up with bogus layouts.

llvm-svn: 149703
2012-02-03 19:31:51 +00:00
Douglas Gregor 1f79ca839c When a pack expansion occurs in the template argument list of an alias
template without a corresponding parameter pack, don't immediately
substitute the alias template. This is under discussion in the C++
committee, and may become ill-formed, but for now we match GCC.

llvm-svn: 149697
2012-02-03 17:16:23 +00:00
Hans Wennborg b64a1fa65c Don't warn about anonymous struct/union in C11.
Also, in C, call this a C11 extension rather than a GNU extension.

llvm-svn: 149695
2012-02-03 15:47:04 +00:00
Douglas Gregor 8e07261362 Implement support for a pack expansion into a fixed-length
template. Such pack expansions can easily fail at template
instantiation time, if the expanded parameter packs are of the wrong
length. Fixes <rdar://problem/10040867>, PR9021, and the example that
came up today at Going Native.

llvm-svn: 149685
2012-02-03 07:34:46 +00:00
Bob Wilson 14adb360a7 Fix -ftrap-function fallout from llvm r145714. <rdar://problem/10799325>
That llvm change removed the -trap-func backend option, so that using
-ftrap-function with clang would cause the backend to complain.  Fix it
by adding the trap function name to the CodeGenOptions and passing it through
to the TargetOptions.

llvm-svn: 149679
2012-02-03 06:27:22 +00:00
Argyrios Kyrtzidis 0d9e24b1db Change Lexer::makeFileCharRange() to have it accept a CharSourceRange
instead of a SourceRange, and handle the case where the range is
a char (not token) range.

llvm-svn: 149677
2012-02-03 05:58:29 +00:00
Argyrios Kyrtzidis de044e5bb8 Change the fixed array of FixitHints to a SmallVector to lift off
the limit on the number of fixits.

llvm-svn: 149676
2012-02-03 05:58:22 +00:00
Argyrios Kyrtzidis 2e809ce7b4 Move isSentinelNullExpr() from Sema to ASTContext to make it more widely
available.

llvm-svn: 149675
2012-02-03 05:58:16 +00:00
Richard Smith 922866783b Thread safety analysis:
* When we detect that a CFG block has inconsistent lock sets, point the
   diagnostic at the location where we found the inconsistency, and point a note
   at somewhere the inconsistently-locked mutex was locked.
 * Fix the wording of the normal (non-loop, non-end-of-function) case of this
   diagnostic to not suggest that the mutex is going out of scope.
 * Fix the diagnostic emission code to keep a warning and its note together when
   sorting the diagnostics into source location order.

llvm-svn: 149669
2012-02-03 04:45:26 +00:00
Richard Smith 815b29d7c9 Thread safety analysis: at a CFG join point between a block terminating in a
'continue' and another block, prefer the lockset from the other block, and
diagnose the 'continue' block as being the end of a loop.

llvm-svn: 149666
2012-02-03 03:30:07 +00:00
Chad Rosier 96c755d13c C++ 5.2.10p2 has a note that mentions that, subject to all other restrictions,
a cast to the same type is allowed so long as it does not cast away constness.

Fix for PR11747. Patch by Aaron Ballman. Reviewed by Eli.

llvm-svn: 149664
2012-02-03 02:54:37 +00:00
Eli Friedman 9bb33f572f Refactor capture in blocks to use new-style capture hooks. Start adding a bit of the code for lambdas. The only visible changes are that we use the C++11 odr-used rules to figure out when a variable is captured, and type-checking in lambdas is slightly more accurate.
llvm-svn: 149663
2012-02-03 02:04:35 +00:00
Chad Rosier d1956e46dd [frontend] Don't allow a mapping to a warning override an error/fatal mapping.
rdar://10736625

llvm-svn: 149662
2012-02-03 01:49:51 +00:00
Eli Friedman 07f9df1953 Note whether a lambda is mutable in the LambdaScopeInfo; this information will be necessary to handle references to captured variables.
llvm-svn: 149660
2012-02-03 01:39:09 +00:00
Anna Zaks 5069aa33b9 Do not show macro expansion in strncat warnings, which can be defined as
a builtin.

llvm-svn: 149657
2012-02-03 01:27:37 +00:00
Fariborz Jahanian c934de67e0 objc: Issue diagnostic when receiver type is a forward class declaration and
it is treated as of 'id' type resulting in multiple method lookup.
// rdar://10686120

llvm-svn: 149653
2012-02-03 01:02:44 +00:00
Rafael Espindola c29af947d6 Replace the old --with-cxx-* configure options with a single --with-gcc-toolchain
that just uses the new toolchain probing logic. This fixes linking with -m32 on
64 bit systems (the /32 dir was not being added to the search).

llvm-svn: 149652
2012-02-03 01:01:20 +00:00
Douglas Gregor 2e12965942 Rename -dependency-graphviz to -dependencncy-dot
llvm-svn: 149645
2012-02-02 23:45:13 +00:00
Eli Friedman 3bda6b1f8e Add some code to accurately perform odr-used marking for variables per the C++11 rules.
llvm-svn: 149641
2012-02-02 23:15:15 +00:00
Fariborz Jahanian 57539cf8c8 Further enhance comment for property in continuation class.
llvm-svn: 149639
2012-02-02 22:37:48 +00:00
Andrew Trick 877d5a712d unnecessary include of TargetMachine.h?
llvm-svn: 149638
2012-02-02 22:36:19 +00:00