Commit Graph

51553 Commits

Author SHA1 Message Date
Richard Smith d7b2a9ebd1 PR19249: Don't forget to DiagnoseUseOfDecl for the implicit use of a variable
in a lambda capture.

llvm-svn: 204757
2014-03-25 21:11:32 +00:00
David Blaikie f596145ac5 Use an option alias to implement -gmlt
Review feedback from Reid Kleckner on r203603.

llvm-svn: 204755
2014-03-25 20:42:27 +00:00
Reid Kleckner 83055ade75 -fms-compatibility: Only form implicit member exprs for unqualified ids
If there are any scope specifiers, then a base class must be named or
the symbol isn't from a base class.

Fixes PR19233.

llvm-svn: 204753
2014-03-25 20:31:28 +00:00
Reid Kleckner d0fe317e0c MS ABI: Mark direct virtual bases as visted when building vtable paths
Fixes PR19240.  In retrospect, this is a fairly obvious bug.  :)

llvm-svn: 204744
2014-03-25 18:33:27 +00:00
Benjamin Kramer ab88f62614 Fix an logic error in the clang driver preventing crtfastmath.o from linking when -Ofast is used without -ffast-math
In gcc using -Ofast forces linking of crtfastmath.o.
In the current clang crtfastmath.o is only linked when -ffast-math/-funsafe-math-optimizations passed. It can lead to performance issues, when using only -Ofast without explicit -ffast-math (I faced with it).
My patch fixes inconsistency with gcc behaviour and also introduces few tests on it.

Patch by Zinovy Nis!

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

llvm-svn: 204742
2014-03-25 18:02:07 +00:00
Hans Wennborg d8d49ba20e clang-cl: make /Gy imply -fdata-sections in addition to -ffunction-sections
llvm-svn: 204736
2014-03-25 17:50:25 +00:00
Jordan Rose b3ad07e0a6 [analyzer] Don't track retain counts of objects directly accessed through ivars.
A refinement of r198953 to handle cases where an object is accessed both through
a property getter and through direct ivar access. An object accessed through a
property should always be treated as +0, i.e. not owned by the caller. However,
an object accessed through an ivar may be at +0 or at +1, depending on whether
the ivar is a strong reference. Outside of ARC, we don't have that information,
so we just don't track objects accessed through ivars.

With this change, accessing an ivar directly will deliberately override the +0
provided by a getter, but only if the +0 hasn't participated in other retain
counting yet. That isn't perfect, but it's already unusual for people to be
mixing property access with direct ivar access. (The primary use case for this
is in setters, init methods, and -dealloc.)

Thanks to Ted for spotting a few mistakes in private review.

<rdar://problem/16333368>

llvm-svn: 204730
2014-03-25 17:10:58 +00:00
Hans Wennborg 5149a3b837 clang-cl: Forward /Gy or /Gy- when falling back to cl.exe
llvm-svn: 204723
2014-03-25 14:48:54 +00:00
Manuel Klimek ce68f7714a Fixes a bug in DynTypedNode.
Two DynTypedNodes can be equal if they do not have the same node type,
because DynTypedNodes for the same underlying object might have been
created from different types (for example, Decl vs VarDecl).

llvm-svn: 204722
2014-03-25 14:39:26 +00:00
Daniel Jasper a65e887587 clang-format: Fix incorrect &/* detection.
Before:
  STATIC_ASSERT((a &b) == 0);

After:
  STATIC_ASSERT((a & b) == 0);

llvm-svn: 204709
2014-03-25 10:52:45 +00:00
Richard Smith 399a6035e0 Remove redundant and misleading check. This could also lead to painful cyclic
deserialization.

llvm-svn: 204695
2014-03-25 01:22:22 +00:00
Richard Smith 961eae5f95 Save out a correct lookup table if a lookup table entry is stale (it contains
an out-of-date external decls list). This happens if we declare some names,
force the lookup table for the decl context to be built, import a module that
adds more decls for the name, then write out our module without looking up the
name.

llvm-svn: 204694
2014-03-25 01:14:22 +00:00
Richard Smith a8b7459115 If a DeclContext's lookups need to be reconciled, and we're given external declarations for a name, reconcile first. Otherwise, when we come to reconcile, we'll ask for external declarations for that name again. No functionality change intended.
llvm-svn: 204692
2014-03-25 00:34:21 +00:00
Richard Smith 05332ab354 Simplify: don't try to complete the list of decls twice when iterating over the
lookups for a DeclContext.

llvm-svn: 204691
2014-03-25 00:27:18 +00:00
Richard Smith 750f511f11 Fix a bug where an explicit instantiation declaration of a class template
specialization would make us think it might have a key function.

llvm-svn: 204686
2014-03-24 23:54:09 +00:00
Eli Bendersky cb39943f6f Proper handling of static local variables with address space qualifiers.
Similar to the implementation for globals in r157167.

Patch by Jingyue Wu.

llvm-svn: 204677
2014-03-24 22:05:38 +00:00
David Majnemer 58e5bee17a MS ABI: Eliminate Duplicate Strings
COFF doesn't have mergeable sections so LLVM/clang's normal tactics for
string deduplication will not have any effect.

To remedy this we place each string inside it's own section and mark
the section as IMAGE_COMDAT_SELECT_ANY.  However, we can only do this if the
string has an external name that we can generate from it's contents.

To be compatible with MSVC, we must use their scheme.  Otherwise identical
strings in translation units from clang may not be deduplicated with
translation units in MSVC.

This fixes PR18248.

N.B. We will not attempt to do anything with a string literal which is not of
type 'char' or 'wchar_t' because their compiler does not support unicode
string literals as of this date.  Further, we avoid doing this if
either -fwritable-strings or -fsanitize=address are present.

This reverts commit r204596.

llvm-svn: 204675
2014-03-24 21:43:36 +00:00
Warren Hunt c89450e054 [MS-ABI] Drop Special Layout in 64-bit mode.
As of cl.exe version 18, the special layout rules for structs with 
alignment 16 or greater has been dropped.  This patch drops the behavior 
from clang.  This patch also updates the lit tests to reflect the 
change.

llvm-svn: 204674
2014-03-24 21:37:27 +00:00
Adrian Prantl 9b963516a3 Cleanup testcase by adding return statements and replacing CHECK-DAG's with
plain old CHECKs.

Follow-up to r204633.

llvm-svn: 204670
2014-03-24 21:19:34 +00:00
Will Schmidt 5fa50f3c57 Update the powerpc64le check to include CALL_ELF=2 check.
This is a testcase follow-up to r204627.
(see also r204614 for CALL_ELF usage).

llvm-svn: 204669
2014-03-24 21:09:16 +00:00
Aaron Ballman 69e6e7c604 Capability attributes can now be declared on a typedef declaration as well as a structure declaration. This allows for C code to use Boolean expressions on a capability as part of another attribute. Eg) __attribute__((requires_capability(!SomeCapability)))
llvm-svn: 204657
2014-03-24 19:29:19 +00:00
Bob Wilson 5c65065605 Use CHECK-DAG in a test so that it isn't sensitive to metadata order.
This was failing on an internal branch where the order was different for
some reason. <rdar://problem/16407581>

llvm-svn: 204633
2014-03-24 18:14:15 +00:00
Will Schmidt 22d2435a00 [PPC64LE] Add a CALL_ELF macro to indicate use of the ELFv2 ABI.
Additional clarification from Uli for the background on _CALL_ELF:
"Historically GCC has provided various _CALL_... predefines depending on the
ABI currently being compiled for. (_CALL_SYSV,_CALL_AIXDESC, _CALL_DARWIN )
When we needed a new define for the current ABI, we decided on using _CALL_ELF
since the official name of the ABI is the OpenPower ElfV2 ABI, with the
current Linux ABI retro-actively being renamed the ELFv1 ABI
and so we decided on using _CALL_ELF to identify the Linux (+BSD etc.) ELF ABI,
with _CALL_ELF=1 for the v1 ABI and _CALL_ELF=2 for the v2 ABI.
(Note that this matches the gcc compiler switch -mabi=elfv1 vs. -mabi=elfv2)."

In code, a (_CALL_ELF==2) check will indicate when the ELFv2 ABI is
to be used.   This is the desired default for the PPC64 LE target.

llvm-svn: 204627
2014-03-24 17:27:03 +00:00
Will Schmidt c1fc190913 Update the parameters passed to the assembler and linker for
the PPC64LE target.  Specifically:
(assembler) adds/uses  -mppc64 -mlittle-endian
(linker) adds/uses  elf64lppc

Testcase included.

llvm-svn: 204626
2014-03-24 17:10:37 +00:00
Will Schmidt 0c67b7e3f2 Update DataLayout/DescriptionString for ppc64le
Update DataLayout/DescriptionString for ppc64le

Similar LLVM change made in r203664

Testcase included.

llvm-svn: 204613
2014-03-24 15:48:02 +00:00
Christian Pirker 227f5ed547 AArch64_BE test case for predefined macros
llvm-svn: 204604
2014-03-24 13:57:21 +00:00
Timur Iskhodzhanov f7af2e6de8 Fix a compile-time warning
lib/CodeGen/CGBuiltin.cpp:3136:12: warning: variable ‘TblPos’ set but not used [-Wunused-but-set-variable]

llvm-svn: 204599
2014-03-24 11:09:01 +00:00
Timur Iskhodzhanov 89f588ff73 Revert r204562,204566,204586,204587 as they broke ASan on Windows
llvm-svn: 204596
2014-03-24 10:31:09 +00:00
David Majnemer 85d52db46b Driver: Fix a typo in a command line description
Thanks to Richard Smith for catching this!

llvm-svn: 204588
2014-03-24 05:53:13 +00:00
David Majnemer 914d8c0f48 CodeGen: Remove unneeded directives
Use two check-prefix patterns per FileCheck invocation for these tests,
this cleanly removes redundant CHECK directives.

Thanks to Richard Smith for the idea!

llvm-svn: 204587
2014-03-24 05:53:11 +00:00
David Majnemer 96bc4b0367 MS ABI: Add tests, other cleanups for r204562
This commit cleans up a few accidents:
- Do not rely on the order in which StringLiteral lays out bytes.
- Use a more efficient mechanism for handling so-called
  "special-mappings" when mangling string literals.
- There is no need to allocate a copy of the mangled name.
- Add the test written for r204562.

Thanks to Richard Smith for pointing these out!

llvm-svn: 204586
2014-03-24 05:53:08 +00:00
Benjamin Kramer f3f0b96abd Remove unused diagnostic.
llvm-svn: 204578
2014-03-23 23:06:04 +00:00
Nico Rieck 0854e59281 Fix tests in r204576
Proper redeclaration warnings for dllimport are not implemented yet.

llvm-svn: 204577
2014-03-23 22:07:53 +00:00
Nico Rieck e84f8db709 Treat dllimport globals without explicit storage class as extern
dllimport implies a definition which means the 'extern' keyword is optional
when declaring imported variables.

llvm-svn: 204576
2014-03-23 21:24:01 +00:00
Richard Smith eb8cc3d454 Add missing file from r204570.
llvm-svn: 204574
2014-03-23 21:01:41 +00:00
Richard Smith ecf74ff40a Consistently dump default template arguments for template parameters as 'TemplateArgument's.
llvm-svn: 204572
2014-03-23 20:50:39 +00:00
Richard Smith e3a97029da If a name is injected into an imported inline namespace without reopening that
namespace, we need to update both the visible names of that namespace and of
its enclosing namespace set.

llvm-svn: 204570
2014-03-23 20:41:56 +00:00
Arnaud A. de Grandmaison 6756a497a1 Cleanup dead assignments reported by scan-build
llvm-svn: 204569
2014-03-23 20:28:07 +00:00
Richard Smith 561e0dce59 When we inject a declaration into a namespace, add the primary DeclContext to
the update set rather than the current DeclContext. Add test for the local
extern case too.

llvm-svn: 204568
2014-03-23 19:45:26 +00:00
Timur Iskhodzhanov f599d6f957 Simplify test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp by forcing VFTableBuilder invocation with virtual function calls or constructors codegen
Previously the vftables were built at the end of the TU in a reverse-to-random order

llvm-svn: 204567
2014-03-23 19:09:08 +00:00
David Majnemer b46a017248 CodeGen: Make string tests exercise the MS ABI
r204562 unwittingly failed tests for some bots.  Make those tests work
with both the Itanium and MS ABIs.

llvm-svn: 204566
2014-03-23 18:22:10 +00:00
David Majnemer da39ab299a Driver: Map /Gy to -ffunction-sections
/Gy is equivalent to -ffunction-sections.
/Gy- is equivalent to -fno-function-sections.

Currently, LLVM doesn't do anything interesting with -ffunction-sections
under WinCOFF.

llvm-svn: 204564
2014-03-23 17:47:22 +00:00
David Majnemer ca11641a41 Driver: cleanup /vd2 test
/vd2 is not ignored anymore, remove it from the ignored list.

Add a test to ensure that it does the right thing.

llvm-svn: 204563
2014-03-23 17:47:18 +00:00
David Majnemer 3843a05edf MS ABI: Eliminate Duplicate Strings
COFF doesn't have mergeable sections so LLVM/clang's normal tactics for
string deduplication will not have any effect.

To remedy this we place each string inside it's own section and mark
the section as IMAGE_COMDAT_SELECT_ANY.  However, we can only do this if the
string has an external name that we can generate from it's contents.

To be compatible with MSVC, we must use their scheme.  Otherwise identical
strings in translation units from clang may not be deduplicated with
translation units in MSVC.

This fixes PR18248.

N.B. We will not attempt to do anything with a string literal which is not of
type 'char' or 'wchar_t' because their compiler does not support unicode
string literals as of this date.

llvm-svn: 204562
2014-03-23 17:47:16 +00:00
Nuno Lopes fb744589bc remove a bunch of unused private methods
found with a smarter version of -Wunused-member-function that I'm playwing with.
Appologies in advance if I removed someone's WIP code.

 ARCMigrate/TransProperties.cpp                  |    8 -----
 AST/MicrosoftMangle.cpp                         |    1 
 Analysis/AnalysisDeclContext.cpp                |    5 ---
 Analysis/LiveVariables.cpp                      |   14 ----------
 Index/USRGeneration.cpp                         |   10 -------
 Sema/Sema.cpp                                   |   33 +++++++++++++++++++++---
 Sema/SemaChecking.cpp                           |    3 --
 Sema/SemaDecl.cpp                               |   20 ++------------
 StaticAnalyzer/Checkers/GenericTaintChecker.cpp |    1 
 9 files changed, 34 insertions(+), 61 deletions(-)

llvm-svn: 204561
2014-03-23 17:12:37 +00:00
Richard Smith c264d35adc If a template instantation introduces a name into a namespace, we need to write
out a visible update record for that namespace even if it was never declared in
this module.

llvm-svn: 204554
2014-03-23 02:30:01 +00:00
Richard Smith 04d05b5fa7 If an update record makes a declaration interesting, pass it to the consumer.
llvm-svn: 204550
2014-03-23 00:27:18 +00:00
Richard Smith d28ac5b998 Emit an update record if we instantiate the definition of a function template
specialization from a module. (This can also happen for function template
specializations in PCHs if they're instantiated eagerly, because they're
constexpr or have a deduced return type.)

llvm-svn: 204547
2014-03-22 23:33:22 +00:00
NAKAMURA Takumi 06246f10cd Revert r204493, "Make clang/test/lit.cfg pre-scan the RUN line looking for tool names,"
It was incompatible to standlalone clang build.

llvm-svn: 204539
2014-03-22 04:46:59 +00:00
Richard Smith 0ac1b8fd07 Refactor: move loading pending instantiations from chained PCHs to a more appropriate place, so that we only ask the external source once.
llvm-svn: 204535
2014-03-22 01:43:32 +00:00