]> granicus.if.org Git - clang/log
clang
10 years ago[AArch64] Add -mgeneral_regs_only option.
Amara Emerson [Thu, 23 Jan 2014 15:48:30 +0000 (15:48 +0000)]
[AArch64] Add -mgeneral_regs_only option.

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

10 years ago[CMake] Move LIBCLANG_BUILD_STATIC above. NFC.
NAKAMURA Takumi [Thu, 23 Jan 2014 15:33:50 +0000 (15:33 +0000)]
[CMake] Move LIBCLANG_BUILD_STATIC above. NFC.

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

10 years ago[CMake] Parameterize MODULE and SHARED in add_clang_library().
NAKAMURA Takumi [Thu, 23 Jan 2014 15:33:44 +0000 (15:33 +0000)]
[CMake] Parameterize MODULE and SHARED in add_clang_library().

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

10 years ago[CMake] Migrate LLVMParseArguments to CMakeParseArguments.
NAKAMURA Takumi [Thu, 23 Jan 2014 15:33:35 +0000 (15:33 +0000)]
[CMake] Migrate LLVMParseArguments to CMakeParseArguments.

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

10 years agoFix to PR8880 (clang dies processing a for loop)
Serge Pavlov [Thu, 23 Jan 2014 15:05:00 +0000 (15:05 +0000)]
Fix to PR8880 (clang dies processing a for loop)

Due to statement expressions supported as GCC extension, it is possible
to put 'break' or 'continue' into a loop/switch statement but outside
its body, for example:

    for ( ; ({ if (first) { first = 0; continue; } 0; }); )

This code is rejected by GCC if compiled in C mode but is accepted in C++
code. GCC bug 44715 tracks this discrepancy. Clang used code generation
that differs from GCC in both modes: only statement of the third
expression of 'for' behaves as if it was inside loop body.

This change makes code generation more close to GCC, considering 'break'
or 'continue' statement in condition and increment expressions of a
loop as it was inside the loop body. It also adds error for the cases
when 'break'/'continue' appear outside loop due to this syntax. If
code generation differ from GCC, warning is issued.

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

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

10 years agoMachO embedded: default to soft float without issuing warning
Tim Northover [Thu, 23 Jan 2014 15:00:01 +0000 (15:00 +0000)]
MachO embedded: default to soft float without issuing warning

This is a simpler rule, broadly in line with previous Darwin (which chose
between "soft" and "softfp") but probably safer. In practice the only real
reason for "softfp" is ABI compatibility, not usually an issue on limited chips
like these, so anyone who wanted hard-float should already be saying so.

That's my story and I'm sticking to it.

rdar://problem/15887493

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

10 years agoAdd documentation for -m16 option on X86, fix typo
David Woodhouse [Thu, 23 Jan 2014 14:32:46 +0000 (14:32 +0000)]
Add documentation for -m16 option on X86, fix typo

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

10 years ago[analyzer] Strip trailing whitespace characters from input.
Anton Yartsev [Thu, 23 Jan 2014 14:12:48 +0000 (14:12 +0000)]
[analyzer] Strip trailing whitespace characters from input.

More universal way of removing trailing whitespace characters then 'chomp' does. Chomp "removes any trailing string that corresponds to the current value of $/" (quote from perldoc). In my case an input ended with '\r\r\n', chomp left '\r' at the end of input and the script ended up with an error "Use of uninitialized value in concatenation (.) or string"

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

10 years agoImprove x86 android support, add x86_64 android target
Alexey Bataev [Thu, 23 Jan 2014 09:08:32 +0000 (09:08 +0000)]
Improve x86 android support, add x86_64 android target

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

10 years agotest/CodeGenCXX: Be less strict about return types
Justin Bogner [Thu, 23 Jan 2014 04:41:06 +0000 (04:41 +0000)]
test/CodeGenCXX: Be less strict about return types

Some ABIs have different return types for constructors and
destructors, and we're just looking for the end of the function
here. Loosen up the regex.

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

10 years ago[analyzer] Tighten up sanity checks on Objective-C property getter synthesis.
Jordan Rose [Thu, 23 Jan 2014 03:59:10 +0000 (03:59 +0000)]
[analyzer] Tighten up sanity checks on Objective-C property getter synthesis.

If there are non-trivially-copyable types /other/ than C++ records, we
won't have a synthesized copy expression, but we can't just use a simple
load/return.

Also, add comments and shore up tests, making sure to test in both ARC
and non-ARC.

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

10 years ago[analyzer] Future-proof MallocChecker CFG dumping.
Jordan Rose [Thu, 23 Jan 2014 03:59:01 +0000 (03:59 +0000)]
[analyzer] Future-proof MallocChecker CFG dumping.

Now we'll get a warning if we miss a case. Refinement of r199800.

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

10 years agoChange an absolute value function in a test from floating to integer to
Richard Trieu [Thu, 23 Jan 2014 03:51:55 +0000 (03:51 +0000)]
Change an absolute value function in a test from floating to integer to
match argument type.

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

10 years ago[AArch64 NEON] Fix a bug about vcles_f32 and vcled_f64.
Kevin Qin [Thu, 23 Jan 2014 03:42:06 +0000 (03:42 +0000)]
[AArch64 NEON] Fix a bug about vcles_f32 and vcled_f64.

As vcles_f32() and vcled_f64 are implemented by FCMGE, operands
should make a swap.

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

10 years agoCodeGen: Fix tracking of PGO counters for the logical or operator
Justin Bogner [Thu, 23 Jan 2014 02:54:30 +0000 (02:54 +0000)]
CodeGen: Fix tracking of PGO counters for the logical or operator

This adds tests for both logical or and for logical and, which was
already correct.

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

10 years agoCodeGen: Handle PGO counters for constructors and destructors
Justin Bogner [Thu, 23 Jan 2014 02:54:27 +0000 (02:54 +0000)]
CodeGen: Handle PGO counters for constructors and destructors

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

10 years agotest/CodeGenCXX: Give instr-profile exception tests their own file
Justin Bogner [Thu, 23 Jan 2014 02:54:23 +0000 (02:54 +0000)]
test/CodeGenCXX: Give instr-profile exception tests their own file

This test requires asserts for now, and exception handling has an
awkward structure that leads to extra run lines. Because of this, the
test file's not a great place for other C++ PGO tests, but
instr-profile.cpp is obviously the better name for them.

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

10 years agotest/CodeGen: Fix a typo
Justin Bogner [Thu, 23 Jan 2014 02:54:20 +0000 (02:54 +0000)]
test/CodeGen: Fix a typo

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

10 years agoRequire a module.map file to load a module
Ben Langmuir [Wed, 22 Jan 2014 23:19:39 +0000 (23:19 +0000)]
Require a module.map file to load a module

Removes some old code that allowed a module to be loaded from a pcm file
even if the module.map could not be found.  Also update a number of
tests that relied on the old behavior.

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

10 years agoDon't forget about a builtin if we're about to redeclare it and we couldn't
Richard Smith [Wed, 22 Jan 2014 23:07:19 +0000 (23:07 +0000)]
Don't forget about a builtin if we're about to redeclare it and we couldn't
create an implicit declaration of it (because some type it depends on is
unavailable). This had the effect of causing us to not implicitly give it the
right attributes. It turns out that glibc's __sigsetjmp is declared before
sigjmp_buf is declared, and this resulted in us not implicitly giving it
__attribute__((returns_twice)), which in turn resulted in miscompiles in any C
code calling glibc's sigsetjmp.

(See also the vaguely-related sourceware.org/PR4662.)

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

10 years agoIf an attribute has a semantically meaningful spelling (such as ArgumentWithTypeTagAt...
Aaron Ballman [Wed, 22 Jan 2014 21:51:20 +0000 (21:51 +0000)]
If an attribute has a semantically meaningful spelling (such as ArgumentWithTypeTagAttr or MSInheritanceAttr), display the spelling used for the attribute as part of the AST dump. This should ease debugging the AST for these attributes. Attributes without semantically meaningful spelling variations are not affected.

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

10 years agoHandle va_arg on struct types for the le32 target (PNaCl and Emscripten)
Mark Seaborn [Wed, 22 Jan 2014 20:11:01 +0000 (20:11 +0000)]
Handle va_arg on struct types for the le32 target (PNaCl and Emscripten)

PNaCl and Emscripten can both handle va_arg IR instructions with
struct type.

Also add a test to cover generating a va_arg IR instruction from
va_arg in C on le32 (as already handled by VisitVAArgExpr() in
CGExprScalar.cpp), which was not covered by a test before.

(This fixes https://code.google.com/p/nativeclient/issues/detail?id=2381)

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

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

10 years agoWhen a special member is explicitly defaulted outside its class, and we reject
Richard Smith [Wed, 22 Jan 2014 20:09:10 +0000 (20:09 +0000)]
When a special member is explicitly defaulted outside its class, and we reject
the defaulting because it would delete the member, produce additional notes
explaining why the member is implicitly deleted.

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

10 years agoclang-cl: Expose the -ferror-limit= option
Hans Wennborg [Wed, 22 Jan 2014 20:06:53 +0000 (20:06 +0000)]
clang-cl: Expose the -ferror-limit= option

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

10 years agoDriver: Suppression support for -Wa,--compress-debug-sections
David Blaikie [Wed, 22 Jan 2014 19:22:21 +0000 (19:22 +0000)]
Driver: Suppression support for -Wa,--compress-debug-sections

(to go with existing suppression of -Wa,-compress-debug-sections)

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

10 years agoObjectiveC. When issuing property implementation is
Fariborz Jahanian [Wed, 22 Jan 2014 19:02:20 +0000 (19:02 +0000)]
ObjectiveC. When issuing property implementation is
not using backing ivar warning, ignore when
property is not being synthesized (user declared its
implementation @dynamic). // rdar://1583425

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

10 years agoPR18465: [Thumbv8] add predefined macros
Weiming Zhao [Wed, 22 Jan 2014 18:42:13 +0000 (18:42 +0000)]
PR18465: [Thumbv8] add predefined macros

currently, for thumbv8, two predefined macros are missing:
 define __THUMB_INTERWORK__ 1
 define __THUMB_INTERWORK__ 1

This patch adds them for thumbv8.

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

10 years agoclang-format: Fix incorrect lambda recognition.
Daniel Jasper [Wed, 22 Jan 2014 17:01:47 +0000 (17:01 +0000)]
clang-format: Fix incorrect lambda recognition.

Before:
  std::unique_ptr<int[]> foo() {}

After:
  std::unique_ptr<int []> foo() {}

Also, the formatting could go severely wrong after such a function
before.

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

10 years ago[analyzer] The patch prevents the analyzer from crashing during CFG dump.
Anton Yartsev [Wed, 22 Jan 2014 13:19:48 +0000 (13:19 +0000)]
[analyzer] The patch prevents the analyzer from crashing during CFG dump.

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

10 years ago[CMake][MS] libclang: Invalidate LLVM_EXPORTED_SYMBOL_FILE to suppress LNK4197.
NAKAMURA Takumi [Wed, 22 Jan 2014 13:02:59 +0000 (13:02 +0000)]
[CMake][MS] libclang: Invalidate LLVM_EXPORTED_SYMBOL_FILE to suppress LNK4197.

Each functions is exported as "dllexport" in include/clang-c.
See also KB835326.

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

10 years agoclang-format: Treat "." in protos like namespace separators.
Daniel Jasper [Wed, 22 Jan 2014 08:04:52 +0000 (08:04 +0000)]
clang-format: Treat "." in protos like namespace separators.

Before:
  optional really.really.long.and.qualified.type.aaaaaaa
      .aaaaaaaa another_fiiiiiiiiiiiiiiiiiiiiield = 2;

After:
  optional
     really.really.long.and.qualified.type.aaaaaaa.aaaaaaaa
          another_fiiiiiiiiiiiiiiiiiiiiield = 2;

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

10 years agoChange a dyn_cast from r199794 to a straight cast
Alp Toker [Wed, 22 Jan 2014 07:53:08 +0000 (07:53 +0000)]
Change a dyn_cast from r199794 to a straight cast

It's guaranteed to be a CXXMethodDecl.

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

10 years agoIntroduce and use Decl::getAsFunction() to simplify templated function checks
Alp Toker [Wed, 22 Jan 2014 07:29:52 +0000 (07:29 +0000)]
Introduce and use Decl::getAsFunction() to simplify templated function checks

Lift the getFunctionDecl() utility out of the parser into a general
Decl::getAsFunction() and use it to simplify other parts of the implementation.

Reduce isFunctionOrFunctionTemplate() to a simple type check that works the
same was as the other is* functions and move unwrapping of shadowed decls to
callers so it doesn't get run twice.

Shuffle around canSkipFunctionBody() to reduce virtual dispatch on ASTConsumer.
There's no need to query when we already know the body can't be skipped.

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

10 years agoAdd basic checking for returning null from functions/methods marked 'returns_nonnull'.
Ted Kremenek [Wed, 22 Jan 2014 06:10:28 +0000 (06:10 +0000)]
Add basic checking for returning null from functions/methods marked 'returns_nonnull'.

This involved making CheckReturnStackAddr into a static function, which
is now called by a top-level return value checking routine called
CheckReturnValExpr.

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

10 years agoclang-cl: make /Zp a Joined option (PR18503)
Hans Wennborg [Wed, 22 Jan 2014 03:23:35 +0000 (03:23 +0000)]
clang-cl: make /Zp a Joined option (PR18503)

We don't currently support this option, but we should be able to parse it.

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

10 years agoAdd a test file missed from r199782.
Richard Smith [Wed, 22 Jan 2014 02:05:03 +0000 (02:05 +0000)]
Add a test file missed from r199782.

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

10 years agoEnforce restrictions that 'main' is not allowed to be deleted, or to be used by
Richard Smith [Wed, 22 Jan 2014 01:43:19 +0000 (01:43 +0000)]
Enforce restrictions that 'main' is not allowed to be deleted, or to be used by
the program, in C++. (We allow the latter as an extension, since we've always
permitted it, and GCC does the same, and our supported C++ ABIs don't do
anything special in main.)

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

10 years agoObjectiveC driver. change to reinstate -fno-objc-legacy-dispatch behavior
Fariborz Jahanian [Wed, 22 Jan 2014 00:43:54 +0000 (00:43 +0000)]
ObjectiveC driver. change to reinstate -fno-objc-legacy-dispatch behavior
when the deployment target is 10.5. // rdar://15852259

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

10 years agoBuild an appropriate (albeit trivial) TypeSourceInfo for a destructor name, so
Richard Smith [Wed, 22 Jan 2014 00:30:17 +0000 (00:30 +0000)]
Build an appropriate (albeit trivial) TypeSourceInfo for a destructor name, so
AST consumers can determine where the destructor name was written. Patch by
Olivier Goffart!

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

10 years agoWhen formatting a C++-only declaration name, enable C++ mode in the formatter's
Richard Smith [Wed, 22 Jan 2014 00:27:42 +0000 (00:27 +0000)]
When formatting a C++-only declaration name, enable C++ mode in the formatter's
language options. This is not really ideal -- we should require the right
language options to be passed in, or not require language options to format a
name -- but it fixes a number of *obviously* wrong formattings. Patch by
Olivier Goffart!

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

10 years agoDelay attribute checking until auto types are deduced
Nico Rieck [Tue, 21 Jan 2014 23:54:36 +0000 (23:54 +0000)]
Delay attribute checking until auto types are deduced

Checking in ActOnVariableDeclarator computes and caches the linkage using
the non-deduced auto type which defaults to external linkage. Depending on
how the auto type is deduced linkage can change and conflict with the
cached linkage, hitting asserts.

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

10 years agoCorrect various uses of 'argument' that in fact refer to function parameters
Alp Toker [Tue, 21 Jan 2014 23:35:24 +0000 (23:35 +0000)]
Correct various uses of 'argument' that in fact refer to function parameters

Cleanup only.

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

10 years agoFix regression in r197623: only diagnose a by-copy capture of an incomplete
Richard Smith [Tue, 21 Jan 2014 23:27:46 +0000 (23:27 +0000)]
Fix regression in r197623: only diagnose a by-copy capture of an incomplete
type if the capture is, actually, by copy.

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

10 years agoTeach Clang to look in its installation libdir for libraries (such as
Chandler Carruth [Tue, 21 Jan 2014 22:49:05 +0000 (22:49 +0000)]
Teach Clang to look in its installation libdir for libraries (such as
libc++) when the installation is within the system root.

This doesn't really help cross compiles much, but we don't (currently)
have a great story around libc++, cross compiles, and who is responsible
for building and/or installing the libraries. However, it handles the
very common case of non-cross builds in a way entirely consistent with
GCC, so I'm hopeful this won't really hose anyone.

This is the second patch that I think should be backported to 3.4 to
give folks an easy to checkout and install working Clang+libc++
toolchain.

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

10 years agoMSVC ABI: Support C++11's auto on variables
David Majnemer [Tue, 21 Jan 2014 20:33:36 +0000 (20:33 +0000)]
MSVC ABI: Support C++11's auto on variables

The MSVC C++ ABI always uses the deduced type in place of auto when
generating external names for variables.

N.B.  MSVC doesn't support C++1y's 'operator auto' and this patch will
not give us said functionality.

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

10 years agoCorrect the function name shown in diagnostics in warn-thread-safety-analysis.c
David Blaikie [Tue, 21 Jan 2014 19:07:40 +0000 (19:07 +0000)]
Correct the function name shown in diagnostics in warn-thread-safety-analysis.c

Patch by Alex Wang.

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

10 years agoDebug info: use the file a typedef is defined in as its decl_file instead
Adrian Prantl [Tue, 21 Jan 2014 18:42:27 +0000 (18:42 +0000)]
Debug info: use the file a typedef is defined in as its decl_file instead
of the current compilation unit.
As a side effect this enables many more LTO uniquing opportunities.

This reapplies r199757 with a better testcase.

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

10 years agorevert 199757 for buildbot breakage.
Adrian Prantl [Tue, 21 Jan 2014 18:23:43 +0000 (18:23 +0000)]
revert 199757 for buildbot breakage.

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

10 years agoDebug info: use the file a typedef is defined in as its decl_file instead
Adrian Prantl [Tue, 21 Jan 2014 18:20:52 +0000 (18:20 +0000)]
Debug info: use the file a typedef is defined in as its decl_file instead
of the current compilation unit.
As a side effect this enables many more LTO uniquing opportunities.

rdar://problem/15851206

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

10 years agoFix -Wsometimes-uninitialized in r199754
Alp Toker [Tue, 21 Jan 2014 18:01:01 +0000 (18:01 +0000)]
Fix -Wsometimes-uninitialized in r199754

Also make the -m16 check x86-specific. Other archs may have a different take on
things.

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

10 years agoAdd -m16 option for using x86-*-*-code16 triple
David Woodhouse [Tue, 21 Jan 2014 17:19:44 +0000 (17:19 +0000)]
Add -m16 option for using x86-*-*-code16 triple

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

10 years agoclang-format: Enable formatting for .proto and .protodevel files.
Daniel Jasper [Tue, 21 Jan 2014 15:40:01 +0000 (15:40 +0000)]
clang-format: Enable formatting for .proto and .protodevel files.

Support for protocol buffer files seems complete enough.

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

10 years agoMacho-embedded: fix tests after last rename
Tim Northover [Tue, 21 Jan 2014 13:23:09 +0000 (13:23 +0000)]
Macho-embedded: fix tests after last rename

Very sorry, I managed to completely forget "make check".

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

10 years agoMacho-embedded: rename compiler-rt support from Darwin-embedded
Tim Northover [Tue, 21 Jan 2014 12:38:19 +0000 (12:38 +0000)]
Macho-embedded: rename compiler-rt support from Darwin-embedded

There's nothing Darwin-based in the files or target now, so the previous name
is now misleading.

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

10 years agoclang-format: text following #if is likely an expression.
Daniel Jasper [Tue, 21 Jan 2014 08:56:09 +0000 (08:56 +0000)]
clang-format: text following #if is likely an expression.

Before:
  #if AAAA &&BBBB

After:
  #if AAAA && BBBB

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

10 years agoNeither attribute overloadable nor enable_if are supported by GCC. Disable the
Nick Lewycky [Tue, 21 Jan 2014 04:31:12 +0000 (04:31 +0000)]
Neither attribute overloadable nor enable_if are supported by GCC. Disable the
GCC warning about attributes on function definitions for both of them.

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

10 years agoUse private linkage for utf-16 objc strings too.
Rafael Espindola [Tue, 21 Jan 2014 02:57:56 +0000 (02:57 +0000)]
Use private linkage for utf-16 objc strings too.

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

10 years agoNow that r199688 avoids the real issue, use private linkage for objc strings.
Rafael Espindola [Tue, 21 Jan 2014 01:50:12 +0000 (01:50 +0000)]
Now that r199688 avoids the real issue, use private linkage for objc strings.

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

10 years agoSimplify expression, made possible by r199702.
Nick Lewycky [Tue, 21 Jan 2014 01:30:30 +0000 (01:30 +0000)]
Simplify expression, made possible by r199702.

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

10 years agoRevert "CodeGen: Simplify CodeGenFunction::EmitCaseStmt"
Justin Bogner [Tue, 21 Jan 2014 00:35:11 +0000 (00:35 +0000)]
Revert "CodeGen: Simplify CodeGenFunction::EmitCaseStmt"

I misunderstood the discussion on this. The complexity here is
justified by the malloc overhead it saves.

This reverts commit r199302.

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

10 years agoUpdate FunctionTypeLoc and related names to match r199686
Alp Toker [Tue, 21 Jan 2014 00:32:38 +0000 (00:32 +0000)]
Update FunctionTypeLoc and related names to match r199686

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

10 years agoStop linking with crt1.o etc. for the iOS simulator. <rdar://problem/11800973>
Bob Wilson [Tue, 21 Jan 2014 00:17:10 +0000 (00:17 +0000)]
Stop linking with crt1.o etc. for the iOS simulator. <rdar://problem/11800973>

Recent versions of the iOS simulator no longer require linking with the
crt1.o, dylib1.o, or bundle1.o files. The relevant code is now included in
libSystem for the simulator.

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

10 years agoGive explicit sections for string constants used in NSStrings.
Rafael Espindola [Mon, 20 Jan 2014 20:33:18 +0000 (20:33 +0000)]
Give explicit sections for string constants used in NSStrings.

Without them they can be merged with non unnamed_addr constants during LTO.
The resulting constant is not unnamed_addr and goes in a different section,
which causes ld64 to crash.

A testcase that would crash before:

* file1.mm:
void g(id notification) {
  [notification valueForKey:@"name"];
}

* file2.cpp:
extern const char js_name_str[] = "name";

* file3.cpp
extern bool JS_GetProperty(const char *name);
extern const char js_name_str[];
bool js_ReportUncaughtException() { JS_GetProperty(js_name_str); }

run

clang file1.mm  -o file1.o -c -w -emit-llvm
clang file2.cpp -o file2.o -c -w -emit-llvm
clang file3.cpp -o file3.o -c -w

ld -dylib -o XUL file1.o file2.o file3.o -undefined dynamic_lookup.

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

10 years agoRename FunctionProtoType accessors from 'arguments' to 'parameters'
Alp Toker [Mon, 20 Jan 2014 20:26:09 +0000 (20:26 +0000)]
Rename FunctionProtoType accessors from 'arguments' to 'parameters'

Fix a perennial source of confusion in the clang type system: Declarations and
function prototypes have parameters to which arguments are supplied, so calling
these 'arguments' was a stretch even in C mode, let alone C++ where default
arguments, templates and overloading make the distinction important to get
right.

Readability win across the board, especially in the casting, ADL and
overloading implementations which make a lot more sense at a glance now.

Will keep an eye on the builders and update dependent projects shortly.

No functional change.

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

10 years agoSimplify further.
Rafael Espindola [Mon, 20 Jan 2014 20:13:11 +0000 (20:13 +0000)]
Simplify further.

Thanks to David Blaikie for the push.

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

10 years agoObjectiveC driver. reinstate -fno-objc-legacy-dispatch behavior
Fariborz Jahanian [Mon, 20 Jan 2014 19:32:33 +0000 (19:32 +0000)]
ObjectiveC driver. reinstate -fno-objc-legacy-dispatch behavior
when the deployment target is 10.5. // rdar://15852259

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

10 years agoAdding a bit of documentation that was missed with r198883 (when ParseArgumentsAsUnev...
Aaron Ballman [Mon, 20 Jan 2014 18:42:10 +0000 (18:42 +0000)]
Adding a bit of documentation that was missed with r198883 (when ParseArgumentsAsUnevaluated was added).

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

10 years agoExposed a declarative way to specify that an attribute can be duplicated when merging...
Aaron Ballman [Mon, 20 Jan 2014 18:07:09 +0000 (18:07 +0000)]
Exposed a declarative way to specify that an attribute can be duplicated when merging attributes on a declaration. This replaces some hard-coded functionality from Sema.

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

10 years agoRemove some hard-coded specialness for thread-safety attributes from the parser,...
Aaron Ballman [Mon, 20 Jan 2014 17:18:35 +0000 (17:18 +0000)]
Remove some hard-coded specialness for thread-safety attributes from the parser, and made it more declarative. If an attribute is allowed to appear on a function definition when late parsed, it can now use the FunctionDefinition attribute subject. It's treated as a FunctionDecl for most purposes, except it also gets exposed on the AttributeList so that it can be used while parsing.

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

10 years agoclang-format: Properly format custom options in protocol buffer definitions.
Daniel Jasper [Mon, 20 Jan 2014 16:47:22 +0000 (16:47 +0000)]
clang-format: Properly format custom options in protocol buffer definitions.

Before:
  option(my_option) = "abc";

After:
  option (my_option) = "abc";

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

10 years agoFormatting cleanups; no functional changes.
Aaron Ballman [Mon, 20 Jan 2014 16:15:55 +0000 (16:15 +0000)]
Formatting cleanups; no functional changes.

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

10 years agoAdd a triple. Should fix the 64 bit bots.
Rafael Espindola [Mon, 20 Jan 2014 16:15:48 +0000 (16:15 +0000)]
Add a triple. Should fix the 64 bit bots.

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

10 years agoMake the test more strict.
Rafael Espindola [Mon, 20 Jan 2014 15:58:59 +0000 (15:58 +0000)]
Make the test more strict.

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

10 years agoFixing a typo (turned out to be harmless since the default priority values are the...
Aaron Ballman [Mon, 20 Jan 2014 15:22:57 +0000 (15:22 +0000)]
Fixing a typo (turned out to be harmless since the default priority values are the same between the two attributes).

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

10 years agoRemove virtual methods that were added in 2009 and still had 1 implementation.
Rafael Espindola [Mon, 20 Jan 2014 15:19:43 +0000 (15:19 +0000)]
Remove virtual methods that were added in 2009 and still had 1 implementation.

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

10 years agoSince the diagnostics engine understands Attr objects, this code is no longer require...
Aaron Ballman [Mon, 20 Jan 2014 15:06:09 +0000 (15:06 +0000)]
Since the diagnostics engine understands Attr objects, this code is no longer required -- we can just pass in the attribute directly.

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

10 years agoMaking some minor improvements to r199626.
Aaron Ballman [Mon, 20 Jan 2014 14:19:44 +0000 (14:19 +0000)]
Making some minor improvements to r199626.

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

10 years agoHasFunctionProto is a more strict version of FunctionLike. Since attribute subjects...
Aaron Ballman [Mon, 20 Jan 2014 14:18:40 +0000 (14:18 +0000)]
HasFunctionProto is a more strict version of FunctionLike. Since attribute subjects are inclusive (passing a single subject test means no subject-related diagnostic will fire), these two subjects should not be combined.

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

10 years agoclang-format: Leave 2 empty lines in Google's JavaScript style.
Daniel Jasper [Mon, 20 Jan 2014 14:10:30 +0000 (14:10 +0000)]
clang-format: Leave 2 empty lines in Google's JavaScript style.

As per the style guide, two lines are required between top-level
elements.

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

10 years ago[ARM] Add ACLE enum/wchar size predefines
Bradley Smith [Mon, 20 Jan 2014 10:52:00 +0000 (10:52 +0000)]
[ARM] Add ACLE enum/wchar size predefines

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

10 years ago[CMake] Apply ADDITIONAL_HEADERS introduced in r199639.
NAKAMURA Takumi [Mon, 20 Jan 2014 10:24:05 +0000 (10:24 +0000)]
[CMake] Apply ADDITIONAL_HEADERS introduced in r199639.

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

10 years agoAdd the test trees that were supposed to be part of r199632.
Chandler Carruth [Mon, 20 Jan 2014 09:47:21 +0000 (09:47 +0000)]
Add the test trees that were supposed to be part of r199632.

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

10 years agoMake the Linux support for finding libc++ somewhat less braindead.
Chandler Carruth [Mon, 20 Jan 2014 09:42:24 +0000 (09:42 +0000)]
Make the Linux support for finding libc++ somewhat less braindead.

Now instead of just looking in the system root for it, we also look
relative to the clang binary's directory. This should "just work" in
almost all cases. I've added test cases accordingly.

This is probably *very* worthwhile to backport to the 3.4 branch so that
folks can check it out, build it, and use that as their host compiler
going forward.

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

10 years agoPR18551: accepts invalid strong enum to bool when operator! is used
Alp Toker [Mon, 20 Jan 2014 07:20:22 +0000 (07:20 +0000)]
PR18551: accepts invalid strong enum to bool when operator! is used

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

10 years agoWire up basic parser/sema support for attribute 'returns_nonnull'.
Ted Kremenek [Mon, 20 Jan 2014 05:50:47 +0000 (05:50 +0000)]
Wire up basic parser/sema support for attribute 'returns_nonnull'.

This attribute is supported by GCC.  More generally it should
probably be a type attribute, but this behavior matches 'nonnull'.

This patch does not include warning logic for checking if a null
value is returned from a function annotated with this attribute.
That will come in subsequent patches.

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

10 years agoThese attributes are no longer "checker-specific."
Ted Kremenek [Mon, 20 Jan 2014 05:50:41 +0000 (05:50 +0000)]
These attributes are no longer "checker-specific."

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

10 years agoMSVC 2013 type trait support
Alp Toker [Mon, 20 Jan 2014 00:24:09 +0000 (00:24 +0000)]
MSVC 2013 type trait support

Implement type trait primitives used in the latest edition of the Microsoft
standard C++ library type_traits header.

With this change we can parse much of the Visual Studio 2013 standard headers,
particularly anything that includes <type_traits>.

Fully implemented, available in all language modes:

 * __is_constructible()
 * __is_nothrow_constructible()
 * __is_nothrow_assignable()

Partially implemented, semantic analysis WIP, available as MS extensions:

 * __is_destructible()
 * __is_nothrow_destructible()

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

10 years agoFix nothrow trait with multiple default constructors
Alp Toker [Mon, 20 Jan 2014 00:23:47 +0000 (00:23 +0000)]
Fix nothrow trait with multiple default constructors

Check all default ctors, not just the first one we see. This brings
__has_nothrow_constructor() in line with the other unary type traits.

A C++ class can have multiple default constructors but clang was only checking
the first one written, presumably due to ambiguity in the GNU specification.

MSVC has the same bug, while g++ has the correct implementation which we now
match.

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

10 years agoPR18544: don't assert that 'operator new' is not declared inside a namespace;
Richard Smith [Sun, 19 Jan 2014 23:25:37 +0000 (23:25 +0000)]
PR18544: don't assert that 'operator new' is not declared inside a namespace;
such an assert will fail in invalid code that does so!

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

10 years ago[CMake] Deprecate CLANG_RUNTIME_OUTPUT_INTDIR and CLANG_LIBRARY_OUTPUT_INTDIR.
NAKAMURA Takumi [Sun, 19 Jan 2014 13:00:01 +0000 (13:00 +0000)]
[CMake] Deprecate CLANG_RUNTIME_OUTPUT_INTDIR and CLANG_LIBRARY_OUTPUT_INTDIR.

LLVM_*_OUTPUT_INTDIR should be available everywhere. It was my mistake when I introduced INTDIR stuff.

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

10 years ago[CMake][Standalone] Redefine LLVM_RUNTIME_OUTPUT_INTDIR and LLVM_LIBRARY_OUTPUT_INTDI...
NAKAMURA Takumi [Sun, 19 Jan 2014 12:55:14 +0000 (12:55 +0000)]
[CMake][Standalone] Redefine LLVM_RUNTIME_OUTPUT_INTDIR and LLVM_LIBRARY_OUTPUT_INTDIR to point appropriate target directories.

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

10 years ago[CMake] Prune LLVM_TOOLS_DIR and LLVM_LIBS_DIR in clang/test/CMakeLists.txt. They...
NAKAMURA Takumi [Sun, 19 Jan 2014 12:45:35 +0000 (12:45 +0000)]
[CMake] Prune LLVM_TOOLS_DIR and LLVM_LIBS_DIR in clang/test/CMakeLists.txt. They are overridden in configure_lit_site_cfg().

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

10 years agoclang-format: Better support and testing for protocol buffers.
Daniel Jasper [Sun, 19 Jan 2014 09:04:08 +0000 (09:04 +0000)]
clang-format: Better support and testing for protocol buffers.

With this patch, there is dedicated testing for protocol buffers
(https://developers.google.com/protocol-buffers/).

Also some minor tweaks formatting tweaks.

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

10 years ago[CMake] check-clang requires clang-tblgen. It is not required by anyone when external...
NAKAMURA Takumi [Sun, 19 Jan 2014 08:54:48 +0000 (08:54 +0000)]
[CMake] check-clang requires clang-tblgen. It is not required by anyone when external CLANG_TABLEGEN is specified.

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

10 years agoclang-format: Fix ObjC block as first call parameter formatting.
Daniel Jasper [Sun, 19 Jan 2014 07:46:32 +0000 (07:46 +0000)]
clang-format: Fix ObjC block as first call parameter formatting.

Before:
  foo (^{ bar(); });
After:
  foo(^{ bar(); });

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

10 years agoHarden InitListExpr::isStringLiteralInit() against getInit() returning null.
Ted Kremenek [Sun, 19 Jan 2014 06:31:34 +0000 (06:31 +0000)]
Harden InitListExpr::isStringLiteralInit() against getInit() returning null.

This led to a crash on invalid code (sorry, no good test case).

Fixes <rdar://problem/15831804>.

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

10 years agoFix comment typos
Alp Toker [Sat, 18 Jan 2014 21:49:37 +0000 (21:49 +0000)]
Fix comment typos

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

10 years agodocs: clarify the role of compiler-builtin type trait primitives
Alp Toker [Sat, 18 Jan 2014 21:49:02 +0000 (21:49 +0000)]
docs: clarify the role of compiler-builtin type trait primitives

Update the documentation to clarify the intent of clang's built-in type trait
facilities, their relation to user-facing C++ type traits and means to check
for availability.

Also explain that __has_feature() is not currently up to date and should not
generally be used in user code (there's a proposal to provide more consistent
checks via __has_builtin(), see cfe-dev).

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

10 years agoMake unreferenced f-group options anonymous
Alp Toker [Sat, 18 Jan 2014 20:45:14 +0000 (20:45 +0000)]
Make unreferenced f-group options anonymous

These were showing up with find-unused-options.sh

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

10 years agoTry to fix this link.
Nick Lewycky [Sat, 18 Jan 2014 02:29:10 +0000 (02:29 +0000)]
Try to fix this link.

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