Commit Graph

50220 Commits

Author SHA1 Message Date
Ben Langmuir 9eb229bfe5 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.

llvm-svn: 199852
2014-01-22 23:19:39 +00:00
Richard Smith 8c7bd6ac1a 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.)

llvm-svn: 199850
2014-01-22 23:07:19 +00:00
Aaron Ballman bc909618f2 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.
llvm-svn: 199834
2014-01-22 21:51:20 +00:00
Mark Seaborn 74020868ee 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

llvm-svn: 199830
2014-01-22 20:11:01 +00:00
Richard Smith 566184ac75 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.

llvm-svn: 199829
2014-01-22 20:09:10 +00:00
Hans Wennborg 80429048db clang-cl: Expose the -ferror-limit= option
llvm-svn: 199828
2014-01-22 20:06:53 +00:00
David Blaikie ec59e75ef2 Driver: Suppression support for -Wa,--compress-debug-sections
(to go with existing suppression of -Wa,-compress-debug-sections)

llvm-svn: 199822
2014-01-22 19:22:21 +00:00
Fariborz Jahanian dad9630398 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

llvm-svn: 199820
2014-01-22 19:02:20 +00:00
Weiming Zhao fb5c21a70b 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.

llvm-svn: 199819
2014-01-22 18:42:13 +00:00
Daniel Jasper 6b70ec0d46 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.

llvm-svn: 199817
2014-01-22 17:01:47 +00:00
Anton Yartsev fee669054f [analyzer] The patch prevents the analyzer from crashing during CFG dump.
llvm-svn: 199800
2014-01-22 13:19:48 +00:00
NAKAMURA Takumi 9f2538d883 [CMake][MS] libclang: Invalidate LLVM_EXPORTED_SYMBOL_FILE to suppress LNK4197.
Each functions is exported as "dllexport" in include/clang-c.
See also KB835326.

llvm-svn: 199799
2014-01-22 13:02:59 +00:00
Daniel Jasper 215d6c8c50 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;

llvm-svn: 199796
2014-01-22 08:04:52 +00:00
Alp Toker 2bd4a28664 Change a dyn_cast from r199794 to a straight cast
It's guaranteed to be a CXXMethodDecl.

llvm-svn: 199795
2014-01-22 07:53:08 +00:00
Alp Toker a2794f9f36 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.

llvm-svn: 199794
2014-01-22 07:29:52 +00:00
Ted Kremenek ef9e7f8059 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.

llvm-svn: 199790
2014-01-22 06:10:28 +00:00
Hans Wennborg a6ae1209df clang-cl: make /Zp a Joined option (PR18503)
We don't currently support this option, but we should be able to parse it.

llvm-svn: 199787
2014-01-22 03:23:35 +00:00
Richard Smith 31875a0a6a Add a test file missed from r199782.
llvm-svn: 199783
2014-01-22 02:05:03 +00:00
Richard Smith b63b6ee9a0 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.)

llvm-svn: 199782
2014-01-22 01:43:19 +00:00
Fariborz Jahanian bbf322b0bb ObjectiveC driver. change to reinstate -fno-objc-legacy-dispatch behavior
when the deployment target is 10.5. // rdar://15852259

llvm-svn: 199780
2014-01-22 00:43:54 +00:00
Richard Smith c278c00613 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!

llvm-svn: 199779
2014-01-22 00:30:17 +00:00
Richard Smith e81daee21b 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!

llvm-svn: 199778
2014-01-22 00:27:42 +00:00
Nico Rieck f8e8b5f5c2 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.

llvm-svn: 199774
2014-01-21 23:54:36 +00:00
Alp Toker 601b22c377 Correct various uses of 'argument' that in fact refer to function parameters
Cleanup only.

llvm-svn: 199773
2014-01-21 23:35:24 +00:00
Richard Smith 111d3485af Fix regression in r197623: only diagnose a by-copy capture of an incomplete
type if the capture is, actually, by copy.

llvm-svn: 199772
2014-01-21 23:27:46 +00:00
Chandler Carruth 902efc61be 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.

llvm-svn: 199769
2014-01-21 22:49:05 +00:00
David Majnemer b9a5f2d3b6 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.

llvm-svn: 199764
2014-01-21 20:33:36 +00:00
David Blaikie 24b71b3072 Correct the function name shown in diagnostics in warn-thread-safety-analysis.c
Patch by Alex Wang.

llvm-svn: 199762
2014-01-21 19:07:40 +00:00
Adrian Prantl 3eff225a44 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.

llvm-svn: 199760
2014-01-21 18:42:27 +00:00
Adrian Prantl cb6e1257ff revert 199757 for buildbot breakage.
llvm-svn: 199758
2014-01-21 18:23:43 +00:00
Adrian Prantl 83788519a5 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

llvm-svn: 199757
2014-01-21 18:20:52 +00:00
Alp Toker 3e2aa33532 Fix -Wsometimes-uninitialized in r199754
Also make the -m16 check x86-specific. Other archs may have a different take on
things.

llvm-svn: 199755
2014-01-21 18:01:01 +00:00
David Woodhouse 6996f6b9ec Add -m16 option for using x86-*-*-code16 triple
llvm-svn: 199754
2014-01-21 17:19:44 +00:00
Daniel Jasper 2158912a4e clang-format: Enable formatting for .proto and .protodevel files.
Support for protocol buffer files seems complete enough.

llvm-svn: 199750
2014-01-21 15:40:01 +00:00
Tim Northover d875d34171 Macho-embedded: fix tests after last rename
Very sorry, I managed to completely forget "make check".

llvm-svn: 199739
2014-01-21 13:23:09 +00:00
Tim Northover 1a9b904b76 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.

llvm-svn: 199733
2014-01-21 12:38:19 +00:00
Daniel Jasper 7cfde414e1 clang-format: text following #if is likely an expression.
Before:
  #if AAAA &&BBBB

After:
  #if AAAA && BBBB

llvm-svn: 199713
2014-01-21 08:56:09 +00:00
Nick Lewycky 36e9b3ccff Neither attribute overloadable nor enable_if are supported by GCC. Disable the
GCC warning about attributes on function definitions for both of them.

llvm-svn: 199710
2014-01-21 04:31:12 +00:00
Rafael Espindola e1bd71fea4 Use private linkage for utf-16 objc strings too.
llvm-svn: 199709
2014-01-21 02:57:56 +00:00
Rafael Espindola 6839d23be7 Now that r199688 avoids the real issue, use private linkage for objc strings.
llvm-svn: 199705
2014-01-21 01:50:12 +00:00
Nick Lewycky d950ae74a3 Simplify expression, made possible by r199702.
llvm-svn: 199703
2014-01-21 01:30:30 +00:00
Justin Bogner e25ffdf8a1 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.

llvm-svn: 199700
2014-01-21 00:35:11 +00:00
Alp Toker b3fd5cfa81 Update FunctionTypeLoc and related names to match r199686
llvm-svn: 199699
2014-01-21 00:32:38 +00:00
Bob Wilson 74b6cd15ed 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.

llvm-svn: 199696
2014-01-21 00:17:10 +00:00
Rafael Espindola d19f80a0b4 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.

llvm-svn: 199688
2014-01-20 20:33:18 +00:00
Alp Toker 9cacbabd33 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.

llvm-svn: 199686
2014-01-20 20:26:09 +00:00
Rafael Espindola 8ff1610f06 Simplify further.
Thanks to David Blaikie for the push.

llvm-svn: 199685
2014-01-20 20:13:11 +00:00
Fariborz Jahanian 15f60cb2ba ObjectiveC driver. reinstate -fno-objc-legacy-dispatch behavior
when the deployment target is 10.5. // rdar://15852259

llvm-svn: 199682
2014-01-20 19:32:33 +00:00
Aaron Ballman b39a9b8b0c Adding a bit of documentation that was missed with r198883 (when ParseArgumentsAsUnevaluated was added).
llvm-svn: 199679
2014-01-20 18:42:10 +00:00
Aaron Ballman b9023ed0f6 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.
llvm-svn: 199677
2014-01-20 18:07:09 +00:00