]> granicus.if.org Git - clang/log
clang
10 years agoMS ABI: Don't ICE for pointers to pointers to members of incomplete classes
David Majnemer [Thu, 18 Sep 2014 22:05:54 +0000 (22:05 +0000)]
MS ABI: Don't ICE for pointers to pointers to members of incomplete classes

CodeGen would try to come up with an LLVM IR type for a pointer to
member type on the way to forming an LLVM IR type for a pointer to
pointer to member type.

However, if the pointer to member representation has not been locked in yet,
we would not be able to come up with a pointer to member IR type.

In these cases, make the pointer to member type an incomplete type.
This will make the pointer to pointer to member type a pointer to an
incomplete type.  If the class eventually obtains an inheritance model,
we will make the pointer to member type represent the actual inheritance
model.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218084 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[X86, inlineasm] Do not allow using constraint 'x' for a variable larger than
Akira Hatanaka [Thu, 18 Sep 2014 21:58:54 +0000 (21:58 +0000)]
[X86, inlineasm] Do not allow using constraint 'x' for a variable larger than
128-bit unless the target CPU supports AVX.

rdar://problem/11846140

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218082 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[X86, inline-asm] Allow 256-bit wide operands for the 'x' constraints
Hans Wennborg [Thu, 18 Sep 2014 20:24:04 +0000 (20:24 +0000)]
[X86, inline-asm] Allow 256-bit wide operands for the 'x' constraints

The 'x' constraint is for "any SSE register", and GCC seems to include the
256-bit ymm registers in that concept.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218073 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[X86, inlineasm] Check that the output size is correct for the given constraint.
Akira Hatanaka [Thu, 18 Sep 2014 18:17:18 +0000 (18:17 +0000)]
[X86, inlineasm] Check that the output size is correct for the given constraint.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218064 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoPatch to check at compile time for overflow when
Fariborz Jahanian [Thu, 18 Sep 2014 17:58:27 +0000 (17:58 +0000)]
Patch to check at compile time for overflow when
__builtin___memcpy_chk and similar builtins are
being used. Patch by Jacques Fortier (with added
clang tests).  rdar://11076881

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218063 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRevert r217995 and follow-ups:
Hans Wennborg [Thu, 18 Sep 2014 16:01:32 +0000 (16:01 +0000)]
Revert r217995 and follow-ups:

r218053: Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
r218011: Work around MSVC parser bug by putting redundant braces around the body of
r217997: Skip parens when detecting whether we're instantiating a function declaration.
r217995: Instantiate exception specifications when instantiating function types (other

The Windows build was broken for 16 hours and no one had any good ideas of how to
fix it. Reverting for now to make the builders green. See the cfe-commits thread [1] for
more info.

This was the build error (from [2]):

C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1590) : error C2668: '`anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType' : ambiguous call to overloaded function
        C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1313): could be 'clang::QualType `anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)'
        with
        [
            Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>
        ]
        c:\bb-win7\ninja-clang-i686-msc17-r\llvm-project\clang\lib\sema\TreeTransform.h(4532): or       'clang::QualType clang::TreeTransform<Derived>::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)'
        with
        [
            Derived=`anonymous-namespace'::TemplateInstantiator,
            Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>
        ]
        while trying to match the argument list '(clang::TypeLocBuilder, clang::FunctionProtoTypeLoc, clang::CXXRecordDecl *, unsigned int, clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>)'

 1. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140915/115011.html
 2. http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/10515/steps/build_clang_tools_1/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218058 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUse exceptions() instead of getNumExceptions()/getExceptionType() to avoid
Alexander Kornienko [Thu, 18 Sep 2014 15:19:53 +0000 (15:19 +0000)]
Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
accesses to incorrect exception types when getExceptionSpecType() != EST_Dynamic

This fixes a crash in test/CXX/except/except.spec/template.cpp that happens in
certain build configurations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218053 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoParsing/Sema of directive omp for simd
Alexander Musman [Thu, 18 Sep 2014 05:12:34 +0000 (05:12 +0000)]
Parsing/Sema of directive omp for simd

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218029 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoWork around MSVC parser bug by putting redundant braces around the body of
Richard Smith [Thu, 18 Sep 2014 03:49:06 +0000 (03:49 +0000)]
Work around MSVC parser bug by putting redundant braces around the body of
this range-based for loop.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218011 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoBasic: use hex string for __ARM_FP macro
Saleem Abdulrasool [Thu, 18 Sep 2014 02:13:33 +0000 (02:13 +0000)]
Basic: use hex string for __ARM_FP macro

The ARM ACLE describes the values as hex constants rather than numeric
constants; follow suit.  Address post-commit review comments from Jon Roelofs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218009 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoChange -Wbind-to-temporary-copy from an ExtWarn to an Extension.
Nico Weber [Thu, 18 Sep 2014 02:09:53 +0000 (02:09 +0000)]
Change -Wbind-to-temporary-copy from an ExtWarn to an Extension.

The reasoning is that this construct is accepted by all compilers and valid in
C++11, so it doesn't seem like a useful warning to have enabled by default.
Building with -pedantic, -Wbind-to-temporary-copy, or -Wc++98-compat still
shows the warning.

The motivation is that I built re2, and this was the only warning that was
emitted during the build. Both changing re2 to fix the warning and detecting
clang and suppressing the warning in re2's build seem inferior than just giving
the compiler a good default for this warning.

Also move the cxx98compat version of this warning to CXX98CompatPedantic, and
update tests accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218008 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoSema: Diagnose undefined structs used as Microsoft anonymous structs
David Majnemer [Thu, 18 Sep 2014 00:42:05 +0000 (00:42 +0000)]
Sema: Diagnose undefined structs used as Microsoft anonymous structs

Previously, we would not mark structs containing anonymous structs as
invalid.  Later, horrific things would occur when trying to determine
the size of the parent record.

Instead, require the struct to be a complete type when used as an
anonymous struct.  Mark both the anonymous field for the struct and the
parent context as invalid (this is similar to what we do when a struct
contains a field with an incomplete type.)

This fixes PR11847.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218006 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix test case.
Akira Hatanaka [Thu, 18 Sep 2014 00:29:04 +0000 (00:29 +0000)]
Fix test case.

This is another follow-up patch to r217996.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218003 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoSkip parens when detecting whether we're instantiating a function declaration.
Richard Smith [Thu, 18 Sep 2014 00:12:09 +0000 (00:12 +0000)]
Skip parens when detecting whether we're instantiating a function declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217997 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix test case.
Akira Hatanaka [Thu, 18 Sep 2014 00:04:10 +0000 (00:04 +0000)]
Fix test case.

This is a follow-up to r217994.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217996 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoInstantiate exception specifications when instantiating function types (other
Richard Smith [Wed, 17 Sep 2014 23:57:05 +0000 (23:57 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217995 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[X86, inline-asm] Check that the input size is correct for constraints R, q, Q,
Akira Hatanaka [Wed, 17 Sep 2014 23:35:14 +0000 (23:35 +0000)]
[X86, inline-asm] Check that the input size is correct for constraints R, q, Q,
S, D, A, y, x, f, t, and u.

This is a follow-up patch for r167717.

rdar://problem/11846140
rdar://problem/17476970

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217994 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoBasic: add support for ARM ACLE 6.5.1
Saleem Abdulrasool [Wed, 17 Sep 2014 14:50:27 +0000 (14:50 +0000)]
Basic: add support for ARM ACLE 6.5.1

Extend ARM ACLE support (Section 6.5.1) for AArch32.  Define __ARM_FP if
hardware floating point support is available as per the value defined by the
ACLE.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217957 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoBasic: use range-based for loops for ARM target
Saleem Abdulrasool [Wed, 17 Sep 2014 14:50:23 +0000 (14:50 +0000)]
Basic: use range-based for loops for ARM target

Tweak handleTargetFeature for the ARM(32) target to use range based for loops.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217956 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoBasic: whitespace fixup for ARM target info
Saleem Abdulrasool [Wed, 17 Sep 2014 14:50:19 +0000 (14:50 +0000)]
Basic: whitespace fixup for ARM target info

Fix whitespace.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217955 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDon't try to devirtualize non-virtual calls
Reid Kleckner [Tue, 16 Sep 2014 22:23:33 +0000 (22:23 +0000)]
Don't try to devirtualize non-virtual calls

We would end up marking the vtable of the derived class as used for no
reason. Because the call itself is qualified, it is never virtual, and
the vtable of the derived class isn't helpful. We would end up rejecting
code that MSVC accepts for no benefit.

See http://crbug.com/413478

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217910 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDon't try to use C5/D5 comdats in COFF.
Rafael Espindola [Tue, 16 Sep 2014 20:19:43 +0000 (20:19 +0000)]
Don't try to use C5/D5 comdats in COFF.

This should fix the mingw bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217897 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix forwarding -l to MSVC's link.exe
Reid Kleckner [Tue, 16 Sep 2014 19:22:00 +0000 (19:22 +0000)]
Fix forwarding -l to MSVC's link.exe

Translate -lfoo to -lfoo.lib while making sure that -lfoo.lib stays as
-lfoo.lib. Also, these arguments were being passed twice: once
explicitly via AddAllArgs, and again implicitly as linker inputs. Now
they are passed once.

Fixes PR20868.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217895 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-format: Allow unbroken ::: in inline assembly.
Daniel Jasper [Tue, 16 Sep 2014 16:36:57 +0000 (16:36 +0000)]
clang-format: Allow unbroken ::: in inline assembly.

Before:
  asm volatile("nop" :: : "memory");

After:
  asm volatile("nop" ::: "memory");

Patch by Eugene Toder. Thank you.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217883 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-format: Restructure and add missing tests.
Daniel Jasper [Tue, 16 Sep 2014 16:22:30 +0000 (16:22 +0000)]
clang-format: Restructure and add missing tests.

Patch by Jean-Philippe Dufraigne, Thank you!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217880 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd support for putting constructors and destructos in explicit comdats.
Rafael Espindola [Tue, 16 Sep 2014 15:18:21 +0000 (15:18 +0000)]
Add support for putting constructors and destructos in explicit comdats.

There are situations when clang knows that the C1 and C2 constructors
or the D1 and D2 destructors are identical. We already optimize some
of these cases, but cannot optimize it when the GlobalValue is
weak_odr.

The problem with weak_odr is that an old TU seeing the same code will
have a C1 and a C2 comdat with the corresponding symbols. We cannot
suddenly start putting the C2 symbol in the C1 comdat as we cannot
guarantee that the linker will not pick a .o with only C1 in it.

The solution implemented by GCC is to expand the ABI to have a comdat
whose name uses a C5/D5 suffix and always has both symbols. That is
what this patch implements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217874 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[sphinx cleanup]
Dan Liew [Tue, 16 Sep 2014 08:44:27 +0000 (08:44 +0000)]
[sphinx cleanup]
Fix warning introduced by r211098.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217864 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDriver: use range based for loop
Saleem Abdulrasool [Tue, 16 Sep 2014 03:48:32 +0000 (03:48 +0000)]
Driver: use range based for loop

Use a couple more range based for loops.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217857 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoReject a slightly-sneaky way to perform a read of mutable state from within a
Richard Smith [Tue, 16 Sep 2014 01:24:02 +0000 (01:24 +0000)]
Reject a slightly-sneaky way to perform a read of mutable state from within a
constexpr function. Part of this fix is a tentative fix for an as-yet-unfiled
core issue (we're missing a prohibition against reading mutable members from
unions via a trivial constructor/assignment, since that doesn't perform an
lvalue-to-rvalue conversion on the members).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217852 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoTests for DR581-600.
Richard Smith [Mon, 15 Sep 2014 22:56:03 +0000 (22:56 +0000)]
Tests for DR581-600.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217844 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoPR19692: Add (passing) regression test.
Richard Smith [Mon, 15 Sep 2014 22:14:48 +0000 (22:14 +0000)]
PR19692: Add (passing) regression test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217836 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUnique_ptrify Preprocessor::PragmaHandlersBackup
David Blaikie [Mon, 15 Sep 2014 21:31:42 +0000 (21:31 +0000)]
Unique_ptrify Preprocessor::PragmaHandlersBackup

Follow up to r217656

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217829 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C. Prevents a crash generating AST for a
Fariborz Jahanian [Mon, 15 Sep 2014 21:19:39 +0000 (21:19 +0000)]
Objective-C. Prevents a crash generating AST for a
a property assignment due to numerous user errors.
Cannot come up with a reasonable test case due to
array of user errors before the crash point.
rdar://17813651.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217825 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMajor rewrite of linking strategy for sanitizer runtimes on Linux.
Alexey Samsonov [Mon, 15 Sep 2014 19:58:40 +0000 (19:58 +0000)]
Major rewrite of linking strategy for sanitizer runtimes on Linux.

Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.

Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.

Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217817 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoReduce code duplication a bit more. NFC.
Rafael Espindola [Mon, 15 Sep 2014 19:43:47 +0000 (19:43 +0000)]
Reduce code duplication a bit more. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217813 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoReduce code duplication a bit more. NFC.
Rafael Espindola [Mon, 15 Sep 2014 19:34:18 +0000 (19:34 +0000)]
Reduce code duplication a bit more. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217811 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoSimplify the code a bit, NFC.
Rafael Espindola [Mon, 15 Sep 2014 19:24:44 +0000 (19:24 +0000)]
Simplify the code a bit, NFC.

hasConstructorVariants is always true for MS and false for Itanium.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217809 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMove emitCXXStructor to CGCXXABI.
Rafael Espindola [Mon, 15 Sep 2014 19:20:10 +0000 (19:20 +0000)]
Move emitCXXStructor to CGCXXABI.

A followup patch will address the code duplication.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217807 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoCreate a emitCXXStructor function and make the existing emitCXXConstructor and
Rafael Espindola [Mon, 15 Sep 2014 18:46:13 +0000 (18:46 +0000)]
Create a emitCXXStructor function and make the existing emitCXXConstructor and
emitCXXDestructor static helpers.

A next patch will make it a helper in CGCXXABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217804 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUse intrusive refcounted pointers to manage RopeRefCountString lifetime.
Benjamin Kramer [Mon, 15 Sep 2014 17:58:03 +0000 (17:58 +0000)]
Use intrusive refcounted pointers to manage RopeRefCountString lifetime.

std::shared_ptr<char []> would be even nicer, but shared_ptr doesn't work
with arrays :(

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217798 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agounique_ptrify ChainedDiagnosticConsumer's ctor parameters
David Blaikie [Mon, 15 Sep 2014 17:50:10 +0000 (17:50 +0000)]
unique_ptrify ChainedDiagnosticConsumer's ctor parameters

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217793 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoTeach Clang how to use response files when calling other tools
Reid Kleckner [Mon, 15 Sep 2014 17:45:39 +0000 (17:45 +0000)]
Teach Clang how to use response files when calling other tools

Patch by Rafael Auler!

This patch addresses PR15171 and teaches Clang how to call other tools
with response files, when the command line exceeds system limits. This
is a problem for Windows systems, whose maximum command-line length is
32kb.

I introduce the concept of "response file support" for each Tool object.
A given Tool may have full support for response files (e.g. MSVC's
link.exe) or only support file names inside response files, but no flags
(e.g. Apple's ld64, as commented in PR15171), or no support at all (the
default case). Therefore, if you implement a toolchain in the clang
driver and you want clang to be able to use response files in your
tools, you must override a method (getReponseFileSupport()) to tell so.

I designed it to support different kinds of tools and
internationalisation needs:

- VS response files ( UTF-16 )
- GNU tools ( uses system's current code page, windows' legacy intl.
  support, with escaped backslashes. On unix, fallback to UTF-8 )
- Clang itself ( UTF-16 on windows, UTF-8 on unix )
- ld64 response files ( only a limited file list, UTF-8 on unix )

With this design, I was able to test input file names with spaces and
international characters for Windows. When the linker input is large
enough, it creates a response file with the correct encoding. On a Mac,
to test ld64, I temporarily changed Clang's behavior to always use
response files regardless of the command size limit (avoiding using huge
command line inputs). I tested clang with the LLVM test suite (compiling
benchmarks) and it did fine.

Test Plan: A LIT test that tests proper response files support. This is
tricky, since, for Unix systems, we need a 2MB response file, otherwise
Clang will simply use regular arguments instead of a response file. To
do this, my LIT test generate the file on the fly by cloning many -DTEST
parameters until we have a 2MB file. I found out that processing 2MB of
arguments is pretty slow, it takes 1 minute using my notebook in a debug
build, or 10s in a Release build. Therefore, I also added "REQUIRES:
long_tests", so it will only run when the user wants to run long tests.

In the full discussion in
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130408/171463.html,
Rafael Espindola discusses a proper way to test
llvm::sys::argumentsFitWithinSystemLimits(), and, there, Chandler
suggests to use 10 times the current system limit (20MB resp file), so
we guarantee that the system will always use response file, even if a
new linux comes up that can handle a few more bytes of arguments.
However, by testing with a 20MB resp file, the test takes long 8 minutes
just to perform a silly check to see if the driver will use a response
file. I found it to be unreasonable. Thus, I discarded this approach and
uses a 2MB response file, which should be enough.

Reviewers: asl, rafael, silvas

Reviewed By: silvas

Subscribers: silvas, rnk, thakis, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217792 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix memory leak of raw_ostreams in LogDiagnosticPrinter handling.
David Blaikie [Mon, 15 Sep 2014 17:30:56 +0000 (17:30 +0000)]
Fix memory leak of raw_ostreams in LogDiagnosticPrinter handling.

This is another case of conditional ownership (in this case a raw
reference, plus a boolean to indicate whether the referenced object
should be deleted). While it's not ideal, I prefer to make the ownership
explicit with a unique_ptr than using a boolean flag (though it does
make the reference and the unique_ptr redundant in the sense that they
both refer to the same memory). At some point we might write a reusable
conditional ownership pointer (a stateful custom deleter for a unique_ptr
may be appropriate).

Based on a patch from a patch by Anton Yartsev.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217791 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd -fseh-exceptions for MinGW-w64
Reid Kleckner [Mon, 15 Sep 2014 17:19:16 +0000 (17:19 +0000)]
Add -fseh-exceptions for MinGW-w64

This adds a flag called -fseh-exceptions that uses the native Windows
.pdata and .xdata unwind mechanism to throw exceptions. The other EH
possibilities are DWARF and SJLJ exceptions.

Patch by Martell Malone!

Reviewed By: asl, rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217790 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoPretty print attributes associated with record declarations.
Aaron Ballman [Mon, 15 Sep 2014 16:45:30 +0000 (16:45 +0000)]
Pretty print attributes associated with record declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217784 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C SDK modernizer. Do not modernize an enum
Fariborz Jahanian [Mon, 15 Sep 2014 16:41:47 +0000 (16:41 +0000)]
Objective-C SDK modernizer. Do not modernize an enum
which already has the underlying interger type specification.
// rdar://1826225

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217783 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdding some FIXMEs to the attribute emitter code regarding whether pretty printing...
Aaron Ballman [Mon, 15 Sep 2014 16:16:14 +0000 (16:16 +0000)]
Adding some FIXMEs to the attribute emitter code regarding whether pretty printing enumerators should use quoted string literals, or identifiers. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217781 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoWhen pretty printing attributes that have enumeration arguments, print the enumerator...
Aaron Ballman [Mon, 15 Sep 2014 15:14:13 +0000 (15:14 +0000)]
When pretty printing attributes that have enumeration arguments, print the enumerator identifier (as a string literal) instead of the internal enumerator integral value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217771 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoEdit: Do not extend a removal to include trailing whitespace if we're at the end
Benjamin Kramer [Mon, 15 Sep 2014 11:47:10 +0000 (11:47 +0000)]
Edit: Do not extend a removal to include trailing whitespace if we're at the end
of the file.

This would run past the end of the buffer. Sadly I don't have a great way to
test it, the only way to trigger the bug is having a removal fix it at the end
of the file, which none of our current warnings can generate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217766 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[ARM] Add ACLE predefines: maxmin, rounding and h/w integer division
James Molloy [Mon, 15 Sep 2014 11:25:38 +0000 (11:25 +0000)]
[ARM] Add ACLE predefines: maxmin, rounding and h/w integer division

Patch by Assad Hashmi!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217760 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-format: Basic support for Java.
Daniel Jasper [Mon, 15 Sep 2014 11:21:46 +0000 (11:21 +0000)]
clang-format: Basic support for Java.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217759 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-format: Add option to break before non-assignment operators.
Daniel Jasper [Mon, 15 Sep 2014 11:11:00 +0000 (11:11 +0000)]
clang-format: Add option to break before non-assignment operators.

This will allow:
  int aaaaaaaaaaaaaa =
      bbbbbbbbbbbbbb
      + ccccccccccccccc;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217757 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMake test/Driver hermetic
JF Bastien [Sun, 14 Sep 2014 23:42:15 +0000 (23:42 +0000)]
Make test/Driver hermetic

Summary:
The includes shouldn't be there, use the compiler's built-in types/macros instead.

This is a follow-up to r217694, as discussed in:
  http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140908/114669.html

Test Plan: ninja check-clang

Reviewers: nlewycky, thakis, echristo, chandlerc

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217743 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoCheck delegating constructors for using uninitialized fields.
Richard Trieu [Fri, 12 Sep 2014 22:47:58 +0000 (22:47 +0000)]
Check delegating constructors for using uninitialized fields.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217716 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-cl: Warn when a /TC or /TP argument is unused
Ehsan Akhgari [Fri, 12 Sep 2014 21:44:24 +0000 (21:44 +0000)]
clang-cl: Warn when a /TC or /TP argument is unused

Test Plan: The patch includes a test case.

Reviewers: hansw

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217710 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDon't print 'NULL TYPE' when dumping a delegating constructor.
Richard Trieu [Fri, 12 Sep 2014 21:20:53 +0000 (21:20 +0000)]
Don't print 'NULL TYPE' when dumping a delegating constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217707 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAllow protocols to be just declared.
Rafael Espindola [Fri, 12 Sep 2014 20:14:20 +0000 (20:14 +0000)]
Allow protocols to be just declared.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217704 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agopatch to add missing warning on sizeof wrong parameter
Fariborz Jahanian [Fri, 12 Sep 2014 18:44:36 +0000 (18:44 +0000)]
patch to add missing warning on sizeof wrong parameter
for __builtin___strlcpy_chk/__builtin___strlcat_chk.
Patch by Jacques Fortier with monir change by me and
addition of test. rdar://18259539

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217700 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-cl: Don't treat linker input files differently when /TP or /TC is specified.
Ehsan Akhgari [Fri, 12 Sep 2014 18:15:10 +0000 (18:15 +0000)]
clang-cl: Don't treat linker input files differently when /TP or /TC is specified.

Summary: This fixes http://llvm.org/PR20923.

Test Plan: This patch includes an automated test.

Reviewers: hansw

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217699 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoNo need to use PNaCl's calling convention since PNaCl now uses a separate approach...
JF Bastien [Fri, 12 Sep 2014 17:52:51 +0000 (17:52 +0000)]
No need to use PNaCl's calling convention since PNaCl now uses a separate approach for calling conventions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217696 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix copy/paste for test, the triple should be le64-unknown-unknown
JF Bastien [Fri, 12 Sep 2014 17:52:49 +0000 (17:52 +0000)]
Fix copy/paste for test, the triple should be le64-unknown-unknown

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217695 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd support for le64.
JF Bastien [Fri, 12 Sep 2014 17:52:47 +0000 (17:52 +0000)]
Add support for le64.

Summary:
le64 is a generic little-endian 64-bit processor, mimicking le32.

Also see the associated LLVM change.

Test Plan: make check-all

Reviewers: dschuff

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217694 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-format: Improve line breaks at function calls.
Daniel Jasper [Fri, 12 Sep 2014 16:35:28 +0000 (16:35 +0000)]
clang-format: Improve line breaks at function calls.

Before:
  EXPECT_CALL(SomeObject, SomeFunction(Parameter)).Times(2).WillRepeatedly(
      Return(SomeValue));

After:
  EXPECT_CALL(SomeObject, SomeFunction(Parameter))
      .Times(2)
      .WillRepeatedly(Return(SomeValue));

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217687 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd a previously-missing test case for return adjustment vs pure virtual methods
Timur Iskhodzhanov [Fri, 12 Sep 2014 15:21:44 +0000 (15:21 +0000)]
Add a previously-missing test case for return adjustment vs pure virtual methods

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217686 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[ASan/Win] Fix PR20918 -- SEH handler doesn't work with the MD runtime
Timur Iskhodzhanov [Fri, 12 Sep 2014 14:01:30 +0000 (14:01 +0000)]
[ASan/Win] Fix PR20918 -- SEH handler doesn't work with the MD runtime

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217679 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUpdate the test case after r217673
Timur Iskhodzhanov [Fri, 12 Sep 2014 13:47:44 +0000 (13:47 +0000)]
Update the test case after r217673

Sorry, committing to multiple repos at once is hard...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217677 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[ASan/Win] Rename asan_win_uar_thunk.lib to asan_win_dynamic_runtime_thunk.lib
Timur Iskhodzhanov [Fri, 12 Sep 2014 13:21:02 +0000 (13:21 +0000)]
[ASan/Win] Rename asan_win_uar_thunk.lib to asan_win_dynamic_runtime_thunk.lib

It turned out that we have to bridge more stuff between the executable
and the ASan RTL DLL than just __asan_option_detect_stack_use_after_return.
See PR20918 for more details.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217673 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFixing a -Woverflow warning from GCC by using a more natural datatype for this operat...
Aaron Ballman [Fri, 12 Sep 2014 12:42:15 +0000 (12:42 +0000)]
Fixing a -Woverflow warning from GCC by using a more natural datatype for this operation. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217670 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoEvery code owner should be reachable via email, so add one for
Joerg Sonnenberger [Fri, 12 Sep 2014 08:05:51 +0000 (08:05 +0000)]
Every code owner should be reachable via email, so add one for
Douglas Gregor and Ted Kremenek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217658 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUse unique_ptr for ScratchBuf and PragmaHandlers in the preprocessor.
Craig Topper [Fri, 12 Sep 2014 05:19:24 +0000 (05:19 +0000)]
Use unique_ptr for ScratchBuf and PragmaHandlers in the preprocessor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217656 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMS ABI: The latest VC "14" CTP implements deleted virtual functions
David Majnemer [Fri, 12 Sep 2014 04:38:08 +0000 (04:38 +0000)]
MS ABI: The latest VC "14" CTP implements deleted virtual functions

Deleted virtual functions get _purecall inserted into the vftable.
Earlier CTPs would simply stick nullptr in there.

N.B.  MSVC can't handle deleted virtual functions which require return
adjusting thunks, they give an error that a deleted function couldn't be
called inside of a compiler generated function.  We get this correct by
making the thunk have a __purecall entry as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217654 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMS ABI: Use the correct this arg when generating implict copy ctor
David Majnemer [Thu, 11 Sep 2014 23:05:02 +0000 (23:05 +0000)]
MS ABI: Use the correct this arg when generating implict copy ctor

We assumed that the incoming this argument would be the last argument.

However, this is not true under the MS ABI.

This fixes PR20897.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217642 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoThread Safety Analysis: Avoid infinite recursion in an operator<<
Justin Bogner [Thu, 11 Sep 2014 19:44:04 +0000 (19:44 +0000)]
Thread Safety Analysis: Avoid infinite recursion in an operator<<

r217556 introduced an operator<<(std::ostream &, StringRef) that seems
to self recurse on some systems, because str.data(), which is a char *,
was being implicitly converted back to StringRef in overload
resolution.

This manifested as SemaCXX/warn-thread-safety-analysis.cpp timing out
in release builds and overflowing the stack in debug builds. One of
the failing systems that saw this is here:

  http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/4636

Using ostream's write method instead of operator<< should get the bots
going again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217621 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C. Under a special flag, -Wcstring-format-directive,
Fariborz Jahanian [Thu, 11 Sep 2014 19:13:23 +0000 (19:13 +0000)]
Objective-C. Under a special flag, -Wcstring-format-directive,
off by default, issue a warning if %s directive is used
in formart argument of a function/method declared as
__attribute__((format(CF/NSString, ...)))
To complete rdar://18182443

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217619 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-cl: Add support for the /o option for object files, executables, and preprocess...
Ehsan Akhgari [Thu, 11 Sep 2014 18:16:21 +0000 (18:16 +0000)]
clang-cl: Add support for the /o option for object files, executables, and preprocessor output

Summary:
cl.exe recognizes /o as a deprecated and undocumented option similar to
/Fe.  This patch adds support for this option to clang-cl for /Fe, /Fo
and /Fi.  It also ensures that the last option among /o and /F* wins,
if both specified.

This is required at least for building autoconf based software, since
autoconf uses -o to specify the executable output.

This fixes http://llvm.org/PR20894.

Test Plan: The patch includes automated tests.

Reviewers: rnk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217615 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUse the simpler version of llvm::sys::fs::exists.
Rafael Espindola [Thu, 11 Sep 2014 18:10:13 +0000 (18:10 +0000)]
Use the simpler version of llvm::sys::fs::exists.

In all these cases it looks like the intention was to handle error in a similar
way to the file not existing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217614 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUpdate C++ status page to reflect that Clang 3.5 has released.
Richard Smith [Thu, 11 Sep 2014 17:30:32 +0000 (17:30 +0000)]
Update C++ status page to reflect that Clang 3.5 has released.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217609 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUpdate DR status list to reflect that Clang 3.5 has been released.
Richard Smith [Thu, 11 Sep 2014 17:29:13 +0000 (17:29 +0000)]
Update DR status list to reflect that Clang 3.5 has been released.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217608 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoTests for DR573-580.
Richard Smith [Thu, 11 Sep 2014 17:28:14 +0000 (17:28 +0000)]
Tests for DR573-580.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217606 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMerge GetAddrOfCXXConstructor and GetAddrOfCXXDonstructor. NFC.
Rafael Espindola [Thu, 11 Sep 2014 15:42:06 +0000 (15:42 +0000)]
Merge GetAddrOfCXXConstructor and GetAddrOfCXXDonstructor. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217598 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix bug 20892 - clang-format does not handle C-style comments
Roman Kashitsyn [Thu, 11 Sep 2014 14:47:20 +0000 (14:47 +0000)]
Fix bug 20892 - clang-format does not handle C-style comments

Summary:
http://llvm.org/bugs/show_bug.cgi?id=20892

Add support of C-style formatting enabling/disabling directives. Now the following two styles are supported:

  // clang-format on
  /* clang-format on */

The flexibility in comments (support of extra spaces and/or slashes, etc.) is deliberately avoided to simplify search in large code bases.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, curdeius, klimek

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217588 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAvoid some unnecessary SmallVector copies.
Benjamin Kramer [Thu, 11 Sep 2014 14:13:49 +0000 (14:13 +0000)]
Avoid some unnecessary SmallVector copies.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217586 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoNULL->nullptr
Alexander Musman [Thu, 11 Sep 2014 08:10:57 +0000 (08:10 +0000)]
NULL->nullptr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217573 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix a couple of -Wsign-compare warnings introduced in r217556
Justin Bogner [Thu, 11 Sep 2014 03:37:42 +0000 (03:37 +0000)]
Fix a couple of -Wsign-compare warnings introduced in r217556

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217569 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoThread Safety Analysis: major update to thread safety TIL.
DeLesley Hutchins [Wed, 10 Sep 2014 22:12:52 +0000 (22:12 +0000)]
Thread Safety Analysis: major update to thread safety TIL.
Numerous changes, including:
  * Changed the way variables and instructions are handled in basic blocks to
    be more efficient.
  * Eliminated SExprRef.
  * Simplified futures.
  * Fixed documentation.
  * Compute dominator and post dominator trees.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217556 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMore test for "void *" argument as index of a dictionary literal.
Fariborz Jahanian [Wed, 10 Sep 2014 22:12:13 +0000 (22:12 +0000)]
More test for "void *" argument as index of a dictionary literal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217555 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRemove a couple of fixed paths that snuck into my test from 217550
Ben Langmuir [Wed, 10 Sep 2014 21:41:43 +0000 (21:41 +0000)]
Remove a couple of fixed paths that snuck into my test from 217550

I forgot to fix these again the second time I copy-and-pasted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217552 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAvoid a couple of assertions when preprocessing with modules
Ben Langmuir [Wed, 10 Sep 2014 21:29:41 +0000 (21:29 +0000)]
Avoid a couple of assertions when preprocessing with modules

1. We were hitting the NextIsPrevious assertion because we were trying
to merge decl chains that were independent of each other because we had
no Sema object to allow them to find existing decls. This is fixed by
delaying loading the "preloaded" decls until Sema is available.

2. We were trying to get identifier info from an annotation token, which
asserts.  The fix is to special-case the module annotations in the
preprocessed output printer.

Fixed in a single commit because when you hit 1 you almost invariably
hit 2 as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217550 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUpdate for llvm api change.
Rafael Espindola [Wed, 10 Sep 2014 21:27:41 +0000 (21:27 +0000)]
Update for llvm api change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217547 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoOnly override the target architecture on -m32 and friends if it is
Joerg Sonnenberger [Wed, 10 Sep 2014 21:25:37 +0000 (21:25 +0000)]
Only override the target architecture on -m32 and friends if it is
actually different. Fixes a surprising link error with nodejs on rpi,
where armv6-netbsd-eabihf turned into armv5e-netbsd-eabihf, which
doesn't lacks the necessary VFP support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217546 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C. Accept 'nil' as indexing argument to
Fariborz Jahanian [Wed, 10 Sep 2014 20:55:31 +0000 (20:55 +0000)]
Objective-C. Accept 'nil' as indexing argument to
dictionary literals since the API which implements
them accepts it too.  // rdar://18254621

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217543 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMS ABI: Emit dynamic initializers for selectany globals in comdat-associative section...
Hans Wennborg [Wed, 10 Sep 2014 19:28:48 +0000 (19:28 +0000)]
MS ABI: Emit dynamic initializers for selectany globals in comdat-associative sections (PR20889)

This prevents initializers for comdat-folded globals from running multiple times.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217534 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C arc. Fixes a crash when issuing diagnostic for
Fariborz Jahanian [Wed, 10 Sep 2014 18:23:34 +0000 (18:23 +0000)]
Objective-C arc. Fixes a crash when issuing diagnostic for
passing parameter to an audited CF API. rdar://18222007

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217530 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[sphinx cleanup]
Dan Liew [Wed, 10 Sep 2014 17:26:21 +0000 (17:26 +0000)]
[sphinx cleanup]
Fix sphinx warning introduced by r217501.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217524 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRecognize .lib files as linker input explicitly
Ehsan Akhgari [Wed, 10 Sep 2014 17:15:00 +0000 (17:15 +0000)]
Recognize .lib files as linker input explicitly

Summary:
Currently, this is done implicitly in Driver::BuildInputs by considering
any invalid input type as linker input.

Test Plan: I don't think this behavior is observable for the reason stated above.

Reviewers: hansw

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217522 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd a test for an operator access decl.
Nico Weber [Wed, 10 Sep 2014 17:03:37 +0000 (17:03 +0000)]
Add a test for an operator access decl.

In Parser::ParseCXXClassMemberDeclaration(), it was possible to change
      isAccessDecl = NextToken().is(tok::kw_operator);
to
      isAccessDecl = false;
and no tests would fail. Now there's coverage for this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217519 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agotypo
Sanjay Patel [Wed, 10 Sep 2014 16:59:01 +0000 (16:59 +0000)]
typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217517 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[analyzer] Fix pthread lock tests so that the API comes from a system header.
Jordan Rose [Wed, 10 Sep 2014 16:17:42 +0000 (16:17 +0000)]
[analyzer] Fix pthread lock tests so that the API comes from a system header.

...and verify that a global mutex in user code can be used without warnings.

Patch by Aleksei Sidorin!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217515 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-format: Add option to allow short case labels on a single line.
Daniel Jasper [Wed, 10 Sep 2014 13:11:45 +0000 (13:11 +0000)]
clang-format: Add option to allow short case labels on a single line.

On a single line:
  switch (a) {
  case 1: x = 1; return;
  case 2: x = 2; return;
  default: break;
  }

Not on a single line:
  switch (a) {
  case 1:
    x = 1;
    return;
  case 2:
    x = 2;
    return;
  default:
    break;
  }

This partly addresses llvm.org/PR16535. In the long run, we probably want to
lay these out in columns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217501 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoCodeGen: Use a fixed alignment for vtables.
Benjamin Kramer [Wed, 10 Sep 2014 12:50:59 +0000 (12:50 +0000)]
CodeGen: Use a fixed alignment for vtables.

Pointer-sized alignment is sufficient as we only ever read single values
from the table. Otherwise we'd bump the alignment to 16 bytes in the
backend if the vtable is larger than 16 bytes. This is great for
structures that are accessed with vector instructions or copied around, but
that's simply not the case for vtables.

Shrinks the data segment of a Release x86_64 clang by 0.3%. The wins are
larger for i386 and code bases that use vtables more often than we do.

This matches the behavior of GCC 5.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217495 91177308-0d34-0410-b5e6-96231b3b80d8