Commit Graph

60841 Commits

Author SHA1 Message Date
Michael Kuperstein 6890188ea3 [X86] Mark inregs correctly for MCU psABI
The MCU psABI calling convention is somewhat, but not quite, like -mregparm 3.
In particular, the rules involving structs are different.

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

llvm-svn: 251224
2015-10-25 08:18:20 +00:00
Devin Coughlin 26c5df2c21 [analyzer] scan-build: Teach ccc-analyzer about -Xclang.
Update ccc-analyzer to forward both -Xclang and its following argument to the
the compiler driver. Previously we were dropping -Xclang and forwarding the
argument on its own if it matched other forwarding criteria. This caused the
argument to be interpreted as a driver rather than a frontend option.

llvm-svn: 251218
2015-10-25 01:30:18 +00:00
Rafael Espindola a9195877a5 Simplify boolean conditional return statements in lib/Basic.
Patch by Richard.

llvm-svn: 251214
2015-10-24 23:15:31 +00:00
NAKAMURA Takumi 25ca34c727 clang/module.modulemap: s/Basic/BuiltinsR600.def/Basic/BuiltinsAMDGPU.def/
llvm-svn: 251182
2015-10-24 07:16:41 +00:00
Adrian Prantl 28ba6fda48 Fixup this testcase after r251120.
I accidentally tested r251120 with assertions disabled.

llvm-svn: 251126
2015-10-23 17:25:17 +00:00
Artyom Skrobov 05d85aee2e [ARM] Renaming +t2dsp feature into +dsp, as discussed on llvm-dev
llvm-svn: 251124
2015-10-23 17:19:02 +00:00
Adrian Prantl d43fe0bd39 Module Debugging: Emit module debug info for types inside of Objective-C
containers.

rdar://problem/23196170

llvm-svn: 251120
2015-10-23 17:02:22 +00:00
Adrian Prantl abdd6fc48d Remove a redundant check. NFC
llvm-svn: 251116
2015-10-23 16:51:32 +00:00
Davide Italiano 9b96ae80d4 [StaticAnalyzer] Use llvm::utostr and not to_string.
The latter seems unsupported (at least) on MinGW and FreeBSD (where
I hit this failure). We can't have nice things.

llvm-svn: 251115
2015-10-23 16:43:18 +00:00
Benjamin Kramer 422b3ff120 [AST] Plug a memory leak when promoting a single ParentMap entry to a vector.
Found by asan!

llvm-svn: 251110
2015-10-23 13:24:18 +00:00
Benjamin Kramer 94355aeff8 [AST] Re-add TypeLocs and NestedNameSpecifierLocs to the ParentMap.
This relands r250831 after some fixes to shrink the ParentMap overall
with one addtional tweak: nodes with pointer identity (e.g. Decl* and
friends) can be store more efficiently so I put them in a separate map.
All other nodes (so far only TypeLoc and NNSLoc) go in a different map
keyed on DynTypedNode. This further uglifies the code but significantly
reduces memory overhead.

Overall this change still make ParentMap significantly larger but it's
nowhere as bad as before. I see about 25 MB over baseline (pre-r251008)
on X86ISelLowering.cpp. If this becomes an issue we could consider
splitting the maps further as DynTypedNode is still larger (32 bytes)
than a single TypeLoc (16 bytes) but I didn't want to introduce even
more complexity now.

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

llvm-svn: 251101
2015-10-23 09:04:55 +00:00
Xinliang David Li 03711cbd6c Use newly introduced interfaces in LLVM (NFC)
Replaced references to raw strings in instrumentation
and coverage code.

llvm-svn: 251072
2015-10-22 22:25:11 +00:00
John McCall 460ce58fa6 Define weak and __weak to mean ARC-style weak references, even in MRC.
Previously, __weak was silently accepted and ignored in MRC mode.
That makes this a potentially source-breaking change that we have to
roll out cautiously.  Accordingly, for the time being, actual support
for __weak references in MRC is experimental, and the compiler will
reject attempts to actually form such references.  The intent is to
eventually enable the feature by default in all non-GC modes.
(It is, of course, incompatible with ObjC GC's interpretation of
__weak.)

If you like, you can enable this feature with
  -Xclang -fobjc-weak
but like any -Xclang option, this option may be removed at any point,
e.g. if/when it is eventually enabled by default.

This patch also enables the use of the ARC __unsafe_unretained qualifier
in MRC.  Unlike __weak, this is being enabled immediately.  Since
variables are essentially __unsafe_unretained by default in MRC,
the only practical uses are (1) communication and (2) changing the
default behavior of by-value block capture.

As an implementation matter, this means that the ObjC ownership
qualifiers may appear in any ObjC language mode, and so this patch
removes a number of checks for getLangOpts().ObjCAutoRefCount
that were guarding the processing of these qualifiers.  I don't
expect this to be a significant drain on performance; it may even
be faster to just check for these qualifiers directly on a type
(since it's probably in a register anyway) than to do N dependent
loads to grab the LangOptions.

rdar://9674298

llvm-svn: 251041
2015-10-22 18:38:17 +00:00
David Majnemer 78945d0721 [MS ABI] Don't crash when inheriting from base with trailing empty array member
We got this right for Itanium but not MSVC because CGRecordLayoutBuilder
was checking if the base's size was zero when it should have been
checking the non-virtual size.

This fixes PR21040.

llvm-svn: 251036
2015-10-22 18:04:22 +00:00
Benjamin Kramer 4947575666 Unbreak the shared cmake build. libToolingCore now depends on libAST.
llvm-svn: 251026
2015-10-22 15:45:54 +00:00
Craig Topper a6324c9463 Disable trigraph and escaped newline expansion on all types of raw string literals not just ASCII type.
llvm-svn: 251025
2015-10-22 15:35:21 +00:00
Benjamin Kramer 9bccaa158a [Tooling] Add a utility function to replace one nested name with another.
One problem in clang-tidy and other clang tools face is that there is no
way to lookup an arbitrary name in the AST, that's buried deep inside Sema
and might not even be what the user wants as the new name may be freshly
inserted and not available in the AST.

A common use case for lookups is replacing one nested name with another
while minimizing namespace qualifications, so replacing 'ns::foo' with
'ns::bar' will use just 'bar' if we happen to be inside the namespace 'ns'.
This adds a little helper utility for exactly that use case.

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

llvm-svn: 251022
2015-10-22 15:04:10 +00:00
Gabor Horvath b89658f649 Attempt to fix build bot test failures.
llvm-svn: 251014
2015-10-22 13:23:18 +00:00
Gabor Horvath efec16307c [analyzer] Bug identification
This patch adds hashes to the plist and html output to be able to identfy bugs
for suppressing false positives or diff results against a baseline. This hash
aims to be resilient for code evolution and is usable to identify bugs in two
different snapshots of the same software. One missing piece however is a 
permanent unique identifier of the checker that produces the warning. Once that
issue is resolved, the hashes generated are going to change. Until that point
this feature is marked experimental, but it is suitable for early adoption.

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

Original patch by: Bence Babati!

llvm-svn: 251011
2015-10-22 11:53:04 +00:00
Benjamin Kramer fbfa7a1e14 [AST] Remove redundant template keywords.
GCC complains about them, clang does not.

llvm-svn: 251009
2015-10-22 11:26:35 +00:00
Benjamin Kramer 8e4a17634f [AST] Store Decl* and Stmt* directly into the ParentMap.
These are by far the most common types to be parents in the AST so it makes
sense to optimize for them. Put them directly into the value of the map.
This currently saves 32 bytes per parent in the map and a pointer
indirection at the cost of some additional complexity in the code.

Sadly this means we cannot return an ArrayRef from getParents anymore, add
a proxy class that can own a single DynTypedNode and otherwise behaves
exactly the same as ArrayRef.

For example on a random large file (X86ISelLowering.cpp) this reduces the
size of the parent map by 24 MB.

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

llvm-svn: 251008
2015-10-22 11:21:40 +00:00
David Majnemer ee6c4094a0 [MS ABI] Mangle static anonymous unions
We believed that internal linkage variables at global scope which are
not variable template specializations did not have to be mangled.

However, static anonymous unions have no identifier and therefore must
be mangled.

This fixes PR18204.

llvm-svn: 250997
2015-10-22 07:15:56 +00:00
Xinliang David Li 69306c0823 clang driver toolchain refactoring
In this patch, the file static method addProfileRT is
moved to be a virtual member function of base ToolChain class.
This allows derived toolchain to override the default behavior
easily and make it consistent with Darwin toolchain (a TODO was
added for this refactoring - now removed). A new helper method
is also introduced to test if instrumentation profile option
is turned on or not.

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

llvm-svn: 250994
2015-10-22 06:15:31 +00:00
Richard Smith cfd53b4e99 [coroutines] Initial stub Sema functionality for handling coroutine await / yield / return.
llvm-svn: 250993
2015-10-22 06:13:50 +00:00
Richard Smith f8bdb0a9e4 [coroutines] Add forgotten test for lexing coroutines keywords.
llvm-svn: 250992
2015-10-22 05:21:12 +00:00
Richard Smith 9be594e36d [coroutines] Add overloaded unary 'operator co_await'.
llvm-svn: 250991
2015-10-22 05:12:22 +00:00
Craig Topper 0f723bb90b Convert ActOnForwardProtocolDeclaration to take an ArrayRef and use a range-based for loop. NFC
llvm-svn: 250990
2015-10-22 05:00:01 +00:00
Craig Topper b5518246b2 Use an ArrayRef<OffsetOfComponent> instead of pointer and size throughout offsetof handling code. Also use a range-based for loop. NFC
llvm-svn: 250989
2015-10-22 04:59:59 +00:00
Craig Topper a9247eb2b1 Change FindProtocolDeclaration to take an ArrayRef and use a range-based for loop. NFC
llvm-svn: 250988
2015-10-22 04:59:56 +00:00
Craig Topper d96b3f9b2a Change MacroInfo::setArgumentList to take an ArrayRef instead of pointer and size. While there use std::copy intead of a manual loop.
llvm-svn: 250987
2015-10-22 04:59:52 +00:00
Richard Smith 0e304ea8a1 [coroutines] Add parsing support for co_await expression, co_yield expression,
co_await modifier on range-based for loop, co_return statement.

llvm-svn: 250985
2015-10-22 04:46:14 +00:00
Richard Smith 629aaaf143 [coroutines] Fix description of LangOption for coroutines.
llvm-svn: 250984
2015-10-22 04:42:51 +00:00
Richard Smith 3fa73f3602 [coroutines] Add feature-test macro for coroutines, defined to 1 to indicate
the implementation is incomplete.

llvm-svn: 250982
2015-10-22 04:27:47 +00:00
Richard Smith eb7927ee8f [coroutines] Add lexer support for co_await, co_yield, and co_return keywords.
Add -fcoroutines flag (just for -cc1 for now) to enable the feature. Early
indications are that this will be part of -std=c++1z.

llvm-svn: 250980
2015-10-22 03:52:15 +00:00
Craig Topper a2a8d9cb0a Fix a couple places where InsertText was being called with a pointer and size when it really expects a StringRef and a normally optional bool argument.
The pointer was being implicitly converted to a StringRef and the size was being passed into the bool. Since the bool has a default value normally, no one noticed that the wrong number of arguments was given.

llvm-svn: 250977
2015-10-22 03:13:10 +00:00
Craig Topper cf2126e2ca Pass an ArrayRef instead of pointer and size. NFC
llvm-svn: 250976
2015-10-22 03:13:07 +00:00
Craig Topper 6a8c151ecb Change SortAndUniqueProtocols to operate directly on a SmallVector rather than taking a pointer and element count that it modifies. This paves the way to directly convert the small vector into an ArrayRef without needing to explicitly pass the modified size. No functional change intended.
While there also use a range-based for loop and use append instead of insert to copy elements into the empty SmallVector."

llvm-svn: 250971
2015-10-22 01:56:18 +00:00
Craig Topper d8040cfa9f Use front() instead of [0] to make code more consistent with the next line that uses back().
llvm-svn: 250970
2015-10-22 01:56:16 +00:00
Ben Langmuir a50dbb2065 Fix use-after-free in ModuleManager
When removing out-of-date modules we might have left behind a VisitOrder
that contains pointers to freed ModuleFiles.  This was very rarely seen,
because it only happens when modules go out of date and the VisitOrder
happens to have the right size to not be recomputed.

Thanks ASan!

rdar://23181512

llvm-svn: 250963
2015-10-21 23:12:45 +00:00
John McCall 09ec1ecf03 Enable ARC on the fragile runtime.
This is almost entirely a matter of just flipping a switch.  99% of
the runtime support is available all the way back to when it was
implemented in the non-fragile runtime, i.e. in Lion.  However,
fragile runtimes do not recognize ARC-style ivar layout strings,
which means that accessing __strong or __weak ivars reflectively
(e.g. via object_setIvar) will end up accessing the ivar as if it
were __unsafe_unretained.  Therefore, when using reflective
technologies like KVC, be sure that your paths always refer to a
property.

rdar://23209307

llvm-svn: 250955
2015-10-21 22:06:03 +00:00
Reid Kleckner 7737bd9f9f [Driver] Alias -fvisibility=internal to -fvisibility=hidden
The ELF symbol visibilities are:
- internal: Not visibile across DSOs, cannot pass address across DSOs
- hidden: Not visibile across DSOs, can be called indirectly
- default: Usually visible across DSOs, possibly interposable
- protected: Visible across DSOs, not interposable

LLVM only supports the latter 3 visibilities. Internal visibility is in
theory useful, as it allows you to assume that the caller is maintaining
a PIC register for you in %ebx, or in some other pre-arranged location.
As far as LLVM is concerned, this isn't worth the trouble. Using hidden
visibility is always correct, so we can just do that.

Resolves PR9183.

llvm-svn: 250954
2015-10-21 22:01:02 +00:00
Evgeniy Stepanov 71554fe21b MemorySanitizer does not require PIE.
Since r249754 MemorySanitizer should work equally well for PIE and
non-PIE executables on Linux/x86_64.

Beware, with this change -fsanitize=memory no longer adds implicit
-fPIE -pie compiler/linker flags on Linux/x86_64.

This is a re-land of r250941, limited to Linux/x86_64 + a very minor
refactoring in SanitizerArgs.

llvm-svn: 250949
2015-10-21 21:28:49 +00:00
Evgeniy Stepanov 76f853397a Revert "MemorySanitizer does not require PIE."
It actually does require PIE on some targets.

llvm-svn: 250944
2015-10-21 20:47:00 +00:00
Evgeniy Stepanov dccad5b9c3 MemorySanitizer does not require PIE.
Since r249754 MemorySanitizer should work equally well for PIE and
non-PIE executables.

Beware, with this change -fsanitize=memory no longer adds implicit
-fPIE -pie compiler/linker flags, unless the target defaults to PIE.

llvm-svn: 250941
2015-10-21 20:20:03 +00:00
David Majnemer cfa34fe9b4 [Sema] Remove an unreachable llvm_unreachable
No functionality change is intended.

llvm-svn: 250935
2015-10-21 19:48:47 +00:00
Douglas Katzman 526b5f9cd4 [Myriad]: Always add -L paths even if -nostdlib is set.
llvm-svn: 250932
2015-10-21 19:33:54 +00:00
Yaron Keren 9d7ccdee0f Rename clang config.h include guard from CONFIG_H to CLANG_CONFIG_H
to make it different from LLVM config.h include guard.

llvm-svn: 250921
2015-10-21 18:16:01 +00:00
John McCall 3fd13f0665 Fix and stylize the emission of GC/ARC ivar and GC block layout strings.
Specifically, handle under-aligned object references (by explicitly
ignoring them, because this just isn't representable in the format;
yes, this means that GC silently ignores such references), descend
into anonymous structs and unions, stop classifying fields of
pointer-to-strong/weak type as strong/weak in ARC mode, and emit
skips to cover the entirety of block layouts in GC mode.  As a
cleanup, extract this code into a helper class, avoid a number of
unnecessary copies and layout queries, generate skips implicitly
instead of explicitly tracking them, and clarify the bitmap-creation
logic.

llvm-svn: 250919
2015-10-21 18:06:47 +00:00
John McCall b04ecb753a Unify the ObjC entrypoint caches.
llvm-svn: 250918
2015-10-21 18:06:43 +00:00
John McCall 039f2bbd02 Some minor ARC diagnostic improvements.
llvm-svn: 250917
2015-10-21 18:06:38 +00:00
John McCall f8a9b66f65 In ARC, peephole the initialization of a __weak variable with
a value loaded from a __weak variable into a call to
objc_copyWeak or objc_moveWeak.

llvm-svn: 250916
2015-10-21 18:06:31 +00:00
Nico Weber ff06370e12 clang-format: Teach --sort-includes to interleave #include and #import.
clang accepts both #include and #import for includes (the latter having an
implicit header guard).  Let clang-format interleave both types if
--sort-includes is passed.  #import is used frequently in Objective-C code.

http://reviews.llvm.org/D13853

llvm-svn: 250909
2015-10-21 17:13:45 +00:00
Benjamin Kramer 998039e2f6 Shrink DynTypedNode by one pointer from 40 to 32 bytes (on x86_64).
The MemoizationData cache was introduced to avoid a series of enum
compares at the cost of making DynTypedNode bigger. This change reverts
to using an enum compare but instead of building a chain of comparison
the enum values are reordered so the check can be performed with a
simple greater than. The alternative would be to steal a bit from the
enum but I think that's a more complex solution and not really needed
here.

I tried this on several large .cpp files with clang-tidy and didn't
notice any performance difference. The test change is due to matchers
being sorted by their node kind.

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

llvm-svn: 250905
2015-10-21 16:33:15 +00:00
Craig Topper 2f6e21e76d Update clang to match llvm r250901. OptTable constructor now takes an ArrayRef. NFC
llvm-svn: 250903
2015-10-21 16:31:33 +00:00
Craig Topper 8459aa8f97 Use StringRef instead of calling c_str and doing pointer math before eventually creating a StringRef. NFC
llvm-svn: 250902
2015-10-21 16:31:31 +00:00
Anastasia Stulova bd3c08e301 [OpenCL] Add test for program scope variable restrictions in OpenCL v2.0
http://reviews.llvm.org/D13105

llvm-svn: 250892
2015-10-21 10:37:57 +00:00
Benjamin Kramer e8c51fdbd6 Revert "[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap."
Putting DynTypedNode in the ParentMap bloats its memory foot print.
Before the void* key had 8 bytes, now we're at 40 bytes per key which
can mean multiple gigabytes increase for large ASTs and this count
doesn't even include all the added TypeLoc nodes. Revert until I come
up with a better data structure.

This reverts commit r250831.

llvm-svn: 250889
2015-10-21 10:07:26 +00:00
Richard Barton 7dacc242d9 Fix __ARM_FP value for sp-only FPUs with Half-precision
The logic for parsing FP capabilities to set __ARM_FP was mistakenly removing
the Half-Precision capability when handling fp-only-sp resulting in a value
of 0x4. Section 6.5.1 of ACLE states that for such FP architectures the value
should be 0x6

llvm-svn: 250888
2015-10-21 10:03:55 +00:00
Richard Smith 896c66ecc6 [modules] libstdc++ defines some static inline functions in its internal
headers. If those headers end up being textually included twice into the same
module, we get ambiguity errors.

Work around this by downgrading the ambiguity error to a warning if multiple
identical internal-linkage functions appear in an overload set, and just pick
one of those functions as the lookup result.

llvm-svn: 250884
2015-10-21 07:13:52 +00:00
Craig Topper dd2b74ab21 Use range-based for loops. NFC.
llvm-svn: 250881
2015-10-21 04:52:40 +00:00
Craig Topper 335c8f9e59 Use std::find instead of a manual loop.
llvm-svn: 250880
2015-10-21 04:52:38 +00:00
Craig Topper 67288a9b75 Parse into an unsigned type instead of a signed type and then checking for positive and casting to unsigned. Since we know the string starts with a digit it couldn't be negative anyway. NFCI
llvm-svn: 250879
2015-10-21 04:52:36 +00:00
Craig Topper de330c78b3 Fix bad indentation.
llvm-svn: 250878
2015-10-21 04:52:34 +00:00
Craig Topper 55765ca54a Use ArrayRef and MutableArrayRef instead of a pointer and size. NFC
llvm-svn: 250876
2015-10-21 02:34:10 +00:00
NAKAMURA Takumi 79e40ec856 Revert r247977, "clang/test/lit.cfg: *-ps4 doesn't have appropriate driver yet. Mark it as "non-clang-driver"."
They, "tests requiring clang-driver", should work in trunk since ps4 driver has been introduced.

llvm-svn: 250866
2015-10-20 22:36:16 +00:00
Reid Kleckner 744e3e7fc7 Re-land r250592 without rejecting field refs in unevaluated contexts
This time, I went with the first approach from
http://reviews.llvm.org/D6700, where clang actually attempts to form an
implicit member reference from an UnresolvedLookupExpr. We know that
there are only two possible outcomes at this point, a DeclRefExpr of the
FieldDecl or an error, but its safer to reuse the existing machinery for
this.

llvm-svn: 250856
2015-10-20 21:04:13 +00:00
David Majnemer 06ce8a4c70 [-fms-extensions] Allow missing exception specifications in redeclarations as an extension
Microsoft's ATL headers make use of this MSVC extension, add support for
it and issue a diagnostic under -Wmicrosoft-exception-spec.

This fixes PR25265.

llvm-svn: 250854
2015-10-20 20:49:21 +00:00
Reid Kleckner afb9aaefe3 Add back null check removed accidentally in r250554
Fixes PR25262

llvm-svn: 250844
2015-10-20 18:45:57 +00:00
Chris Bieneman 0eb2d8794e [CMake] Make clang/tools subdirectories controlled via options
Setting CLANG_TOOL_*_BUILD=Off on the CMake command line will disable inclusion of a clang/tools subdirectory.

llvm-svn: 250840
2015-10-20 18:12:12 +00:00
Reid Kleckner 077fe12e5d Look through using decls when classifying implicit member access
Clang will now accept this valid C++11 code:
  struct A { int field; };
  struct B : A {
    using A::field;
    enum { TheSize = sizeof(field) };
  };

Previously we would classify the 'field' reference as something other
than a field, and then forget to apply the C++11 rule to allow
non-static data member references in unevaluated contexts.

This usually arises in class templates that want to reference fields of
a dependent base in an unevaluated context outside of an instance
method. Such contexts do not allow references to 'this', so the only way
to access the field is with a using decl and an implicit member
reference.

llvm-svn: 250839
2015-10-20 18:12:08 +00:00
Chris Bieneman 38b2dec37e [CMake] Make external compiler-rt install scripts relative to CMAKE_INSTALL_PREFIX.
This change makes LLVM_BUILD_EXTERNAL_COMPILER_RT work correctly when overriding CMAKE_INSTALL_PREFIX on the install action (which is how LLVM_CREATE_XCODE_TOOLCHAIN works).

This fix is two parts:
(1) Pass CMAKE_INSTALL_PREFIX in as a variable from the parent install to the child install
(2) When passing COMPILER_RT_INSTALL_PATH into the external project make sure it is passed as a string not a path.

Not specifying the full path for COMPILER_RT_INSTALL_PATH isn't enough to fix the issue because relative paths specified on the CMake command line are expanded relative to the working directory before the cache is populated. Forcing this to a string allows it to remain a relative path through to the install() calls. Relative paths specified in install() calls are expanded relative to CMAKE_INSTALL_PREFIX at install time.

llvm-svn: 250834
2015-10-20 16:39:25 +00:00
Benjamin Kramer 36307ffa1b [AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.
Firstly this changes the type of parent map to be keyed on DynTypedNode to
simplify the following changes. This comes with a DenseMapInfo for
DynTypedNode, which is a bit incomplete still and will probably only work
for parentmap right now.

Then the RecursiveASTVisitor in ASTContext is updated and finally
ASTMatchers hasParent and hasAncestor learn about the new functionality.

Now ParentMap is only missing TemplateArgumentLocs and CXXCtorInitializers.

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

llvm-svn: 250831
2015-10-20 15:08:46 +00:00
Angel Garcia Gomez 637d1e6694 Roll-back r250822.
Summary: It breaks the build for the ASTMatchers

Subscribers: klimek, cfe-commits

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

llvm-svn: 250827
2015-10-20 13:23:58 +00:00
Angel Garcia Gomez b5250d3448 Apply modernize-use-default to clang.
Summary: Replace empty bodies of default constructors and destructors with '= default'.

Reviewers: bkramer, klimek

Subscribers: klimek, alexfh, cfe-commits

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

llvm-svn: 250822
2015-10-20 12:52:55 +00:00
Andrea Di Biagio 8bb12d0a77 [x86] Fix maskload/store intrinsic definitions in avxintrin.h
According to the Intel documentation, the mask operand of a maskload and
maskstore intrinsics is always a vector of packed integer/long integer values.
This patch introduces the following two changes:
 1. It fixes the avx maskload/store intrinsic definitions in avxintrin.h.
 2. It changes BuiltinsX86.def to match the correct gcc definitions for avx
    maskload/store (see D13861 for more details).

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

llvm-svn: 250816
2015-10-20 11:19:54 +00:00
Benjamin Kramer b993613800 Revert accidental commit. This isn't ready yet.
llvm-svn: 250804
2015-10-20 07:53:14 +00:00
Benjamin Kramer 1b7dd8d7e3 Put back dead code that's used out-of-tree.
Partially reverts r250418.

llvm-svn: 250803
2015-10-20 07:50:21 +00:00
Alexey Bataev 2bf9b4c0d1 [DEBUG INFO] Emit debug info for type used in explicit cast only.
Currently debug info for types used in explicit cast only is not emitted. It happened after a patch for better alignment handling. This patch fixes this bug.
Differential Revision: http://reviews.llvm.org/D13582

llvm-svn: 250795
2015-10-20 04:24:12 +00:00
Reid Kleckner 7d3a2f067f Revert "Diagnose UnresolvedLookupExprs that resolve to instance members in static methods"
This reverts commit r250592.

It has issues around unevaluated contexts, like this:
  template <class T> struct A { T i; };
  template <class T>
  struct B : A<T> {
    using A<T>::i;
    typedef decltype(i) U;
  };
  template struct B<int>;

llvm-svn: 250774
2015-10-20 00:31:42 +00:00
Craig Topper d945d50efc [X86] Remove a few 'else' after 'return'
llvm-svn: 250764
2015-10-20 00:00:17 +00:00
David Majnemer fac5243493 [MS ABI] Give linkonce_odr, instead of external_linkage, to certain kinds of static data members
Out-of-line definitions of static data members which have an inline
initializer must get GVA_DiscardableODR linkage instead of
GVA_StrongExternal linkage.

MSVC 2013's behavior is different with respect to this and would cause
link errors if one TU provided a definition while another did not.
MSVC 2015 fixed this bug, making this OK.  Note that the 2015 behavior
is always compatible with 2013: it never produces a strong definition.

This essentially reverts r237787.

llvm-svn: 250757
2015-10-19 23:22:49 +00:00
Nico Weber 3cb667edaa clang-format: Use pipes instead of temporary files for most lit tests.
This makes the format tests look more like most other FileCheck tests in clang.

The multiple-inputs tests still use temp files, to make sure that the file
input code in clang-format stays tested.

Stop stripping out the comment lines in style-on-command-line.cpp as they don't
get in the way and it makes the test simpler. Also remove 2>&1s on the tests in
that file that don't need it.

http://reviews.llvm.org/D13852

llvm-svn: 250706
2015-10-19 16:21:29 +00:00
Diego Novillo 843dc6ffbf Sample Profiles - Fix location of binary encoding documentation. NFC.
llvm-svn: 250705
2015-10-19 15:53:17 +00:00
Marek Kurdej e5c485c70b Added new options to ClangFormat VSIX package.
Summary:
Added new options to ClangFormat VSIX package:
* fallback-style
* assume-filename
* sort-includes.
Changed version to 1.1 (otherwise one couldn't update).

Fixed clang-format escaping of XML reserved characters.

Reviewers: hans, aaron.ballman, klimek, rnk, zturner

Subscribers: djasper, cfe-commits

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

llvm-svn: 250694
2015-10-19 10:08:35 +00:00
Manuel Klimek ab2e28ebaf Fix 'will be initialized after' warning.
llvm-svn: 250691
2015-10-19 08:43:46 +00:00
Manuel Klimek 74ca428df7 Make test not rely on %T ending on /Output.
llvm-svn: 250690
2015-10-19 08:27:51 +00:00
Michael Kuperstein b1ec50d56a [X86] Enable soft float ABI for x86
The Intel MCU psABI requires floating-point values to be passed in-reg.
This makes the x86-32 ABI code respect "-mfloat-abi soft" and generate float inreg arguments.

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

llvm-svn: 250689
2015-10-19 08:09:43 +00:00
Michael Kuperstein dc74520432 Use saner variable names. NFC.
llvm-svn: 250687
2015-10-19 07:52:25 +00:00
Alexey Bataev 1d97d2a3d2 [OPENMP] Fix for http://llvm.org/PR25221: Infinite loop while parsing OpenMP directive
Clang skipped annot_pragma_openmp token, while it should be considered as a stop token while skipping tokens.

llvm-svn: 250684
2015-10-19 06:40:17 +00:00
Craig Topper 6c03a54444 Make getTargetBuiltins return an ArrayRef instead of having two out parameters of a pointer and length. NFC
llvm-svn: 250681
2015-10-19 04:51:35 +00:00
Craig Topper f054e3ad6d Recommit "Return an ArrayRef instead of having two out parameters of a pointer and length. NFC". Hopefully this time the bots will be happy.
llvm-svn: 250678
2015-10-19 03:52:27 +00:00
Craig Topper d255c00acd Revert r250676 "Return an ArrayRef instead of having two out parameters of a pointer and length. NFC"
llvm-svn: 250677
2015-10-19 03:17:00 +00:00
Craig Topper 9c4d9b2316 Return an ArrayRef instead of having two out parameters of a pointer and length. NFC
llvm-svn: 250676
2015-10-19 03:05:12 +00:00
Nico Weber afa62fae1e clang-format: Extend main header include sorting heuristic to Objective-C files.
llvm-svn: 250675
2015-10-19 01:36:09 +00:00
Saleem Abdulrasool 7f66d75832 docs: remote stale refs
Since the attribute documentation is now auto-generated, the previous references
are no longer valid.  This prevented the docs build from completing
successfully.

llvm-svn: 250674
2015-10-19 01:24:08 +00:00
Nico Weber 187fcf1e5d Update `clang-format -help` output in clang-format docs.
-assume-filename, -fallback-style, and -sort-includes are new.  (They're also
longer than the previous options, so all descriptions shift over by some amount,
making this diff look larger than it is.)

It looks like someone renamed "General options" to "Generic Options" too.

llvm-svn: 250672
2015-10-19 01:08:30 +00:00
Nico Weber 373ee96e73 Update list of languages advertised in OVERVIEW: A tool to format C/C++/Java/JavaScript/Objective-C/Protobuf code.
If no arguments are specified, it formats the code from standard input
and writes the result to the standard output.
If <file>s are given, it reformats the files. If -i is specified
together with <file>s, the files are edited in-place. Otherwise, the
result is written to the standard output.

USAGE: clang-format [options] [<file> ...]

OPTIONS:
  -assume-filename=<string> - When reading from stdin, clang-format assumes this
                              filename to look for a style config file (with
                              -style=file) and to determine the language.
  -cursor=<uint>            - The position of the cursor when invoking
                              clang-format from an editor integration
  -dump-config              - Dump configuration options to stdout and exit.
                              Can be used with -style option.
  -fallback-style=<string>  - The name of the predefined style used as a
                              fallback in case clang-format is invoked with
                              -style=file, but can not find the .clang-format
                              file to use.
                              Use -fallback-style=none to skip formatting.
  -help                     - Display available options (-help-hidden for more)
  -i                        - Inplace edit <file>s, if specified.
  -length=<uint>            - Format a range of this length (in bytes).
                              Multiple ranges can be formatted by specifying
                              several -offset and -length pairs.
                              When only a single -offset is specified without
                              -length, clang-format will format up to the end
                              of the file.
                              Can only be used with one input file.
  -lines=<string>           - <start line>:<end line> - format a range of
                              lines (both 1-based).
                              Multiple ranges can be formatted by specifying
                              several -lines arguments.
                              Can't be used with -offset and -length.
                              Can only be used with one input file.
  -offset=<uint>            - Format a range starting at this byte offset.
                              Multiple ranges can be formatted by specifying
                              several -offset and -length pairs.
                              Can only be used with one input file.
  -output-replacements-xml  - Output replacements as XML.
  -sort-includes            - Sort touched include lines
  -style=<string>           - Coding style, currently supports:
                                LLVM, Google, Chromium, Mozilla, WebKit.
                              Use -style=file to load style configuration from
                              .clang-format file located in one of the parent
                              directories of the source file (or current
                              directory for stdin).
                              Use -style="{key: value, ...}" to set specific
                              parameters, e.g.:
                                -style="{BasedOnStyle: llvm, IndentWidth: 8}"
  -version                  - Display the version of this program output.

llvm-svn: 250671
2015-10-19 01:03:19 +00:00
Nick Lewycky 4b81fc87ad No functionality change, just fix whitespace, a typo and remove an unnecessary
emacs mode marker. (Changes left behind from another patch that ended up not
working out.)

llvm-svn: 250666
2015-10-18 20:32:12 +00:00
Saleem Abdulrasool b25445cb48 CodeGen: simplify TargetOptions setup
Do direct assignment of boolean values and regroup.  Use StringSwitch instead of
custom cases.  NFC.

llvm-svn: 250665
2015-10-18 20:24:53 +00:00
Dimitry Andric 0cc6f47348 Support linking against OpenMP runtime on FreeBSD.
Summary:
Similar to rL248426 (which was a followup to rL248379 and rL248424), add the
required libraries for OpenMP on the linker command line, and update the test
case.

Reviewers: emaste, theraven, joerg

Subscribers: cfe-commits

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

llvm-svn: 250657
2015-10-18 13:32:20 +00:00
Daniel Jasper 265309e38a clang-format: [JS] Handle string literals spanning character classes.
If a RegExp contains a character group with a quote (/["]/), the
trailing end of it is first tokenized as a string literal, which leads
to the merging code seeing an unbalanced bracket.

This change parses regex literals from the left hand side. That
simplifies the parsing code and also allows correctly handling escapes
and character classes, hopefully correctly parsing all regex literals.

Patch by Martin Probst, thank you.
Review: http://reviews.llvm.org/D13765

llvm-svn: 250648
2015-10-18 07:02:28 +00:00
Craig Topper 273dbc602f Make a bunch of static arrays const.
llvm-svn: 250647
2015-10-18 05:29:26 +00:00
Craig Topper e353a7257e Add an unnecessary makeArrayRef I add earlier. I didn't realize range-based for loops worked with arrays.
llvm-svn: 250646
2015-10-18 05:29:23 +00:00
Craig Topper 2685cbe056 Use std::is_sorted instead of a manual loop.
llvm-svn: 250645
2015-10-18 05:29:21 +00:00
NAKAMURA Takumi 91352728af clang/test/Driver/ps4-linker-non-win.c: Tweak for cygwin like ps4-linker-win.c@250403. Cygwin seeks dependent libs along $PATH.
llvm-svn: 250632
2015-10-17 23:54:54 +00:00
NAKAMURA Takumi c8e10523f9 clang/test/Driver/ps4-linker-non-win.c: Make %T/ps4-ld executable, or the driver wouldn't find it.
llvm-svn: 250631
2015-10-17 23:47:02 +00:00
NAKAMURA Takumi c4d8ed0e53 clang/test/Driver/ps4-linker-non-win.c: Make sure that %T/ps4-ld would be used but *fails*.
llvm-svn: 250630
2015-10-17 23:15:16 +00:00
Daniel Jasper 148f32925f clang-format: Add test for (properly escaped) XML output.
llvm-svn: 250629
2015-10-17 22:44:19 +00:00
Craig Topper 924f6db21d Replace a static compare function with a lambda. NFC
llvm-svn: 250621
2015-10-17 20:18:46 +00:00
Craig Topper c00e953cb2 Use a range-based for loop. Use std::end instead of pointer+array_lengthof. NFC
llvm-svn: 250617
2015-10-17 17:10:43 +00:00
Davide Italiano c4958b4b52 [Frontend] Name variable correctly.
Reported by: Kim Grasman!

llvm-svn: 250605
2015-10-17 06:46:39 +00:00
Eric Fiselier 3acf5fdd88 Add an AST node matcher for TemplateTypeParmDecl objects.
llvm-svn: 250602
2015-10-17 02:34:44 +00:00
Reid Kleckner f438a020bf Diagnose UnresolvedLookupExprs that resolve to instance members in static methods
During the initial template parse for this code, 'member' is unresolved
and we don't know anything about it:

  struct A { int member };
  template <typename T>
  struct B : public T {
    using T::member;
    static void f() {
      (void)member; // Could be static or non-static.
    }
  };
  template class B<A>;

The pattern declaration contains an UnresolvedLookupExpr rather than an
UnresolvedMemberExpr because `f` is static, and `member` should never be
a field. However, if the code is invalid, it may become a field, in
which case we should diagnose it.

Reviewers: rjmccall, rsmith

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

llvm-svn: 250592
2015-10-17 00:19:04 +00:00
Richard Smith 95dc57a611 [modules] Allow the error when explicitly loading an incompatible module file
via -fmodule-file= to be turned off; in that case, just include the relevant
files textually. This allows module files to be unconditionally passed to all
compile actions via CXXFLAGS, and to be ignored for rules that specify custom
incompatible flags.

llvm-svn: 250577
2015-10-16 23:20:19 +00:00
Davide Italiano 27043302a4 [Frontend/CompilerInvocation] Use range-based loop. NFC.
llvm-svn: 250559
2015-10-16 22:13:53 +00:00
Richard Smith 3d5b48c480 Refactor module lookup when looking up a header file, and wire through the requesting module. No functionality change.
llvm-svn: 250554
2015-10-16 21:42:56 +00:00
Richard Barton ea04359859 Once again fix this test to read from stdin rather than an input file
llvm-svn: 250547
2015-10-16 20:15:33 +00:00
Richard Barton 8c11bcf73a Further increase helfulness of assert message
If you increase the number of diags of a particular type by one more than the
number available you get the nice assert message. If you do it by two more
than available you get the old non-helpful message. Combining the two makes
sense I think.

llvm-svn: 250546
2015-10-16 20:15:29 +00:00
James Y Knight a6c9ee777a Teach MyriadToolchain how to find its C++ header paths.
Also move the addLibStdCXXIncludePaths helper function from Linux to
Generic_GCC.

llvm-svn: 250536
2015-10-16 18:46:26 +00:00
Filipe Cabecinhas 4585ed006a [PS4] Add missing tests for -fsanitize=...
llvm-svn: 250516
2015-10-16 15:08:01 +00:00
Filipe Cabecinhas 67d28057fa PS4: Add tests for rtti/vptr-sanitizer interaction
llvm-svn: 250515
2015-10-16 15:07:56 +00:00
Filipe Cabecinhas 82cd6af690 PS4: Make sure to add the sanitizer runtime before any linker input
llvm-svn: 250514
2015-10-16 15:07:48 +00:00
NAKAMURA Takumi 55bf953344 [CMake] Reformat CLANG_TEST_DEPS.
llvm-svn: 250503
2015-10-16 09:38:42 +00:00
Sean Eveson 3f072ef82c Test commit
llvm-svn: 250500
2015-10-16 08:54:23 +00:00
Craig Topper e33f51fa91 [X86] Add fxsr feature name for fxsave/fxrestore builtins.
llvm-svn: 250498
2015-10-16 06:22:36 +00:00
Craig Topper 3804669996 [X86] Add sse4.2 feature name to CRC32 builtins.
llvm-svn: 250496
2015-10-16 05:25:15 +00:00
Craig Topper f924578b2b [X86] Add proper feature name to some avx512dq builtins.
llvm-svn: 250495
2015-10-16 05:25:04 +00:00
George Burgess IV a51c4077c5 Make __builtin_object_size more conservative
r246877 made __builtin_object_size substantially more aggressive with
unknown bases if Type=1 or Type=3, which causes issues when we encounter
code like this:

struct Foo {
  int a;
  char str[1];
};

const char str[] = "Hello, World!";
struct Foo *f = (struct Foo *)malloc(sizeof(*f) + strlen(str));
strcpy(&f->str, str);

__builtin_object_size(&f->str, 1) would hand back 1, which is
technically correct given the type of Foo, but the type of Foo lies to
us about how many bytes are available in this case.

This patch adds support for this "writing off the end" idiom -- we now
answer conservatively when we're given the address of the very last
member in a struct.

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

llvm-svn: 250488
2015-10-16 01:49:01 +00:00
George Burgess IV 2a6150d932 [Sema] Fix address-of + enable_if overloading logic
Previously, our logic when taking the address of an overloaded function
would not consider enable_if attributes, so long as all of the enable_if
conditions on a given candidate were true. So, two functions with
identical signatures (one with enable_if attributes, the other without),
would be considered equally good overloads. If we were calling the
function instead of taking its address, then the function with enable_if
attributes would be preferred.

This patch makes us prefer the candidate with enable_if regardless of if
we're calling or taking the address of an overloaded function.

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

llvm-svn: 250486
2015-10-16 01:17:38 +00:00
Eric Fiselier 09c1ffdc8f Add "-Wc++11-inline-namespace" so that libc++ can use -pedantic in C++03.
Summary: The title says it all.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 250477
2015-10-16 00:31:36 +00:00
Eric Christopher c276e80022 Mark this test as requiring and x86 registered target.
llvm-svn: 250475
2015-10-16 00:14:36 +00:00
Eric Christopher 15709991d0 Add an error when calling a builtin that requires features that don't
match the feature set of the function that they're being called from.

This ensures that we can effectively diagnose some[1] code that would
instead ICE in the backend with a failure to select message.

Example:

__m128d foo(__m128d a, __m128d b) {
  return __builtin_ia32_addsubps(b, a);
}

compiled for normal x86_64 via:

clang -target x86_64-linux-gnu -c

would fail to compile in the back end because the normal subtarget
features for x86_64 only include sse2 and the builtin requires sse3.

[1] We're still not erroring on:

__m128i bar(__m128i const *p) { return _mm_lddqu_si128(p); }

where we should fail and error on an always_inline function being
inlined into a function that doesn't support the subtarget features
required.

llvm-svn: 250473
2015-10-15 23:47:11 +00:00
Eric Christopher 4bad57c9bc Fix the subtarget features required by some x86 builtins.
Update the fma builtins to be fma/fma4 until some we can find some
documentation either way.

Update a couple of the avx intrinsics because they were in the wrong
category.

llvm-svn: 250470
2015-10-15 22:46:02 +00:00
Teresa Johnson 8f865a41fb Add llvm-bcanalyzer to list of clang test dependences
This addresses a bot failure from r250455, since new Misc/thinlto.c
test uses it.

llvm-svn: 250460
2015-10-15 21:06:53 +00:00
Teresa Johnson 945bc50f21 Recommit "Clang support for -flto=thin."
This recommits r250398 with fixes to the tests for bot failures.

Add "-target x86_64-unknown-linux" to the clang invocations that
check for the gold plugin.

llvm-svn: 250455
2015-10-15 20:35:53 +00:00
Eric Christopher abde1c2b51 The target-feature command line option doesn't take a comma delimited
string, so split them into multiple options.

llvm-svn: 250449
2015-10-15 20:04:42 +00:00
Eric Christopher 4fb4fbc5d6 Add the minimum target features that these tests depend upon.
llvm-svn: 250448
2015-10-15 20:04:40 +00:00
Daniel Jasper f39757d0c0 clang-format: Basic escaping when outputting XML.
llvm-svn: 250440
2015-10-15 18:39:31 +00:00
Benjamin Kramer 2811b04874 Put back doxygen comment accidentally dropped in r250418.
llvm-svn: 250428
2015-10-15 16:46:25 +00:00
Nico Weber 2cd92f1cc7 clang-format/java: Break after annotations on fields in Chromium style.
Chromium follows the Android style guide for Java code, and that doesn't make
the distinction between fields and non-fields that the Google Java style guide
makes:

https://source.android.com/source/code-style.html#use-standard-java-annotations
https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations

llvm-svn: 250422
2015-10-15 16:03:01 +00:00
Benjamin Kramer c2d2b4259c [CodeGen] Remove dead code. NFC.
llvm-svn: 250418
2015-10-15 15:29:40 +00:00
Ed Schouten ea9448e468 Add support for CloudABI/aarch64.
The core C library has already been ported over to aarch64 successfully,
meaning there is no reason to hold this change back.

llvm-svn: 250416
2015-10-15 15:07:07 +00:00
NAKAMURA Takumi 430443ba61 Tweak to make clang/test/Driver/ps4-linker-win.c less sinsitive of DLL path.
- On mingw-w64, libstdc++-6.dll is used for clang.exe. The DLL might not be in Windows' system directory.
  - With --enable-shared, DLLs might be in ${CMAKE_BINARY_DIR}/bin.

I understand this test confirms that appropriate name of executable can be found on %PATH%.
Therefore I added "Output\\" before each expression.

FIXME: The output directory %T is hardcoded like "Output\\ps4-ld.exe".
llvm-svn: 250403
2015-10-15 13:51:13 +00:00
Teresa Johnson fca505c674 Revert "Clang support for -flto=thin." (bot failures)
Rolling this back for now since there are a couple of bot failures on
the new tests I added, and I won't have a chance to look at them in detail
until later this afternoon. I think the new tests need some restrictions on
having the gold plugin available.

This reverts commit r250398.

llvm-svn: 250402
2015-10-15 13:41:51 +00:00
Teresa Johnson 31b2354929 Clang support for -flto=thin.
Summary:
Add clang support for -flto=thin option, which is used to set the
EmitFunctionSummary code gen option on compiles.

Add -flto=full as an alias to the existing -flto.

Add tests to check for proper overriding of -flto variants on the
command line, and convert grep tests to FileCheck.

Reviewers: dexonsmith, joker.eph

Subscribers: davidxl, cfe-commits

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

llvm-svn: 250398
2015-10-15 13:08:13 +00:00
Peter Collingbourne e919b0f9ad Headers: Switch some headers to LF line endings for consistency.
llvm-svn: 250388
2015-10-15 10:33:27 +00:00
Eric Christopher 28a6db5929 Update clang for DIBuilder::createSubroutineType API change.
Patch by Amaury Sechet!

llvm-svn: 250373
2015-10-15 06:56:08 +00:00
Craig Topper 1ac9bfb844 [X86] Add proper feature names to xsave builtins.
llvm-svn: 250369
2015-10-15 05:23:46 +00:00
Craig Topper da9fe56bf6 [X86] Add command line switches for xsave/xsaveopt/xsavec/xsaves. Macro defines for the same. And add the flags to correct CPU names.
llvm-svn: 250368
2015-10-15 05:23:38 +00:00
Douglas Katzman 64071ad864 Remove unnecessary braces in single-line 'if'.
llvm-svn: 250363
2015-10-15 04:10:40 +00:00