Commit Graph

30974 Commits

Author SHA1 Message Date
Richard Smith 736a947bdc Reapply r183721, reverted in r183776, with a fix for a bug in the former (we
were lacking ExprWithCleanups nodes in some cases where the new approach to
lifetime extension needed them).

Original commit message:

Rework IR emission for lifetime-extended temporaries. Instead of trying to walk
into the expression and dig out a single lifetime-extended entity and manually
pull its cleanup outside the expression, instead keep a list of the cleanups
which we'll need to emit when we get to the end of the full-expression. Also
emit those cleanups early, as EH-only cleanups, to cover the case that the
full-expression does not terminate normally. This allows IR generation to
properly model temporary lifetime when multiple temporaries are extended by the
same declaration.

We have a pre-existing bug where an exception thrown from a temporary's
destructor does not clean up lifetime-extended temporaries created in the same
expression and extended to automatic storage duration; that is not fixed by
this patch.

llvm-svn: 183859
2013-06-12 20:42:33 +00:00
Alexander Kornienko f370ad9055 Preserve newlines before block comments in static initializers.
Summary:
Basically, don't special-case line comments in this regard. And fixed
an incorrect test, that relied on the wrong behavior.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D962

llvm-svn: 183851
2013-06-12 19:04:12 +00:00
Benjamin Kramer fbf914ceb0 Port HTMLDiagnostics to PathV2. No intended functionality change.
llvm-svn: 183849
2013-06-12 18:13:05 +00:00
Aaron Ballman 6a30264ec3 Silencing a signed vs unsigned comparison mismatch in MSVC.
llvm-svn: 183837
2013-06-12 15:03:45 +00:00
Pavel Labath 7e18009a7a Fix memory corruption in CStringChecker
Summary:
"register" functions for the checker were caching the checker objects in a
static variable. This caused problems when the function is called with a
different CheckerManager.

Reviewers: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D955

llvm-svn: 183823
2013-06-12 07:45:04 +00:00
Eli Friedman f045007f11 Add support for complex compound assignments where the LHS is a scalar.
Fixes <rdar://problem/11224126> and PR12790.

llvm-svn: 183821
2013-06-12 01:40:06 +00:00
Eli Friedman 96fd264cc0 Make va_arg and argument passing to varargs functions work correctly with
AVX vectors when AVX is turned on.

Fixes <rdar://problem/10513611>.

llvm-svn: 183813
2013-06-12 00:13:45 +00:00
Eli Friedman 6cc05f7f01 Tweak r183791 so we don't print a note without a source location.
llvm-svn: 183803
2013-06-11 22:26:34 +00:00
Rafael Espindola 552c169ed3 Include Path.h instead of PathV2.h.
I am about to move PathV2.h to Path.h.

llvm-svn: 183795
2013-06-11 22:15:02 +00:00
Eli Friedman 1f16b743d9 Correctly handle designated initializers which modify an array initialized
with a string.  This case is sort of tricky because we can't modify the
StringLiteral used to represent such initializers.
We are forced to decompose the string into individual characters.

Fixes <rdar://problem/10465114>.

llvm-svn: 183791
2013-06-11 21:48:11 +00:00
Rafael Espindola 8fb2a7e7ac Try to fix the windows build.
llvm-svn: 183783
2013-06-11 20:06:05 +00:00
Rafael Espindola be5138885d Include PathV1.h in files that use it.
This is preparation for replacing Path.h with PathV2.h.

llvm-svn: 183781
2013-06-11 19:59:07 +00:00
Richard Smith 4a28f534e1 Revert r183721. It caused cleanups to be delayed too long in some cases.
Testcase to follow.

llvm-svn: 183776
2013-06-11 19:14:25 +00:00
Samuel Benzaquen b5dd69f00d Reduce the number of symbols on the object file.
Summary:
Some compilers where failing with this file because the number of symbols was above 2**15.
- Replace std::list<> and std::vector<> with plain arrays.
- Change VariadicMatcherCreateCallback to be a function template, and a
  single class that wraps the instantiations.
- Remove some more unnecessary template arguments and function calls.

Reviewers: klimek

CC: cfe-commits, revane

Differential Revision: http://llvm-reviews.chandlerc.com/D948

llvm-svn: 183768
2013-06-11 18:51:07 +00:00
Argyrios Kyrtzidis d6f57221c8 Modify a comment to reflect changes of r183717.
llvm-svn: 183751
2013-06-11 16:42:34 +00:00
Alexander Kornienko 555efc36d0 Insert a space at the start of a line comment in case it starts with an alphanumeric character.
Summary:
"//Test" becomes "// Test". This change is aimed to improve code
readability and conformance to certain coding styles. If a comment starts with a
non-alphanumeric character, the space isn't added, e.g. "//-*-c++-*-" stays
unchanged.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D949

llvm-svn: 183750
2013-06-11 16:01:49 +00:00
Benjamin Kramer 8981d6c945 Silence GCC warning.
llvm-svn: 183742
2013-06-11 13:13:47 +00:00
Benjamin Kramer 65745dc0b1 ASTUnit: Invert the dependency of PrecompilePreambleAction on PrecompilePreambleConsumer.
Actions outlive consumers. PR16295. Found by AddressSanitizer.

llvm-svn: 183741
2013-06-11 13:07:19 +00:00
David Majnemer bfce664d09 Remove some unicode that sneaked in.
llvm-svn: 183725
2013-06-11 06:19:45 +00:00
David Majnemer 66ad574f40 Implement DR61: Address of ambiguous bound methods should be disallowed
DR61 affirms that expressions containing unresolved member access should
be disallowed when performing "address of" operations.

llvm-svn: 183723
2013-06-11 03:56:29 +00:00
David Majnemer 55890bfaa6 Implement DR85: Redeclaration of member is forbidden
Disallow the existence of a declaration of a member class that isn't a
forward declaration before it's definition.

llvm-svn: 183722
2013-06-11 03:51:23 +00:00
Richard Smith 7c5d4dce49 Rework IR emission for lifetime-extended temporaries. Instead of trying to walk
into the expression and dig out a single lifetime-extended entity and manually
pull its cleanup outside the expression, instead keep a list of the cleanups
which we'll need to emit when we get to the end of the full-expression. Also
emit those cleanups early, as EH-only cleanups, to cover the case that the
full-expression does not terminate normally. This allows IR generation to
properly model temporary lifetime when multiple temporaries are extended by the
same declaration.

We have a pre-existing bug where an exception thrown from a temporary's
destructor does not clean up lifetime-extended temporaries created in the same
expression and extended to automatic storage duration; that is not fixed by
this patch.

llvm-svn: 183721
2013-06-11 02:41:00 +00:00
Eli Friedman 2761350730 Fix a very silly mistake in r183590.
llvm-svn: 183720
2013-06-11 01:59:28 +00:00
Eli Friedman 61f615af81 Fix a FIXME in a testcase about packed structs and calls I left around
while fixing a related bug.  The fix here was simpler than I thought it
would be.

Fixes <rdar://problem/10530444>.

llvm-svn: 183718
2013-06-11 01:08:22 +00:00
Argyrios Kyrtzidis f0168de936 [libclang] Allow building a precompiled preamble with compiler errors
A while ago we allowed libclang to build a PCH that had compiler errors; this was to retain the performance
afforded by a PCH even if the user's code is in an intermediate state.

Extend this for the precompiled preamble as well.

rdar://14109828

llvm-svn: 183717
2013-06-11 00:36:55 +00:00
Fariborz Jahanian 286fcf6797 Objective-C [qoi]: Issue better warning when nsstring literal is missing
the '@'. PR16287 and // rdar://14106083

llvm-svn: 183713
2013-06-10 23:51:51 +00:00
Eli Friedman 4871a46cc3 Make sure we don't emit invalid IR for StmtExprs with complex cleanups.
Fixes <rdar://problem/14074868>.

llvm-svn: 183699
2013-06-10 22:04:49 +00:00
Adrian Prantl 6e77c96872 cleanup (address some more review comments for r183474):
- reduce default buffer size to 64, which will still be large enough to
  hold any property names found in the wild.
- get rid of the /*static*/ comments.

llvm-svn: 183697
2013-06-10 21:36:55 +00:00
Reid Kleckner 896b32f935 Use FPT::getArgTypes() instead of manually building ArrayRefs
Made significantly easier with git-clang-format.

Differential Revision: http://llvm-reviews.chandlerc.com/D947

llvm-svn: 183694
2013-06-10 20:51:09 +00:00
Richard Trieu bb4b894e0b Add a new warning, -Wlogical-not-parentheses, to -Wparentheses.
This warning triggers on the logical not of a non-boolean expression on the
left hand side of comparison.  Often, the user meant to negate the comparison,
not just the left hand side of the comparison.  Two notes are also emitted,
the first with a fix-it to add parentheses around the comparison, and the other
to put parenthesis around the not expression to silence the warning.

bool not_equal(int x, int y) {
  return !x == y;  // warn here
}

  return !(x == y);  // first fix-it, to negate comparison.

  return (!x) == y;  // second fix-it, to silence warning.

llvm-svn: 183688
2013-06-10 18:52:07 +00:00
Larisse Voufo 67170bd71a Support for contextual conversion tweaks (N3323) was added, as Revision 183637
llvm-svn: 183639
2013-06-10 08:25:58 +00:00
Larisse Voufo 236bec24ec reverted test
llvm-svn: 183637
2013-06-10 06:50:24 +00:00
Larisse Voufo ef2de6f255 test
llvm-svn: 183636
2013-06-10 06:28:37 +00:00
Reid Kleckner 2da7fcda17 [CodeGen] Make CGCleanup.h include what it now uses
Also move CGCleanup.h to the top of CGCleanup.cpp to verify that
CGCleanup.h really includes what it needs.

llvm-svn: 183632
2013-06-09 16:56:53 +00:00
Reid Kleckner 200fe22a13 [CodeGen] Move EHScopeStack to CGCleanup.h from CodeGenFunction.h
No functionality change.  CGCleanup.cpp provides the implementation for
EHScopeStack, so it seems more consistent to place the class definition
in CGCleanup.h.

This should also help solve a header ordering problem that I have.

llvm-svn: 183631
2013-06-09 16:45:02 +00:00
Faisal Vali 475671057c Fix the parser's updating of the template depth when parsing local templates and late-parsed templates.
This is a slight tweak of r180708; It avoids incrementing depth when non-template local classes nested within member templates of local classes are encountered.  
This patch was LGTM'd by Doug http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130506/079656.html and passed the regression tests that normally pass (i.e. excluding many Module and Index tests on Windows that fail regardless)

llvm-svn: 183620
2013-06-08 19:47:52 +00:00
Faisal Vali 6a79ca1c6d Revert r183618.
I ran clang-format on my patch but it seemed to have wreaked havoc with new lines  - might have to do with using it on windows :( will resubmit once i've cleaned this issue up. sorry.

llvm-svn: 183619
2013-06-08 19:39:00 +00:00
Faisal Vali 9b629831a7 Fix the parser's updating of the template depth when parsing local templates and late-parsed templates. This is a slight tweak of r180708; It avoids incrementing depth when non-template local classes nested within member templates of local classes are encountered.
This patch was LGTM'd by Doug http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130506/079656.html and passed the regression tests that normally pass (i.e. excluding many Module and Index tests on Windows that fail regardless)

llvm-svn: 183618
2013-06-08 19:33:09 +00:00
Reid Kleckner 17aeeeb311 Revert "[Sema] Make FunctionType's TSI use unadjusted argument types"
This reverts commit r183614.

It broke test/Sema/block-printf-attribute-1.c on non-Windows platforms,
and the fix is not trivial.

llvm-svn: 183616
2013-06-08 18:19:52 +00:00
Reid Kleckner 4c124ffd5b [Sema] Make FunctionType's TSI use unadjusted argument types
This helps preserve the type-as-written in the AST, which we need for
MSVC mangling.  In particular, we need to preserve the types of array
parameters in function pointer types.

The essence of this change is:
-  QualType ArgTy = Param->getType();
+  QualType ArgTy = Param->getTypeSourceInfo()->getType();

... followed by the adjustment in ActOnFunctionDeclarator().

Differential Revision: http://llvm-reviews.chandlerc.com/D883

llvm-svn: 183614
2013-06-08 17:28:56 +00:00
Serge Pavlov 89578fd439 Recognition of empty structures and unions is moved to semantic stage
Differential Revision: http://llvm-reviews.chandlerc.com/D586

llvm-svn: 183609
2013-06-08 13:29:58 +00:00
Jin-Gu Kang 0b5ca604a9 Added a type checking which handle the case of an ext vector and integral scalar
llvm-svn: 183602
2013-06-08 02:15:36 +00:00
Anna Zaks 8ebeb643fd [analyzer] Minor fixups to r183062
Based on feedback from Jordan.

llvm-svn: 183600
2013-06-08 00:29:29 +00:00
Anna Zaks 22895473af [analyzer; alternate edges] Fix the edge locations in presence of macros.
We drew the diagnostic edges to wrong statements in cases the note was on a macro.
The fix is simple, but seems to work just fine for a whole bunch of test cases (plist-macros.cpp).

Also, removes an unnecessary edge in edges-new.mm, when function signature starts with a macro.

llvm-svn: 183599
2013-06-08 00:29:24 +00:00
Michael Gottesman abfeabb565 Fixed comment typo.
llvm-svn: 183598
2013-06-08 00:27:19 +00:00
Adrian Prantl 0ffce6ec99 Debug info: An if condition now creates a lexical scope of its own.
Two variables with the same name declared in two if conditions in the same
scope are no longer coalesced into one.

rdar://problem/14024005

llvm-svn: 183597
2013-06-08 00:16:55 +00:00
Richard Smith faadef7369 Recursively lifetime-extend into array temporaries. These can get implicitly
created through binding a reference-to-array to an initializer list.

llvm-svn: 183594
2013-06-08 00:02:08 +00:00
Eric Christopher ac0217424c When we're compiling with -pg make sure to link with gcrt1.o on linux. Be
sure to do this always, this matches the behavior for the gcc driver.

Fixes PR16251.

Based on a patch by Qiao Yang.

llvm-svn: 183591
2013-06-07 23:25:01 +00:00
Eli Friedman c11c169530 Fix va_arg on x86-64 for a struct containing a single int128_t. PR16248
llvm-svn: 183590
2013-06-07 23:20:55 +00:00
Douglas Gregor 5e46119fbe Loosen r178109 even further, to assume that all redefined macros in system headers and system modules are equivalent.
Fixes <rdar://problem/14025673>.

llvm-svn: 183588
2013-06-07 22:56:11 +00:00