Commit Graph

55536 Commits

Author SHA1 Message Date
Richard Smith 5357c0813b Another test for PR19372, showing why we need to keep checking arguments after a pack expansion.
llvm-svn: 221838
2014-11-12 23:50:13 +00:00
Richard Smith 316c6dc1cb Add another testcase.
llvm-svn: 221833
2014-11-12 23:43:08 +00:00
Richard Smith 96d71c3936 PR19372: Keep checking template arguments after we see an argument pack
expansion into a parameter pack; we know that we're still filling in that
parameter's arguments. Previously, if we hit this case for an alias template,
we'd try to substitute using non-canonical template arguments.

llvm-svn: 221832
2014-11-12 23:38:38 +00:00
Anton Korobeynikov 50a3cbd7c0 Temporary revert r221818 until all the problems
with objc stuff will be resolved.

llvm-svn: 221829
2014-11-12 23:15:38 +00:00
Anton Korobeynikov 04348de5d3 Now really fix the typo in the test
llvm-svn: 221825
2014-11-12 22:58:08 +00:00
Anton Korobeynikov c427e3de77 Update the tests to handle proper result type of (?:)
llvm-svn: 221824
2014-11-12 22:48:38 +00:00
Fariborz Jahanian 800821a3b2 [Objective-C++ IRGen] do not generate .cxx_construct
for class that contains trivially-constructible struct ivar.
rdar://18950072

llvm-svn: 221823
2014-11-12 22:37:43 +00:00
Anton Korobeynikov 0140aa8756 Fix fallout from r219557
Summary:
Consider the following nifty 1 liner: (0 ? csqrtl(2.0f) : sqrtl(2.0f)). One can easily obtain such code from e.g. tgmath. Right now it produces an assertion because we fail to do the promotion real => _Complex real.

The case was properly handled previously (old handleOtherComplexFloatConversion routine), but was forgotten in the current version. This seems to be about fallout from r219557

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6217

llvm-svn: 221821
2014-11-12 22:19:06 +00:00
Reid Kleckner 6d829bdbef Fix brace init of unions with unnamed struct members
The check for unnamed members was intended to skip unnamed bitfields,
but it ended up skipping unnamed structs. This lead to an assertion in
IRGen.

llvm-svn: 221818
2014-11-12 21:30:23 +00:00
Richard Smith 38af8561f9 Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,
which we don't yet implement).

llvm-svn: 221816
2014-11-12 21:16:38 +00:00
Kaelyn Takata 98a3ec010a Pass the filter function_ref by value now that r221753 fixes the bug
that was preventing pass-by-value from working correctly.

llvm-svn: 221803
2014-11-12 18:34:08 +00:00
Fariborz Jahanian f122f4b99d Check for IRGen output when varag is used
in -funknown-anytype  mode (in lldb use).

llvm-svn: 221796
2014-11-12 17:54:11 +00:00
Rafael Espindola fd832395b1 Update for llvm api change.
llvm-svn: 221786
2014-11-12 14:48:44 +00:00
Rafael Espindola af0e40ac0e Simplify code a bit by passing StreamFile to the BitstreamCursor constructor.
llvm-svn: 221784
2014-11-12 14:42:25 +00:00
Nico Weber 83a63877dc Mark TypeDecls used in explicit destructor calls as referenced.
Fixes PR21221. Patch by Axel Naumann, test by me.

llvm-svn: 221771
2014-11-12 04:33:52 +00:00
Bill Schmidt 9ec8cea02b [PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics
This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for
PowerPC, which provide programmer access to the lxvd2x, lxvw4x,
stxvd2x, and stxvw4x instructions.

New code in altivec.h defines these in terms of new builtins, which
are themselves defined in BuiltinsPPC.def.  The builtins are converted
to LLVM intrinsics in CGBuiltin.cpp.  Additional code is added to
builtins-ppc-vsx.c to verify the correct generation of the intrinsics.

Note that I moved the other VSX builtins so all VSX builtins will be
alphabetical in their own section in BuiltinsPPC.def.

There is a companion patch for LLVM.

llvm-svn: 221768
2014-11-12 04:19:56 +00:00
Nico Weber 28309185b2 Mark TypeDecls used in member initializers as referenced.
Without this, -Wunused-local-typedef would incorrectly warn on the two typedefs
in this program:

void foo() {
  struct A {};
  struct B : public A {
    typedef A INHERITED;
    B() : INHERITED() {}

    typedef B SELF;
    B(int) : SELF() {}
  };
}

llvm-svn: 221765
2014-11-12 03:52:25 +00:00
Nico Weber aa0117c628 clang-format a few lines, fixes one 80col violation. nfc.
llvm-svn: 221764
2014-11-12 03:44:43 +00:00
Richard Smith 775118a28b Try a different workaround for GCC 4.7.2 lambda capture bug. The previous
workaround took us from wrong-code to ICE.

llvm-svn: 221754
2014-11-12 02:09:03 +00:00
Richard Smith 2e32155b58 Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate
these at all! This also covers the pathological case where the only mention of
a parameter pack is within the exception specification; this gives us a second
way (other than alias templates) to reach the horrible state where a type
contains an unexpanded pack, but its canonical type does not.


This is a re-commit of r219977:

r219977 was reverted in r220038 because it hit a wrong-code bug in GCC 4.7.2.
(That's gcc.gnu.org/PR56135, and affects any implicit lambda-capture of
'this' within a template.)


r219977 was a re-commit of r217995, r218011, and r218053:

r217995 was reverted in r218058 because it hit a rejects-valid bug in MSVC.
(Incorrect overload resolution in the presence of using-declarations.)
It was re-committed in r219977 with a workaround for the MSVC rejects-valid.

r218011 was a workaround for an MSVC parser bug. (Incorrect desugaring of
unbraced range-based for loop).

llvm-svn: 221750
2014-11-12 02:00:47 +00:00
Richard Smith d8a52a7831 PR21536: Fix a corner case where we'd get confused by a pack expanding into the
penultimate parameter of a template parameter list, where the last parameter is
itself a pack, and build a bogus empty final pack argument.

llvm-svn: 221748
2014-11-12 01:43:45 +00:00
Richard Smith 17c00b4328 Fix this code to follow the coding style regarding anonymous namespaces and
static functions. Make a bunch of file-local functions static. Remove one
unused static function revealed by this.

llvm-svn: 221745
2014-11-12 01:24:00 +00:00
Douglas Gregor 64c7d45292 Make Sema::CollectMultipleMethodsInGlobalPool() public.
It's useful for out-of-tree clients to be able to query the global
Objective-C method pool, and only Sema can do that right now.

llvm-svn: 221744
2014-11-12 01:12:47 +00:00
NAKAMURA Takumi 12fb0057d1 clang/test/CodeGenCXX/debug-info-cxx1y.cpp: Add %itanium_abi_triple for incompatible MS targets.
llvm-svn: 221741
2014-11-11 23:51:53 +00:00
Kostya Serebryany 4133eabb45 [clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field-padding >= 1
Summary: If we've added poisoned paddings to a type do not emit memcpy for operator=.

Test Plan: regression tests.

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6160

llvm-svn: 221739
2014-11-11 23:38:13 +00:00
Kaelyn Takata 2e764b83aa Have LookupMemberExprInRecord only call CorrectTypoDelayed, dropping the
code for calling CorrectTypo.

Includes a needed fix for non-C++ code to not choke on TypoExprs (which
also resolves a TODO from r220698).

llvm-svn: 221736
2014-11-11 23:26:58 +00:00
Kaelyn Takata 49d84328d9 Create two helpers for running the typo-correction tree transform.
One takes an Expr* and the other is a simple wrapper that takes an
ExprResult instead, and handles checking whether the ExprResult is
invalid.

Additionally, allow an optional callback that is run on the full result
of the tree transform, for filtering potential corrections based on the
characteristics of the resulting expression once all of the typos have
been replaced.

llvm-svn: 221735
2014-11-11 23:26:56 +00:00
Kaelyn Takata 5c3dc4be08 Replace MemberTypoDiags and MemberExprTypoRecovery with lambdas.
llvm-svn: 221734
2014-11-11 23:26:54 +00:00
Kaelyn Takata 7fe6f03c3a Remove unnecessary semicolon.
llvm-svn: 221732
2014-11-11 23:17:30 +00:00
Daniel Jasper 3eb341c478 clang-format: Improve handling of comments in binary expressions.
Before:
  b = a &&
      // Comment
      b.c &&
      d;

After:
  b = a &&
      // Comment
      b.c && d;

This fixes llvm.org/PR21535.

llvm-svn: 221727
2014-11-11 23:04:51 +00:00
Kaelyn Takata fc8c61a5b8 Make LookupResult be copyable to avoid decomposing an existing one and
initializing a new one every time a copy is needed.

llvm-svn: 221724
2014-11-11 23:00:42 +00:00
Kaelyn Takata e9e4ecfe9e Explicitly exclude keywords from the member validator.
Also simply and remove dead code from MemberExprTypoRecovery.

llvm-svn: 221723
2014-11-11 23:00:40 +00:00
Kaelyn Takata db99de2d15 Fix some formatting prior to refactoring the code.
llvm-svn: 221722
2014-11-11 23:00:38 +00:00
Kostya Serebryany 75b4f9e1e6 Introduce -fsanitize-coverage=N flag
Summary:
This change makes the asan-coverge (formerly -mllvm -asan-coverge)
accessible via a clang flag.
Companion patch to LLVM is http://reviews.llvm.org/D6152

Test Plan: regression tests, chromium

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6153

llvm-svn: 221719
2014-11-11 22:15:07 +00:00
Alexey Samsonov e396bfc064 Bundle conditions checked by UBSan with sanitizer kinds they implement.
Summary:
This change makes CodeGenFunction::EmitCheck() take several
conditions that needs to be checked (all of them need to be true),
together with sanitizer kinds these checks are for. This would allow
to split one call into UBSan runtime into several calls in case
different sanitizer kinds would have different recoverability
settings.

Tests should be fixed accordingly, I'm working on it.

Test Plan: regression test suite.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6219

llvm-svn: 221716
2014-11-11 22:03:54 +00:00
Fariborz Jahanian 902edb9a2b Remove this test too.
llvm-svn: 221715
2014-11-11 21:54:53 +00:00
Fariborz Jahanian 3365bfc609 Revert r221702 until I address Richard Trieu's
comments.

llvm-svn: 221714
2014-11-11 21:54:19 +00:00
Alexey Samsonov cfc9d3fe17 Simplify the test by using multiple --check-prefix arguments
llvm-svn: 221713
2014-11-11 21:50:44 +00:00
Duncan P. N. Exon Smith 2b1f278e77 Revert "IR: MDNode => Value: Update for LLVM API change in r221375"
This reverts commit r221376.

The API change was reverted in r221711.

llvm-svn: 221712
2014-11-11 21:31:03 +00:00
David Blaikie 42edade9d9 PR16091 continued: Debug Info for member functions with undeduced return types.
So DWARF5 specs out auto deduced return types as DW_TAG_unspecified_type
with DW_AT_name "auto", and GCC implements this somewhat, but it
presents a few problems to do this with Clang.

GCC's implementation only applies to member functions where the auto
return type isn't deduced immediately (ie: member functions of templates
or member functions defined out of line). In the common case of an
inline deduced return type function, GCC emits the DW_AT_type as the
deduced return type.

Currently GDB doesn't seem to behave too well with this debug info - it
treats the return type as 'void', even though the definition of the
function has the correctly deduced return type (I guess it sees the
return type the declaration has, doesn't understand it, and assumes
void). This means the function's ABI might be broken (non-trivial return
types, etc), etc.

Clang, on the other hand doesn't track this particular case of a
deducable return type that is deduced immediately versus one that is
deduced 'later'. So if we implement the DWARF5 representation, all
deducible return type functions would get adverse GDB behavior
(including deduced return type lambda functions, inline deduced return
type functions, etc).

Also, we can't just do this for auto types that are not deduced -
because Clang marks even the declaration's return type as deduced (&
provides the underlying type) once a definition is seen that allows the
deduction. So we have to ignore even deduced types - but we can't do
that for auto variables (because this representation only applies to
function declarations - variables and function definitions need the real
type so the function can be called, etc) so we'd need to add an extra
flag to the type unwrapping/creation code to indicate when we want to
see through deduced types and when we don't. It's also not as simple as
just checking at the top level when building a function type (for one
thing, we reuse the function type building for building function pointer
types which might also have 'auto' in them - but be the type of a
variable instead) because the auto might be arbitrarily deeply nested
("auto &", "auto (*)()", etc...)

So, with all that said, let's do the simple thing that works in existing
debuggers for now and treat these functions the same way we do function
templates and implicit special members: omit them from the member list,
since they can't be correctly called anyway (without knowing the return
type the ABI isn't know and a function call could put the arguments in
the wrong place) so they're not much use to the user.

At some point in the future, when GDB understands the DWARF5
representation better it might be worth plumbing through the extra type
builder handling to avoid looking through AutoType for some callers,
etc...

llvm-svn: 221704
2014-11-11 20:44:45 +00:00
Fariborz Jahanian c5fd4844da Patch to warn when logical evaluation of operand evalutes to a true value;
That this is a c-only patch. c++ already has this warning.
This addresses rdar://18716393

llvm-svn: 221702
2014-11-11 19:59:16 +00:00
Daniel Jasper 64a328e96f clang-format: Preserve trailing-comma logic even with comments.
Before:
  vector<int> SomeVector = {// aaa
                            1, 2,
  };

After:
  vector<int> SomeVector = {
      // aaa
      1, 2,
  };

llvm-svn: 221699
2014-11-11 19:34:57 +00:00
Richard Smith 57e18ac96d First half of CWG1962: decltype(__func__) should not be a reference type,
because __func__ is supposed to act like a local static variable.

llvm-svn: 221698
2014-11-11 19:30:41 +00:00
Fariborz Jahanian a29986c0b0 This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to  something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
(patch reapplied after lldb issue was fixed in r221660).

llvm-svn: 221691
2014-11-11 16:56:21 +00:00
Manuel Klimek 6dffa35ddd DiagnosticParseKinds is close to running into DiagnosticASTKinds.
$ grep "def " include/clang/Basic/DiagnosticParseKinds.td |wc -l
396

llvm-svn: 221688
2014-11-11 15:45:49 +00:00
NAKAMURA Takumi cdcbfba3b6 CGOpenMPRuntime.h: Fix a couple of \param(s) introduced in r221663. [-Wdocumentation]
llvm-svn: 221676
2014-11-11 07:58:06 +00:00
Alexey Bataev 9772000a22 [OPENMP] Codegen for threadprivate variables
For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); 
In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>);
Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info.
Differential Revision: http://reviews.llvm.org/D4002

llvm-svn: 221663
2014-11-11 04:05:39 +00:00
Richard Smith ea97e36dfc Fix parsing of fold-expressions within a cast expression. We parse the
parenthesized expression a bit differently in this case, just in case the
commas have special meaning.

llvm-svn: 221661
2014-11-11 03:28:50 +00:00
Justin Bogner 4cb85f36ca InstrProf: Remove an unnecessary helper function (NFC)
VisitSubStmtRBraceState is really just Visit, as long as
VisitCompoundStatement handles braces correctly.

llvm-svn: 221659
2014-11-11 02:47:05 +00:00
NAKAMURA Takumi 17d6094d14 CGExpr.cpp: Suppress a warning. [-Wunused-variable]
llvm-svn: 221655
2014-11-11 01:36:11 +00:00