]> granicus.if.org Git - clang/log
clang
8 years agoFixup this testcase after r251120.
Adrian Prantl [Fri, 23 Oct 2015 17:25:17 +0000 (17:25 +0000)]
Fixup this testcase after r251120.
I accidentally tested r251120 with assertions disabled.

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

8 years ago[ARM] Renaming +t2dsp feature into +dsp, as discussed on llvm-dev
Artyom Skrobov [Fri, 23 Oct 2015 17:19:02 +0000 (17:19 +0000)]
[ARM] Renaming +t2dsp feature into +dsp, as discussed on llvm-dev

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

8 years agoModule Debugging: Emit module debug info for types inside of Objective-C
Adrian Prantl [Fri, 23 Oct 2015 17:02:22 +0000 (17:02 +0000)]
Module Debugging: Emit module debug info for types inside of Objective-C
containers.

rdar://problem/23196170

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

8 years agoRemove a redundant check. NFC
Adrian Prantl [Fri, 23 Oct 2015 16:51:32 +0000 (16:51 +0000)]
Remove a redundant check. NFC

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

8 years ago[StaticAnalyzer] Use llvm::utostr and not to_string.
Davide Italiano [Fri, 23 Oct 2015 16:43:18 +0000 (16:43 +0000)]
[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.

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

8 years ago[AST] Plug a memory leak when promoting a single ParentMap entry to a vector.
Benjamin Kramer [Fri, 23 Oct 2015 13:24:18 +0000 (13:24 +0000)]
[AST] Plug a memory leak when promoting a single ParentMap entry to a vector.

Found by asan!

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

8 years ago[AST] Re-add TypeLocs and NestedNameSpecifierLocs to the ParentMap.
Benjamin Kramer [Fri, 23 Oct 2015 09:04:55 +0000 (09:04 +0000)]
[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

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

8 years agoUse newly introduced interfaces in LLVM (NFC)
Xinliang David Li [Thu, 22 Oct 2015 22:25:11 +0000 (22:25 +0000)]
Use newly introduced interfaces in LLVM (NFC)

Replaced references to raw strings in instrumentation
and coverage code.

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

8 years agoDefine weak and __weak to mean ARC-style weak references, even in MRC.
John McCall [Thu, 22 Oct 2015 18:38:17 +0000 (18:38 +0000)]
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

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

8 years ago[MS ABI] Don't crash when inheriting from base with trailing empty array member
David Majnemer [Thu, 22 Oct 2015 18:04:22 +0000 (18:04 +0000)]
[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.

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

8 years agoUnbreak the shared cmake build. libToolingCore now depends on libAST.
Benjamin Kramer [Thu, 22 Oct 2015 15:45:54 +0000 (15:45 +0000)]
Unbreak the shared cmake build. libToolingCore now depends on libAST.

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

8 years agoDisable trigraph and escaped newline expansion on all types of raw string literals...
Craig Topper [Thu, 22 Oct 2015 15:35:21 +0000 (15:35 +0000)]
Disable trigraph and escaped newline expansion on all types of raw string literals not just ASCII type.

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

8 years ago[Tooling] Add a utility function to replace one nested name with another.
Benjamin Kramer [Thu, 22 Oct 2015 15:04:10 +0000 (15:04 +0000)]
[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

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

8 years agoAttempt to fix build bot test failures.
Gabor Horvath [Thu, 22 Oct 2015 13:23:18 +0000 (13:23 +0000)]
Attempt to fix build bot test failures.

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

8 years ago[analyzer] Bug identification
Gabor Horvath [Thu, 22 Oct 2015 11:53:04 +0000 (11:53 +0000)]
[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!

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

8 years ago[AST] Remove redundant template keywords.
Benjamin Kramer [Thu, 22 Oct 2015 11:26:35 +0000 (11:26 +0000)]
[AST] Remove redundant template keywords.

GCC complains about them, clang does not.

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

8 years ago[AST] Store Decl* and Stmt* directly into the ParentMap.
Benjamin Kramer [Thu, 22 Oct 2015 11:21:40 +0000 (11:21 +0000)]
[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

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

8 years ago[MS ABI] Mangle static anonymous unions
David Majnemer [Thu, 22 Oct 2015 07:15:56 +0000 (07:15 +0000)]
[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.

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

8 years agoclang driver toolchain refactoring
Xinliang David Li [Thu, 22 Oct 2015 06:15:31 +0000 (06:15 +0000)]
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

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

8 years ago[coroutines] Initial stub Sema functionality for handling coroutine await / yield...
Richard Smith [Thu, 22 Oct 2015 06:13:50 +0000 (06:13 +0000)]
[coroutines] Initial stub Sema functionality for handling coroutine await / yield / return.

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

8 years ago[coroutines] Add forgotten test for lexing coroutines keywords.
Richard Smith [Thu, 22 Oct 2015 05:21:12 +0000 (05:21 +0000)]
[coroutines] Add forgotten test for lexing coroutines keywords.

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

8 years ago[coroutines] Add overloaded unary 'operator co_await'.
Richard Smith [Thu, 22 Oct 2015 05:12:22 +0000 (05:12 +0000)]
[coroutines] Add overloaded unary 'operator co_await'.

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

8 years agoConvert ActOnForwardProtocolDeclaration to take an ArrayRef and use a range-based...
Craig Topper [Thu, 22 Oct 2015 05:00:01 +0000 (05:00 +0000)]
Convert ActOnForwardProtocolDeclaration to take an ArrayRef and use a range-based for loop. NFC

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

8 years agoUse an ArrayRef<OffsetOfComponent> instead of pointer and size throughout offsetof...
Craig Topper [Thu, 22 Oct 2015 04:59:59 +0000 (04:59 +0000)]
Use an ArrayRef<OffsetOfComponent> instead of pointer and size throughout offsetof handling code. Also use a range-based for loop. NFC

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

8 years agoChange FindProtocolDeclaration to take an ArrayRef and use a range-based for loop...
Craig Topper [Thu, 22 Oct 2015 04:59:56 +0000 (04:59 +0000)]
Change FindProtocolDeclaration to take an ArrayRef and use a range-based for loop. NFC

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

8 years agoChange MacroInfo::setArgumentList to take an ArrayRef instead of pointer and size...
Craig Topper [Thu, 22 Oct 2015 04:59:52 +0000 (04:59 +0000)]
Change MacroInfo::setArgumentList to take an ArrayRef instead of pointer and size. While there use std::copy intead of a manual loop.

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

8 years ago[coroutines] Add parsing support for co_await expression, co_yield expression,
Richard Smith [Thu, 22 Oct 2015 04:46:14 +0000 (04:46 +0000)]
[coroutines] Add parsing support for co_await expression, co_yield expression,
co_await modifier on range-based for loop, co_return statement.

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

8 years ago[coroutines] Fix description of LangOption for coroutines.
Richard Smith [Thu, 22 Oct 2015 04:42:51 +0000 (04:42 +0000)]
[coroutines] Fix description of LangOption for coroutines.

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

8 years ago[coroutines] Add feature-test macro for coroutines, defined to 1 to indicate
Richard Smith [Thu, 22 Oct 2015 04:27:47 +0000 (04:27 +0000)]
[coroutines] Add feature-test macro for coroutines, defined to 1 to indicate
the implementation is incomplete.

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

8 years ago[coroutines] Add lexer support for co_await, co_yield, and co_return keywords.
Richard Smith [Thu, 22 Oct 2015 03:52:15 +0000 (03:52 +0000)]
[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.

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

8 years agoFix a couple places where InsertText was being called with a pointer and size when...
Craig Topper [Thu, 22 Oct 2015 03:13:10 +0000 (03:13 +0000)]
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.

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

8 years agoPass an ArrayRef instead of pointer and size. NFC
Craig Topper [Thu, 22 Oct 2015 03:13:07 +0000 (03:13 +0000)]
Pass an ArrayRef instead of pointer and size. NFC

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

8 years agoChange SortAndUniqueProtocols to operate directly on a SmallVector rather than taking...
Craig Topper [Thu, 22 Oct 2015 01:56:18 +0000 (01:56 +0000)]
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."

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

8 years agoUse front() instead of [0] to make code more consistent with the next line that uses...
Craig Topper [Thu, 22 Oct 2015 01:56:16 +0000 (01:56 +0000)]
Use front() instead of [0] to make code more consistent with the next line that uses back().

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

8 years agoFix use-after-free in ModuleManager
Ben Langmuir [Wed, 21 Oct 2015 23:12:45 +0000 (23:12 +0000)]
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

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

8 years agoEnable ARC on the fragile runtime.
John McCall [Wed, 21 Oct 2015 22:06:03 +0000 (22:06 +0000)]
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

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

8 years ago[Driver] Alias -fvisibility=internal to -fvisibility=hidden
Reid Kleckner [Wed, 21 Oct 2015 22:01:02 +0000 (22:01 +0000)]
[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.

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

8 years agoMemorySanitizer does not require PIE.
Evgeniy Stepanov [Wed, 21 Oct 2015 21:28:49 +0000 (21:28 +0000)]
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.

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

8 years agoRevert "MemorySanitizer does not require PIE."
Evgeniy Stepanov [Wed, 21 Oct 2015 20:47:00 +0000 (20:47 +0000)]
Revert "MemorySanitizer does not require PIE."

It actually does require PIE on some targets.

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

8 years agoMemorySanitizer does not require PIE.
Evgeniy Stepanov [Wed, 21 Oct 2015 20:20:03 +0000 (20:20 +0000)]
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.

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

8 years ago[Sema] Remove an unreachable llvm_unreachable
David Majnemer [Wed, 21 Oct 2015 19:48:47 +0000 (19:48 +0000)]
[Sema] Remove an unreachable llvm_unreachable

No functionality change is intended.

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

8 years ago[Myriad]: Always add -L paths even if -nostdlib is set.
Douglas Katzman [Wed, 21 Oct 2015 19:33:54 +0000 (19:33 +0000)]
[Myriad]: Always add -L paths even if -nostdlib is set.

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

8 years agoRename clang config.h include guard from CONFIG_H to CLANG_CONFIG_H
Yaron Keren [Wed, 21 Oct 2015 18:16:01 +0000 (18:16 +0000)]
Rename clang config.h include guard from CONFIG_H to CLANG_CONFIG_H
to make it different from LLVM config.h include guard.

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

8 years agoFix and stylize the emission of GC/ARC ivar and GC block layout strings.
John McCall [Wed, 21 Oct 2015 18:06:47 +0000 (18:06 +0000)]
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.

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

8 years agoUnify the ObjC entrypoint caches.
John McCall [Wed, 21 Oct 2015 18:06:43 +0000 (18:06 +0000)]
Unify the ObjC entrypoint caches.

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

8 years agoSome minor ARC diagnostic improvements.
John McCall [Wed, 21 Oct 2015 18:06:38 +0000 (18:06 +0000)]
Some minor ARC diagnostic improvements.

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

8 years agoIn ARC, peephole the initialization of a __weak variable with
John McCall [Wed, 21 Oct 2015 18:06:31 +0000 (18:06 +0000)]
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.

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

8 years agoclang-format: Teach --sort-includes to interleave #include and #import.
Nico Weber [Wed, 21 Oct 2015 17:13:45 +0000 (17:13 +0000)]
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

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

8 years agoShrink DynTypedNode by one pointer from 40 to 32 bytes (on x86_64).
Benjamin Kramer [Wed, 21 Oct 2015 16:33:15 +0000 (16:33 +0000)]
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

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

8 years agoUpdate clang to match llvm r250901. OptTable constructor now takes an ArrayRef. NFC
Craig Topper [Wed, 21 Oct 2015 16:31:33 +0000 (16:31 +0000)]
Update clang to match llvm r250901. OptTable constructor now takes an ArrayRef. NFC

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

8 years agoUse StringRef instead of calling c_str and doing pointer math before eventually creat...
Craig Topper [Wed, 21 Oct 2015 16:31:31 +0000 (16:31 +0000)]
Use StringRef instead of calling c_str and doing pointer math before eventually creating a StringRef. NFC

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

8 years ago[OpenCL] Add test for program scope variable restrictions in OpenCL v2.0
Anastasia Stulova [Wed, 21 Oct 2015 10:37:57 +0000 (10:37 +0000)]
[OpenCL] Add test for program scope variable restrictions in OpenCL v2.0

http://reviews.llvm.org/D13105

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

8 years agoRevert "[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap."
Benjamin Kramer [Wed, 21 Oct 2015 10:07:26 +0000 (10:07 +0000)]
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.

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

8 years agoFix __ARM_FP value for sp-only FPUs with Half-precision
Richard Barton [Wed, 21 Oct 2015 10:03:55 +0000 (10:03 +0000)]
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

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

8 years ago[modules] libstdc++ defines some static inline functions in its internal
Richard Smith [Wed, 21 Oct 2015 07:13:52 +0000 (07:13 +0000)]
[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.

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

8 years agoUse range-based for loops. NFC.
Craig Topper [Wed, 21 Oct 2015 04:52:40 +0000 (04:52 +0000)]
Use range-based for loops. NFC.

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

8 years agoUse std::find instead of a manual loop.
Craig Topper [Wed, 21 Oct 2015 04:52:38 +0000 (04:52 +0000)]
Use std::find instead of a manual loop.

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

8 years agoParse into an unsigned type instead of a signed type and then checking for positive...
Craig Topper [Wed, 21 Oct 2015 04:52:36 +0000 (04:52 +0000)]
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

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

8 years agoFix bad indentation.
Craig Topper [Wed, 21 Oct 2015 04:52:34 +0000 (04:52 +0000)]
Fix bad indentation.

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

8 years agoUse ArrayRef and MutableArrayRef instead of a pointer and size. NFC
Craig Topper [Wed, 21 Oct 2015 02:34:10 +0000 (02:34 +0000)]
Use ArrayRef and MutableArrayRef instead of a pointer and size. NFC

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

8 years agoRevert r247977, "clang/test/lit.cfg: *-ps4 doesn't have appropriate driver yet. Mark...
NAKAMURA Takumi [Tue, 20 Oct 2015 22:36:16 +0000 (22:36 +0000)]
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.

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

8 years agoRe-land r250592 without rejecting field refs in unevaluated contexts
Reid Kleckner [Tue, 20 Oct 2015 21:04:13 +0000 (21:04 +0000)]
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.

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

8 years ago[-fms-extensions] Allow missing exception specifications in redeclarations as an...
David Majnemer [Tue, 20 Oct 2015 20:49:21 +0000 (20:49 +0000)]
[-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.

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

8 years agoAdd back null check removed accidentally in r250554
Reid Kleckner [Tue, 20 Oct 2015 18:45:57 +0000 (18:45 +0000)]
Add back null check removed accidentally in r250554

Fixes PR25262

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

8 years ago[CMake] Make clang/tools subdirectories controlled via options
Chris Bieneman [Tue, 20 Oct 2015 18:12:12 +0000 (18:12 +0000)]
[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.

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

8 years agoLook through using decls when classifying implicit member access
Reid Kleckner [Tue, 20 Oct 2015 18:12:08 +0000 (18:12 +0000)]
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.

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

8 years ago[CMake] Make external compiler-rt install scripts relative to CMAKE_INSTALL_PREFIX.
Chris Bieneman [Tue, 20 Oct 2015 16:39:25 +0000 (16:39 +0000)]
[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.

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

8 years ago[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.
Benjamin Kramer [Tue, 20 Oct 2015 15:08:46 +0000 (15:08 +0000)]
[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

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

8 years agoRoll-back r250822.
Angel Garcia Gomez [Tue, 20 Oct 2015 13:23:58 +0000 (13:23 +0000)]
Roll-back r250822.

Summary: It breaks the build for the ASTMatchers

Subscribers: klimek, cfe-commits

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

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

8 years agoApply modernize-use-default to clang.
Angel Garcia Gomez [Tue, 20 Oct 2015 12:52:55 +0000 (12:52 +0000)]
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

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

8 years ago[x86] Fix maskload/store intrinsic definitions in avxintrin.h
Andrea Di Biagio [Tue, 20 Oct 2015 11:19:54 +0000 (11:19 +0000)]
[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

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

8 years agoRevert accidental commit. This isn't ready yet.
Benjamin Kramer [Tue, 20 Oct 2015 07:53:14 +0000 (07:53 +0000)]
Revert accidental commit. This isn't ready yet.

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

8 years agoPut back dead code that's used out-of-tree.
Benjamin Kramer [Tue, 20 Oct 2015 07:50:21 +0000 (07:50 +0000)]
Put back dead code that's used out-of-tree.

Partially reverts r250418.

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

8 years ago[DEBUG INFO] Emit debug info for type used in explicit cast only.
Alexey Bataev [Tue, 20 Oct 2015 04:24:12 +0000 (04:24 +0000)]
[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

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

8 years agoRevert "Diagnose UnresolvedLookupExprs that resolve to instance members in static...
Reid Kleckner [Tue, 20 Oct 2015 00:31:42 +0000 (00:31 +0000)]
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>;

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

8 years ago[X86] Remove a few 'else' after 'return'
Craig Topper [Tue, 20 Oct 2015 00:00:17 +0000 (00:00 +0000)]
[X86] Remove a few 'else' after 'return'

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

8 years ago[MS ABI] Give linkonce_odr, instead of external_linkage, to certain kinds of static...
David Majnemer [Mon, 19 Oct 2015 23:22:49 +0000 (23:22 +0000)]
[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.

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

8 years agoclang-format: Use pipes instead of temporary files for most lit tests.
Nico Weber [Mon, 19 Oct 2015 16:21:29 +0000 (16:21 +0000)]
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

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

8 years agoSample Profiles - Fix location of binary encoding documentation. NFC.
Diego Novillo [Mon, 19 Oct 2015 15:53:17 +0000 (15:53 +0000)]
Sample Profiles - Fix location of binary encoding documentation. NFC.

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

8 years agoAdded new options to ClangFormat VSIX package.
Marek Kurdej [Mon, 19 Oct 2015 10:08:35 +0000 (10:08 +0000)]
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

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

8 years agoFix 'will be initialized after' warning.
Manuel Klimek [Mon, 19 Oct 2015 08:43:46 +0000 (08:43 +0000)]
Fix 'will be initialized after' warning.

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

8 years agoMake test not rely on %T ending on /Output.
Manuel Klimek [Mon, 19 Oct 2015 08:27:51 +0000 (08:27 +0000)]
Make test not rely on %T ending on /Output.

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

8 years ago[X86] Enable soft float ABI for x86
Michael Kuperstein [Mon, 19 Oct 2015 08:09:43 +0000 (08:09 +0000)]
[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

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

8 years agoUse saner variable names. NFC.
Michael Kuperstein [Mon, 19 Oct 2015 07:52:25 +0000 (07:52 +0000)]
Use saner variable names. NFC.

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

8 years ago[OPENMP] Fix for http://llvm.org/PR25221: Infinite loop while parsing OpenMP directive
Alexey Bataev [Mon, 19 Oct 2015 06:40:17 +0000 (06:40 +0000)]
[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.

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

8 years agoMake getTargetBuiltins return an ArrayRef instead of having two out parameters of...
Craig Topper [Mon, 19 Oct 2015 04:51:35 +0000 (04:51 +0000)]
Make getTargetBuiltins return an ArrayRef instead of having two out parameters of a pointer and length. NFC

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

8 years agoRecommit "Return an ArrayRef instead of having two out parameters of a pointer and...
Craig Topper [Mon, 19 Oct 2015 03:52:27 +0000 (03:52 +0000)]
Recommit "Return an ArrayRef instead of having two out parameters of a pointer and length. NFC". Hopefully this time the bots will be happy.

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

8 years agoRevert r250676 "Return an ArrayRef instead of having two out parameters of a pointer...
Craig Topper [Mon, 19 Oct 2015 03:17:00 +0000 (03:17 +0000)]
Revert r250676 "Return an ArrayRef instead of having two out parameters of a pointer and length. NFC"

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

8 years agoReturn an ArrayRef instead of having two out parameters of a pointer and length. NFC
Craig Topper [Mon, 19 Oct 2015 03:05:12 +0000 (03:05 +0000)]
Return an ArrayRef instead of having two out parameters of a pointer and length. NFC

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

8 years agoclang-format: Extend main header include sorting heuristic to Objective-C files.
Nico Weber [Mon, 19 Oct 2015 01:36:09 +0000 (01:36 +0000)]
clang-format: Extend main header include sorting heuristic to Objective-C files.

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

8 years agodocs: remote stale refs
Saleem Abdulrasool [Mon, 19 Oct 2015 01:24:08 +0000 (01:24 +0000)]
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.

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

8 years agoUpdate `clang-format -help` output in clang-format docs.
Nico Weber [Mon, 19 Oct 2015 01:08:30 +0000 (01:08 +0000)]
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.

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

8 years agoUpdate list of languages advertised in OVERVIEW: A tool to format C/C++/Java/JavaScri...
Nico Weber [Mon, 19 Oct 2015 01:03:19 +0000 (01:03 +0000)]
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.

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

8 years agoNo functionality change, just fix whitespace, a typo and remove an unnecessary
Nick Lewycky [Sun, 18 Oct 2015 20:32:12 +0000 (20:32 +0000)]
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.)

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

8 years agoCodeGen: simplify TargetOptions setup
Saleem Abdulrasool [Sun, 18 Oct 2015 20:24:53 +0000 (20:24 +0000)]
CodeGen: simplify TargetOptions setup

Do direct assignment of boolean values and regroup.  Use StringSwitch instead of
custom cases.  NFC.

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

8 years agoSupport linking against OpenMP runtime on FreeBSD.
Dimitry Andric [Sun, 18 Oct 2015 13:32:20 +0000 (13:32 +0000)]
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

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

8 years agoclang-format: [JS] Handle string literals spanning character classes.
Daniel Jasper [Sun, 18 Oct 2015 07:02:28 +0000 (07:02 +0000)]
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

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

8 years agoMake a bunch of static arrays const.
Craig Topper [Sun, 18 Oct 2015 05:29:26 +0000 (05:29 +0000)]
Make a bunch of static arrays const.

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

8 years agoAdd an unnecessary makeArrayRef I add earlier. I didn't realize range-based for loops...
Craig Topper [Sun, 18 Oct 2015 05:29:23 +0000 (05:29 +0000)]
Add an unnecessary makeArrayRef I add earlier. I didn't realize range-based for loops worked with arrays.

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

8 years agoUse std::is_sorted instead of a manual loop.
Craig Topper [Sun, 18 Oct 2015 05:29:21 +0000 (05:29 +0000)]
Use std::is_sorted instead of a manual loop.

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