Commit Graph

33203 Commits

Author SHA1 Message Date
Fariborz Jahanian dae5ec5915 ObjectiveC objc_bridge. Minor refactoring.
// rdar://15454846

llvm-svn: 195070
2013-11-19 01:38:23 +00:00
Jiangning Liu c8b0a1ad95 Clean up predefined macros for AArch64 to follow ACLE 2.0.
llvm-svn: 195068
2013-11-19 01:33:17 +00:00
Fariborz Jahanian 509f31efd0 ObjectiveC 'objc_bridging'. Assorment of improvements
per Doug/Jordan comments. // rdar://15454846.

llvm-svn: 195066
2013-11-19 01:23:07 +00:00
Fariborz Jahanian db3d8554be ObjectiveC ARC. Adopt objc_bridge attribute
on struct/union/class instead of typedef of
such types. // rdar://15454846

llvm-svn: 195061
2013-11-19 00:09:48 +00:00
David Blaikie ba4773659b DebugInfo: Update caller based on DIType's MDNode* ctor becoming explicit in r195055.
llvm-svn: 195056
2013-11-18 23:38:26 +00:00
Kevin Enderby 319baa4ed4 Change the clang driver with the use of -no-integrated-as for darwin to use
the -Q flag to the as(1) assembler driver.

We will soon be switching the darwin as(1) assembler driver to call clang(1)
and use the intergated assembler by default.  To do this and still support
clang(1)'s -no-integrated-as flag, when clang(1) runs the as(1) assembler
driver and -no-integrated-as is used it needs to pass the -Q flag to as(1)
so it uses its GNU based assembler, and not turn around and call clag(1)'s
integrated assembler. 

rdar://15495921

llvm-svn: 195054
2013-11-18 23:30:29 +00:00
Rafael Espindola 4903c87386 The attached patch is a follow up from my previous one. The existing
logic was not handling typedefs as free functions. This was not
causing problems with the existing tests, but does with the microsoft
abi where they have to get a different calling convention.

I will try to refactor this into a method on Declarator in a second.

llvm-svn: 195050
2013-11-18 22:40:04 +00:00
Aaron Ballman ff924b08dd The code using the StmtPrinterHelper object failed to account for a null object in many cases, which could have led to crashes were it ever to be null. Now passing the object by reference instead of by pointer because it is never null in practice. No functional changes intended.
llvm-svn: 195043
2013-11-18 20:11:50 +00:00
Rafael Espindola f02d8b1dff Use the default method CC in GetFullTypeForDeclarator.
Before this patch explicit template instatiations of member function templates
were failing with the microsoft abi and 32 bits. This was happening because
the expected and computed function types had different calling conventions.

This patch fixes it by considering the default calling convention in
GetFullTypeForDeclarator.

This fixes pr17973.

llvm-svn: 195032
2013-11-18 20:05:33 +00:00
Aaron Ballman ef1cf830e0 Adding an assert to help catch possible buffer underruns.
llvm-svn: 195024
2013-11-18 18:29:00 +00:00
Benjamin Kramer a8553497a3 Make helper function static.
llvm-svn: 195017
2013-11-18 16:50:24 +00:00
Samuel Benzaquen 464c1cbc3f Add partial support for the hasDeclaration() matcher in the dynamic layer.
Summary:
Add partial support for the hasDeclaration() matcher in the dynamic layer.
This matcher has some special logic to allow any type that has a getDecl() method.  We do not support this right now.

Reviewers: klimek

CC: cfe-commits, revane

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

llvm-svn: 195013
2013-11-18 14:53:42 +00:00
Sylvestre Ledru 5abf2ec12d Using an invalid -O falls back on -O3 instead of an error
Summary:
Currently with clang:
$ clang -O20 foo.c
error: invalid value '20' in '-O20'

With the patch:
$ clang -O20 foo.c
warning: optimization level '-O20' is unsupported; using '-O3' instead.
1 warning generated.

This matches the gcc behavior (with a warning added)

Pass all tests:
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 94.14s
  Expected Passes    : 6721
  Expected Failures  : 20
  Unsupported Tests  : 17

(which was not the case of http://llvm-reviews.chandlerc.com/D2125)

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

llvm-svn: 195009
2013-11-18 13:23:07 +00:00
Alexey Bataev ee6507dfdc Replaced bool parameters in SkipUntil function with single bit-based parameter.
llvm-svn: 194994
2013-11-18 08:17:37 +00:00
Hao Liu 5e4ce1ae9d Implement the newly added AArch64 ACLE functions for ld1/st1 with 2/3/4 vectors.
The functions are like: vst1_s8_x2 ...

llvm-svn: 194991
2013-11-18 06:33:43 +00:00
Rafael Espindola 8f41aee760 Remove method that always returns true.
llvm-svn: 194984
2013-11-17 22:42:24 +00:00
Rafael Espindola d1821587c7 Remove two unused #ifdefs.
llvm-svn: 194983
2013-11-17 22:36:07 +00:00
NAKAMURA Takumi 5335cf331b Tooling/CompilationDatabase.cpp: Use \return here instead of \param[out]. [-Wdocumentation]
llvm-svn: 194971
2013-11-17 18:05:49 +00:00
Alp Toker b90f560303 Remove a bad string compare from r194968
lib/Tooling/CompilationDatabase.cpp:275:34: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare]

This assert() should probably be fixed and added back at some point.

llvm-svn: 194969
2013-11-17 16:49:24 +00:00
Edwin Vane eb56f4fe2f Relax some preconditions for using FixedCompilationDatabase.
FixedCompilationDatabase (FCD) requires that the arguments it consumes after
'--' must not include positional parameters or the argv[0] of the tool. This
patch relaxes those restrictions.

llvm-svn: 194968
2013-11-17 16:08:04 +00:00
Hal Finkel ce0697f475 Add -freroll-loops to enable loop rerolling
This adds -freroll-loops (and -fno-reroll-loops in the usual way) to enable
loop rerolling as part of the optimization pass manager. This transformation
can enable vectorization, reduce code size (or both).

Briefly, loop rerolling can transform a loop like this:

for (int i = 0; i < 3200; i += 5) {
  a[i]     += alpha * b[i];
  a[i + 1] += alpha * b[i + 1];
  a[i + 2] += alpha * b[i + 2];
  a[i + 3] += alpha * b[i + 3];
  a[i + 4] += alpha * b[i + 4];
}

into this:

for (int i = 0; i < 3200; ++i) {
  a[i] += alpha * b[i];
}

Loop rerolling is currently disabled by default at all optimization levels.

llvm-svn: 194967
2013-11-17 16:03:29 +00:00
Anton Yartsev 968c60a554 [analyzer] Better modeling of memcpy by the CStringChecker (PR16731).
New rules of invalidation/escape of the source buffer of memcpy: the source buffer contents is invalidated and escape while the source buffer region itself is neither invalidated, nor escape.
In the current modeling of memcpy the information about allocation state of regions, accessible through the source buffer, is not copied to the destination buffer and we can not track the allocation state of those regions anymore. So we invalidate/escape the source buffer indirect regions in anticipation of their being invalidated for real later. This eliminates false-positive leaks reported by the unix.Malloc and alpha.cplusplus.NewDeleteLeaks checkers for the cases like

char *f() {
  void *x = malloc(47);
  char *a;
  memcpy(&a, &x, sizeof a);
  return a;
}

llvm-svn: 194953
2013-11-17 09:18:48 +00:00
Hao Liu 90ee2f1fd7 Fix the problem that the arm_neon.h can't be used in a cpp file. Also fix a minor bug with poly64 name mangling.
llvm-svn: 194952
2013-11-17 09:14:46 +00:00
Fariborz Jahanian 2c31212827 ObjectiveC ARC. More validation of toll-free bridging of
CF objects with objc_bridge'ing annotaiton.
// rdar://15454846

llvm-svn: 194938
2013-11-16 23:22:37 +00:00
Fariborz Jahanian 8a0210e535 ObjectiveC ARC. Validate toll free bridge casting
of ObjectiveC objects to CF types when CF type
has the objc_bridge attribute.

llvm-svn: 194930
2013-11-16 19:16:32 +00:00
Benjamin Kramer 847c1d90e1 Remove unused but set variable.
llvm-svn: 194920
2013-11-16 11:47:52 +00:00
Richard Smith fa27bc4c7b If a replaceable global operator new/delete is marked inline, don't warn if
it's also __attribute__((used)), since that undoes the problematic part of
'inline'.

llvm-svn: 194916
2013-11-16 01:57:09 +00:00
Fariborz Jahanian f07183ce94 ObjetiveC ARC. Start diagnosing invalid toll free bridging.
// rdar://15454846.

llvm-svn: 194915
2013-11-16 01:45:25 +00:00
Jim Grosbach 82eee26877 X86: Make specifying avx2 simpler on Darwin with '-arch'
Teach the '-arch' command line option to enable the compiler-friendly
features of core-avx2 CPUs on Darwin. Pass the information along in the
target triple like Darwin+ARM does.

llvm-svn: 194907
2013-11-16 00:53:35 +00:00
Richard Smith 13dfdc88a9 Downgrade the Error on an 'inline' operator new or delete to an ExtWarn. Some
projects are relying on such (questionable) practices, so we should give them
a way to opt out of this diagnostic.

llvm-svn: 194905
2013-11-16 00:47:38 +00:00
DeLesley Hutchins 68cc3f13c2 Consumed analysis: track state of temporary objects.
Earlier versions discarded the state too soon, and did not track state changes,
e.g. when passing a temporary to a move constructor.  Patch by
chris.wailes@gmail.com; review and minor fixes by delesley.

llvm-svn: 194900
2013-11-16 00:22:43 +00:00
John Thompson 4762b23e6c Corrected comment about MS prgama warning.
llvm-svn: 194897
2013-11-16 00:16:03 +00:00
Ana Pazos 6f2a47a9e5 Implemented aarch64 Neon scalar vmulx_lane intrinsics
Implemented aarch64 Neon scalar vfma_lane intrinsics
Implemented aarch64 Neon scalar vfms_lane intrinsics

Implemented legacy vmul_n_f64, vmul_lane_f64, vmul_laneq_f64
intrinsics (v1f64 parameter type) using Neon scalar instructions.

Implemented legacy vfma_lane_f64, vfms_lane_f64,
vfma_laneq_f64, vfms_laneq_f64 intrinsics (v1f64 parameter type)
using Neon scalar instructions.

llvm-svn: 194889
2013-11-15 23:33:31 +00:00
Fariborz Jahanian b8233193a4 ObjectiveC ARC. Only briding of pointer to struct CF object is allowed.
Improve on wording on illegal objc_bridge argumment.
// rdar://15454846

llvm-svn: 194881
2013-11-15 23:14:45 +00:00
Richard Smith 2ac43ad8db PR17949: Fix crash if someone puts a namespace inside a class template.
llvm-svn: 194872
2013-11-15 23:00:02 +00:00
Richard Smith a3e01cf822 PR8455: Handle an attribute between a goto label and a variable declaration per
the GNU documentation: the attribute only appertains to the label if it is
followed by a semicolon. Based on a patch by Aaron Ballman!

llvm-svn: 194869
2013-11-15 22:45:29 +00:00
Hans Wennborg 96655c0ee4 Fix typo in CGRecordLayoutBuilder.cpp: s/Field/Fields/ in comment
llvm-svn: 194863
2013-11-15 22:31:11 +00:00
Fariborz Jahanian a649c82d69 ObjectiveC ARC. Lookup type associated with objc_bridage at
the point of CF object type-cast and issue diagnostic
if it is not a valid ObjectiveC class. // rdar//15454846.
This is wip.

llvm-svn: 194861
2013-11-15 22:18:17 +00:00
Richard Smith ca9b0b6863 Diagnose C++11 attributes before fp_contract pragmas.
llvm-svn: 194850
2013-11-15 21:10:54 +00:00
Alp Toker 7874bdc6c1 Revert "Using an invalid -O falls back on -O3 instead of an error"
Trying to fix test failures since earlier today.

One of the tests added in this commit is outputting test/Driver/clang_f_opts.s
which the builders that build in-tree (eg. clang-native-arm-cortex-a9) are
trying to run as a test case, causing failures.

clang_f_opts.c:
  If -### doesn't emit the warning then this test probably shouldn't be in
  here in the first place. Frontend maybe?

invalid-o-level.c:
  Running %clang_cc1 in the Driver tests doesn't make sense because -cc1
  bypasses the driver. (I'm not reverting the commit that introduced this but
  please fix instead of keeping it this way.)

Reverting to fix the build failures and also so that the tests can be thought
out more thoroughly.

This reverts commit r194817.

llvm-svn: 194845
2013-11-15 20:40:58 +00:00
Alp Toker 3aa8779ca2 Remove an unused local from r194827
llvm-svn: 194835
2013-11-15 18:09:28 +00:00
Justin Bogner 13a641b338 Darwin: Look for libc++ headers in include/, rather than lib/
Up until now we were expecting that when libc++ is installed alongside
clang the headers would be in lib/, which was true if the configure
build was used and false if the cmake build was.

We've now corrected the configure build to install in include/, and
with this change we'll be able to find the correct headers with both
build systems.

llvm-svn: 194834
2013-11-15 18:07:59 +00:00
Fariborz Jahanian 617e49ad59 ObjectiveC. Fixes a bogus warning of unused backing
ivar when property belongs to a super class and
currnt class happens to have a method with same name as
property. // rdar//15473432

llvm-svn: 194830
2013-11-15 17:48:00 +00:00
Hans Wennborg 88497d6157 [-cxx-abi microsoft] Emit thunks for pointers to virtual member functions
Instead of storing the vtable offset directly in the function pointer and
doing a branch to check for virtualness at each call site, the MS ABI
generates a thunk for calling the function at a specific vtable offset,
and puts that in the function pointer.

This patch adds support for emitting such thunks. However, it doesn't support
pointers to virtual member functions that are variadic, have an incomplete
aggregate return type or parameter, or are overriding a function in a virtual
base class.

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

llvm-svn: 194827
2013-11-15 17:24:45 +00:00
Alexander Potapenko 868cca96c4 [ASan] Link with libclang_rt.asan_iossim_dynamic.dylib when targeting the iOS simulator.
Add a test.

llvm-svn: 194820
2013-11-15 16:07:44 +00:00
Sylvestre Ledru 6ae3980118 Using an invalid -O falls back on -O3 instead of an error
Summary:
Currently with clang:
$ clang -O20 foo.c
error: invalid value '20' in '-O20'

With the patch:
$ clang -O20 foo.c
warning: optimization level '-O20' is unsupported; using '-O3' instead.
1 warning generated.

This matches the gcc behavior (with a warning added)

Pass all tests:
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 94.14s
  Expected Passes    : 6721
  Expected Failures  : 20
  Unsupported Tests  : 17

(which was not the case of http://llvm-reviews.chandlerc.com/D2125)

Reviewers: chandlerc, rafael, rengolin, hfinkel

Reviewed By: rengolin

CC: cfe-commits

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

llvm-svn: 194817
2013-11-15 15:39:14 +00:00
Richard Smith ce587f5eb9 When we hit a #include directive that maps to a module import, emit a token
representing the module import rather than making the module immediately
visible. This serves two goals:
 * It avoids making declarations in the module visible prematurely, if we
   walk past the #include during a tentative parse, for instance, and
 * It gives a diagnostic (although, admittedly, not a very nice one) if
   a header with a corresponding module is included anywhere other than
   at the top level.

llvm-svn: 194782
2013-11-15 04:24:58 +00:00
Richard Smith c156470be5 PR17533 and duplicates: don't compute the return type of an overloaded operator
until after we've referenced the operator; otherwise, we might pick up a
not-yet-deduced type.

llvm-svn: 194775
2013-11-15 02:58:23 +00:00
Richard Smith 83d4834597 Don't reject dependent range-based for loops in constexpr functions. The loop
variable isn't really uninitialized, it's just not initialized yet.

llvm-svn: 194767
2013-11-15 02:29:26 +00:00
Matt Arsenault 00e65b2afe Fix test failures after addrspacecast added.
Bitcasts between address spaces are no longer allowed.

llvm-svn: 194765
2013-11-15 02:19:52 +00:00