Commit Graph

41556 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 922b7a186b In ExpressionEvaluationContextRecord manage LambdaMangle with a shared
pointer, otherwise we will double free it when ExpressionEvaluationContextRecord
gets copied.

Fixes crash in rdar://12645424 & http://llvm.org/PR14252

llvm-svn: 167946
2012-11-14 19:16:13 +00:00
John McCall 3c2239356c The ObjC++-to-C++ personality trick is only necessary on NeXT runtimes,
which is not coincidentally the only place it works, either (because
of how it tests for EH_TYPE symbols).

llvm-svn: 167935
2012-11-14 17:48:31 +00:00
Fariborz Jahanian 983ae49a92 fixes a buildbot failure.
llvm-svn: 167934
2012-11-14 17:43:08 +00:00
Fariborz Jahanian cad7e371d0 Fix 80-column violation.
llvm-svn: 167932
2012-11-14 17:27:27 +00:00
Fariborz Jahanian a9d4464baf objective-C blocks: Provide layout map for byref
variables captured in a block. // rdar://12184410

llvm-svn: 167931
2012-11-14 17:15:51 +00:00
Benjamin Kramer d81108f0bc s/tranform/transform/
llvm-svn: 167929
2012-11-14 15:08:31 +00:00
John McCall c31d893613 Move some GNUStep-specific code out of CGObjCGNU.
Patch by Jonathan Schleifer.

llvm-svn: 167925
2012-11-14 09:08:34 +00:00
Richard Smith 5fa94b09b4 PR14279: Work around this major miscompilation by treating move operations as
non-trivial if they would not call a move operation, even if they would in fact
call a trivial copy operation. A proper fix is to follow, but this small
directed fix is intended for porting to the 3.2 release branch.

llvm-svn: 167920
2012-11-14 07:36:28 +00:00
Richard Smith 4f6a2c4acb When we have a MemberExpr referring to an overloaded static member function,
and we resolve it to a specific function based on the type which it's used as,
don't forget to mark it as referenced.

Fixes a regression introduced in r167514.

llvm-svn: 167918
2012-11-14 07:06:31 +00:00
Logan Chien 4d401b47d1 Code cleanup: Remove trailing whitespace in unwind.h.
llvm-svn: 167915
2012-11-14 06:33:58 +00:00
David Blaikie 72ee18c12a Remove debugging assert.
Found by Richard Smith in post-commit review of r167906.

llvm-svn: 167911
2012-11-14 04:41:34 +00:00
NAKAMURA Takumi bae23ed8c5 SemaTemplateDeduction.cpp: Prune two obsolete descriptions. [-Wdocumentation]
* getMostSpecialized()

/// \param Index if non-NULL and the result of this function is non-nULL,
/// receives the index corresponding to the resulting function template
/// specialization.

* DeduceTemplateArguments()

/// \param Name the name of the function being called. This is only significant
/// when the function template is a conversion function template, in which
/// case this routine will also perform template argument deduction based on
/// the function to which

llvm-svn: 167909
2012-11-14 02:21:48 +00:00
NAKAMURA Takumi 793642fe04 ParseTemplate.cpp: Doxygen fix in AnnotateTemplateIdToken(). [-Wdocumentation]
llvm-svn: 167908
2012-11-14 02:21:42 +00:00
Eli Friedman 14d3c79b45 Suppress elided variadic macro argument extension diagnostic for macros using
the related comma pasting extension.

In certain cases, we used to get two diagnostics for what is essentially one
extension.  This change suppresses the first diagnostic in certain cases
where we know we're going to print the second diagnostic.  The
diagnostic is redundant, and it can't be suppressed in the definition
of the macro because it points at the use of the macro, so we want to
avoid printing it if possible.

The implementation works by detecting constructs which look like comma
pasting at the time of the definition of the macro; this information
is then used when the macro is used.  (We can't actually detect
whether we're using the comma pasting extension until the macro is
actually used, but we can detecting constructs which will be comma
pasting if the varargs argument is elided.)

<rdar://problem/12292192>

llvm-svn: 167907
2012-11-14 02:18:46 +00:00
David Blaikie 095deba533 Provide the correct mangling and linkage for certain unnamed nested classes.
This corrects the mangling and linkage of classes (& their member functions) in
cases like this:

  struct foo {
    struct {
      void func() { ... }
    } x;
  };

we were accidentally giving this nested unnamed struct 'no' linkage where it
should've had the linkage of the outer class. The mangling was incorrecty too,
mangling as TU-wide unnamed type mangling of $_X rather than class-scoped
mangling of UtX_.

This also fixes -Wunused-member-function which would incorrectly diagnose
'func' as unused due to it having no linkage & thus appearing to be TU-local
when in fact it might be correctly used in another TU.

Similar mangling should be applied to function local classes in similar cases
but I've deferred that for a subsequent patch.

Review/discussion by Richard Smith, John McCall, & especially Eli Friedman.

llvm-svn: 167906
2012-11-14 01:52:05 +00:00
Anders Carlsson 0f6771305b Use consistent spelling of 'behavior' in a C++ warning.
llvm-svn: 167902
2012-11-14 01:39:09 +00:00
Nick Lewycky 4a4d8f2f3b This function isn't called SaveFiles any more.
llvm-svn: 167901
2012-11-14 01:33:49 +00:00
Eli Friedman b699e619fe Fix an assertion failure printing the unused-label fixit in files using CRLF line endings. <rdar://problem/12639047>.
llvm-svn: 167900
2012-11-14 01:28:38 +00:00
Richard Smith 41ae3288fd Remove another questionable use of hasTrivial*. The relevant thing for this
test was whether the /selected/ operator= was trivial, not whether the class
had any trivial (or any non-trivial) operator=s.

llvm-svn: 167897
2012-11-14 00:50:40 +00:00
John McCall ea0a39e7ad Accept and pass arguments to __unknown_anytype in argument
positions of Objective-C methods.

It is possible to recover a lot of type information about
Objective-C methods from the reflective metadata for their
implementations.  This information is not rich when it
comes to struct types, however, and it is not possible to
produce a type in the debugger's round-tripped AST which
will really do anything useful during type-checking.
Therefore we allow __unknown_anytype in these positions,
which essentially disables type-checking for that argument.
We infer the parameter type to be the unqualified type of
the argument expression unless that expression is an
explicit cast, in which case it becomes the type-as-written
of that cast.

rdar://problem/12565338

llvm-svn: 167896
2012-11-14 00:49:39 +00:00
Matt Beaumont-Gay d7a527c438 Fix typo
llvm-svn: 167891
2012-11-14 00:00:25 +00:00
Eric Christopher 175c72656f Revert "Use the 'count' attribute instead of the 'upper_bound' attribute."
temporarily since it breaks the gdb bots.

This reverts commit r167807/30305bec25cac981c6d4a3b8be004401310a82a7.

llvm-svn: 167887
2012-11-13 23:30:57 +00:00
Eli Friedman 00fa429b5d Don't try to save the assigned value in a Objective-C property assignment
if the type of the value is a non-trivial class type.  Fixes PR14318.

(There's a minor ObjC++ language change here: given that we can't save the
value, the type of the assignment expression is void in such cases.)

llvm-svn: 167884
2012-11-13 23:16:33 +00:00
Nico Weber 3ad723ca2e [ms] Make mangleIntegerLiteral less aware of exact type of the literal.
Integer literal mangling does not actually depend on exact type of the literal.
This will simplify calling mangleIntegerLiteral when literal type is not known,
for example, when sizes or offsets are mangled as integer literals.

Also, call mangleNumber instead of directly printing mangled values of 0/1, to
avoid this knowledge from being in multiple places.

Patch from Evgeny Eltsin!

llvm-svn: 167878
2012-11-13 22:09:44 +00:00
Kaelyn Uhrain 1137001938 For classes that have the warn_unused_result attribute, don't apply the
attribute to the class' methods even when they return an instance of the
class (e.g. assignment operators).

llvm-svn: 167873
2012-11-13 21:23:31 +00:00
Anna Zaks a14c1d09f6 [analyzer] Address Jordan's code review for r167813.
This simplifies logic, fixes a bug, and adds a test case.
Thanks Jordan!

llvm-svn: 167868
2012-11-13 19:47:40 +00:00
Daniel Dunbar cf3f2c49ea Revert r167801, "[preprocessor] When #including something that contributes no
tokens at all,". This change broke External/Nurbs in LLVM test-suite.

llvm-svn: 167858
2012-11-13 19:12:37 +00:00
David Blaikie 3403feb1d0 Simplify function try/catch scope handling.
Based on post-commit review feedback for r167766 by Richard Smith.

llvm-svn: 167856
2012-11-13 18:51:45 +00:00
Daniel Jasper a05bb6bd70 Fix AST-matcher descendant visiting for Types, TypeLocs and NestedNamespecifierLocs.
The RecursiveASTVisitor assumes that any given Traverse-method can be called with a NULL-node. So the subclass needs to handle these appropriately.

llvm-svn: 167850
2012-11-13 17:14:11 +00:00
Benjamin Kramer 76db2907b0 This patch makes the behavior of clang consistent with the behavior of gcc 4.6 in cases where both -fPIC and -fPIE is used.
- Separately check if -fPIE was specified in the command line and define both __PIC__ and __PIE__ when -fPIE is used. We need to check this separately because -fPIE will infer -fPIC even if its not explicitly used.
- Fixed existing tests.
- Added new tests for cases where both -fPIC and -fPIE is used.

Author: Tareq A. Siraj <tareq.a.siraj@intel.com>
Fixes: PR13221
Review: http://llvm-reviews.chandlerc.com/D94
llvm-svn: 167846
2012-11-13 15:32:35 +00:00
Nico Weber 7cc28804e2 UCNs in char literals are done (in LiteralSupport), remove FIXME. Expand UCN FIXME in LexNumericConstant.
llvm-svn: 167818
2012-11-13 06:25:15 +00:00
Argyrios Kyrtzidis 243d82345d Copy the decls returned by DeclContext::lookup_result to a
new container so we can safely iterate over them.

The container holding the lookup decls can under certain conditions
be changed while iterating (e.g. because of deserialization).

llvm-svn: 167816
2012-11-13 05:07:23 +00:00
Anna Zaks de13814a37 Add a test that shows that reporting a leak after failure to free is
tricky.

llvm-svn: 167814
2012-11-13 03:34:49 +00:00
Anna Zaks 67291b90f9 Fix a Malloc Checker FP by tracking return values from initWithCharacter
and other functions.

When these functions return null, the pointer is not freed by
them/ownership is not transfered. So we should allow the user to free
the pointer by calling another function when the return value is NULL.

llvm-svn: 167813
2012-11-13 03:18:01 +00:00
Bill Wendling 2415b3b6b0 Use the 'count' attribute instead of the 'upper_bound' attribute.
If we have a type 'int a[1]' and a type 'int b[0]', the generated DWARF is the
same for both of them because we use the 'upper_bound' attribute. Instead use
the 'count' attrbute, which gives the correct number of elements in the array.
<rdar://problem/12566646>

llvm-svn: 167807
2012-11-13 02:31:58 +00:00
Eli Friedman b369f44924 Fix IR generation for bool on PPC (and any other target where bool is not 8 bits in memory).
PR11777.

llvm-svn: 167802
2012-11-13 02:05:15 +00:00
Argyrios Kyrtzidis 4f10a3e9f0 [preprocessor] When #including something that contributes no tokens at all,
don't recursively continue lexing.

This avoids a stack overflow with a sequence of many empty #includes.
rdar://11988695

llvm-svn: 167801
2012-11-13 01:03:15 +00:00
Argyrios Kyrtzidis 36675b75fb In Lexer::LexTokenInternal, avoid code duplication; no functionality change.
llvm-svn: 167800
2012-11-13 01:02:40 +00:00
Bill Wendling 744611f9ba Disable accelerator tables when compiling with LTO.
LTO doesn't generate correct accelerator tables. This is due to the general lack
correct of debug info for LTO. Disable it when using LTO.
<rdar://problem/12401423>

llvm-svn: 167799
2012-11-13 00:54:24 +00:00
Richard Smith 52c0b58d33 Fix some wrong-code bugs in implicitly-defined assignment operators:
- In C++11, perform overload resolution over all assignment operators, rather than just looking for copy/move assignment operators.
 - Clean up after temporaries produced by operator= immediately, rather than accumulating them until the end of the function.

llvm-svn: 167798
2012-11-13 00:54:12 +00:00
Kaelyn Uhrain 3d699e02ae A couple of small fixes to r167783
llvm-svn: 167791
2012-11-13 00:18:47 +00:00
Anna Zaks abdc72d970 [analyzer] Address Jordan's feedback for r167780.
llvm-svn: 167790
2012-11-13 00:13:44 +00:00
Ted Kremenek e6ee671e16 Fix bad CFG construction bug when handling C++ 'try' statements.
This code assigned the last created CFGBlock* to the variable 'Block',
which is a scratch variable which is null'ed out after a block is
completed.  By assigning the last created block to 'Block', we start
editing a completed block, inserting CFGStmts that should be in
another block.  This was the case with 'try'.  The test case that
showed this had a while loop inside a 'try', and the logic before
the while loop was being included as part of the "condition block"
for the loop.  This showed up as a bogus dead store, but could
have lots of implications.

Turns out this bug was replicated a few times within CFG.cpp, so
I went and fixed up those as well.

llvm-svn: 167788
2012-11-13 00:12:13 +00:00
Nick Lewycky a21719d688 When filtering the list of associated namespaces so that we don't suggest people
add functions to namespace 'std', also filter out namespaces with '__' anywhere
in the name.

llvm-svn: 167786
2012-11-13 00:08:34 +00:00
Kaelyn Uhrain 8681f9d46d Enable C++11 attribute syntax for warn_unused_result and allow it to be
applied to CXXRecordDecls, where functions with that return type will
inherit the warn_unused_result attribute.

Also includes a tiny fix (with no discernable behavior change for
existing code) to re-sync AttributeDeclKind enum and
err_attribute_wrong_decl_type with warn_attribute_wrong_decl_type since
the enum is used with both diagnostic messages to chose the correct
description.

llvm-svn: 167783
2012-11-12 23:48:05 +00:00
Anna Zaks 6ec9c3cbc1 [analyzer] Follow up to r167762 - precisely determine the adjustment
conditions.

The adjustment is needed only in case of dynamic dispatch performed by
the analyzer - when the runtime declaration is different from the static
one.

Document this explicitly in the code (by adding a helper). Also, use
canonical Decls to avoid matching against the case where the definition
is different from found declaration.

This fix suppresses the testcase I added in r167762, so add another
testcase to make sure we do test commit r167762.

llvm-svn: 167780
2012-11-12 23:40:29 +00:00
Richard Smith 11d1959ff2 Factor duplicated implicit memcpy call generation code out of copy/move
assignment generation. This incidentally avoids reusing the same Expr* across
multiple statements in the same object; that was generating slightly broken
ASTs, but I couldn't trigger any observable bad behavior, so no test.

llvm-svn: 167779
2012-11-12 23:33:00 +00:00
Eric Christopher d41010af44 Finish reverting r167761, it's causing test failures.
llvm-svn: 167777
2012-11-12 23:13:34 +00:00
Rafael Espindola 09e985b451 Remove duplicated line.
llvm-svn: 167767
2012-11-12 22:29:43 +00:00
David Blaikie 1d6178065c Fix more try scoping bugs introduced by r167650.
Introduces more clear scoping flags & flag combinations which should hopefully
be more understandable.

llvm-svn: 167766
2012-11-12 22:25:41 +00:00