]> granicus.if.org Git - clang/log
clang
8 years ago[analyzer] Make inclusion/exclusion of checkers less ambiguous.
Anton Yartsev [Wed, 28 Oct 2015 16:28:57 +0000 (16:28 +0000)]
[analyzer] Make inclusion/exclusion of checkers less ambiguous.

A checker may be enabled/disabled multiple times via -enable-checker and -disable-checker scan-build arguments. Currently the conflicting and repetitive arguments are passed to the analyzer as is.
With this patch only the last enable/disable of a particular checker is accepted and passed to the analyzer.
This change is mostly done for the upcoming 'config for scan-build' patch when multiple inclusions/exclusions of a checker are expected to be more common.

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

8 years agoPut global classes into the appropriate namespace.
Benjamin Kramer [Wed, 28 Oct 2015 13:54:16 +0000 (13:54 +0000)]
Put global classes into the appropriate namespace.

Most of the cases belong into an anonymous namespace. No functionality
change intended.

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

8 years agoWhen running clang with an arm triple such as '--target=thumbv7m-none-eabi'
Alexandros Lamprineas [Wed, 28 Oct 2015 10:10:03 +0000 (10:10 +0000)]
When running clang with an arm triple such as '--target=thumbv7m-none-eabi'
that has a thumb only CPU by default (cortex-m3), and when using the assembler,
the default thumb state of the CPU does not get passed via the triple to LLVM:

$ clang -target thumbv7m-none-eabi -c -v test.s
clang -cc1as ... -triple armv7m-none--eabi ... test.s

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

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

8 years agoReflow comment.
Eric Christopher [Wed, 28 Oct 2015 06:56:25 +0000 (06:56 +0000)]
Reflow comment.

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

8 years agoRefine r251469 to give better (and more localizable) diagnostics
John McCall [Wed, 28 Oct 2015 05:03:19 +0000 (05:03 +0000)]
Refine r251469 to give better (and more localizable) diagnostics
for all the reasons that ARC makes things implicitly unavailable.

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

8 years agoDriver: support -fuse-ld= on cross windows
Saleem Abdulrasool [Wed, 28 Oct 2015 04:45:58 +0000 (04:45 +0000)]
Driver: support -fuse-ld= on cross windows

Update the linker selection to support the `-fuse-ld=` option for selecting a
linker.

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

8 years agoAdd a test case for r251476.
Akira Hatanaka [Wed, 28 Oct 2015 02:32:19 +0000 (02:32 +0000)]
Add a test case for r251476.

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

8 years ago[CodeGen] Attach function attributes to Objective-C and OpenMP
Akira Hatanaka [Wed, 28 Oct 2015 02:30:47 +0000 (02:30 +0000)]
[CodeGen] Attach function attributes to Objective-C and OpenMP
functions.

This commit fixes a bug in CGOpenMPRuntime.cpp and CGObjC.cpp where
some of the function attributes are not attached to newly created
functions.

rdar://problem/20828324

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

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

8 years agoclang-format: When a line is formatted, also format subsequence lines if their indent...
Daniel Jasper [Wed, 28 Oct 2015 01:08:22 +0000 (01:08 +0000)]
clang-format: When a line is formatted, also format subsequence lines if their indent is off.

Summary: This is especially important so that if a change is solely inserting a block around a few statements, clang-format-diff.py will still clean up and add indentation to the inner parts.

Reviewers: klimek

Subscribers: cfe-commits, klimek

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

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

8 years agoAdd the ability to define "fake" arguments on attributes.
John McCall [Wed, 28 Oct 2015 00:17:34 +0000 (00:17 +0000)]
Add the ability to define "fake" arguments on attributes.

Fake arguments are automatically handled for serialization, cloning,
and other representational tasks, but aren't included in pretty-printing
or parsing (should we eventually ever automate that).

This is chiefly useful for attributes that can be written by the
user, but which are also frequently synthesized by the compiler,
and which we'd like to remember details of the synthesis for.
As a simple example, use this to narrow the cases in which we were
generating a specialized note for implicitly unavailable declarations.

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

8 years agoclang-format: Increase cut-off limit for number of analyzed states.
Daniel Jasper [Tue, 27 Oct 2015 22:55:55 +0000 (22:55 +0000)]
clang-format: Increase cut-off limit for number of analyzed states.

With more complex structures in C++ Lambdas and JavaScript function
literals, the old value was simply to small. However, this is a
temporary solution, I need to look at this more closely a) to find a
fundamentally better approach and b) to look at whether the more recent
usage of NoLineBreak makes us visit stuff in an unfortunate order
where clang-format waste many states in dead ends.

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

8 years agoMinor fix in ToolChainTest.cpp to allow user defined GCC toolchain.
Samuel Antao [Tue, 27 Oct 2015 22:20:26 +0000 (22:20 +0000)]
Minor fix in ToolChainTest.cpp to allow user defined GCC toolchain.

If the user configured clang with a custom GCC toolchain that will take precedence on what the ToolChainTest.cpp expects to evaluate.
This is fixed here by passing --gcc-toolchain= to the driver, in order to override any user defined GCC toolchain.

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

8 years ago[analyzer] Assume escape is possible through system functions taking void*
Anna Zaks [Tue, 27 Oct 2015 20:19:45 +0000 (20:19 +0000)]
[analyzer] Assume escape is possible through system functions taking void*
The analyzer assumes that system functions will not free memory or modify the
arguments in other ways, so we assume that arguments do not escape when
those are called. However, this may lead to false positive leak errors. For
example, in code like this where the pointers added to the rb_tree are freed
later on:

struct alarm_event *e = calloc(1, sizeof(*e));
<snip>

rb_tree_insert_node(&alarm_tree, e);

Add a heuristic to assume that calls to system functions taking void*
arguments allow for pointer escape.

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

8 years ago[analyzer] Enhance FAQ with instructions on handing unused variables.
Anna Zaks [Tue, 27 Oct 2015 20:19:38 +0000 (20:19 +0000)]
[analyzer] Enhance FAQ with instructions on handing unused variables.

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

8 years agoTweak how -Wunused-value interacts with macros
Nico Weber [Tue, 27 Oct 2015 19:47:40 +0000 (19:47 +0000)]
Tweak how -Wunused-value interacts with macros

1. Make the warning more strict in C mode. r172696 added code to suppress
   warnings from macro expansions in system headers, which checks
   `SourceMgr.isMacroBodyExpansion(E->IgnoreParens()->getExprLoc())`. Consider
   this snippet:

   #define FOO(x) (x)
   void f(int a) {
     FOO(a);
   }

   In C, the line `FOO(a)` is an `ImplicitCastExpr(ParenExpr(DeclRefExpr))`,
   while it's just a `ParenExpr(DeclRefExpr)` in C++. So in C++,
   `E->IgnoreParens()` returns the `DeclRefExpr` and the check tests the
   SourceLoc of `a`. In C, the `ImplicitCastExpr` has the effect of checking the
   SourceLoc of `FOO`, which is a macro body expansion, which causes the
   diagnostic to be skipped. It looks unintentional that clang does different
   things for C and C++ here, so use `IgnoreParenImpCasts` instead of
   `IgnoreParens` here. This has the effect of the warning firing more often
   than previously in C code – it now fires as often as it fires in C++ code.

2. Suppress the warning if it would warn on `UNREFERENCED_PARAMETER`.
   `UNREFERENCED_PARAMETER` is a commonly used macro on Windows and it happens
   to uselessly trigger -Wunused-value. As discussed in the thread
   "rfc: winnt.h's UNREFERENCED_PARAMETER() vs clang's -Wunused-value" on
   cfe-dev, fix this by special-casing this specific macro. (This costs a string
   comparison and some fast-path lexing per warning, but the warning is emitted
   rarely. It fires once in Windows.h itself, so this code runs at least once
   per TU including Windows.h, but it doesn't run hundreds of times.)

http://reviews.llvm.org/D13969

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

8 years agoRemove unused diagnostic. NFC.
Benjamin Kramer [Tue, 27 Oct 2015 18:34:47 +0000 (18:34 +0000)]
Remove unused diagnostic. NFC.

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

8 years ago[mips] Separated mips specific -Wa options, so that they are not checked on other...
Daniel Sanders [Tue, 27 Oct 2015 18:04:42 +0000 (18:04 +0000)]
[mips] Separated mips specific -Wa options, so that they are not checked on other platforms.

Summary: This is a follow on to post review comments on revision r248276.

Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: joerg, rengolin, cfe-commits

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

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

8 years agoAllow linking multiple bitcode files.
Artem Belevich [Tue, 27 Oct 2015 17:56:59 +0000 (17:56 +0000)]
Allow linking multiple bitcode files.

Linking options for particular file depend on the option that specifies the file.
Currently there are two:

* -mlink-bitcode-file links in complete content of the specified file.
* -mlink-cuda-bitcode links in only the symbols needed by current TU.
   Linked symbols are internalized. This bitcode linking mode is used to
   link device-specific bitcode provided by CUDA.

Files are linked in order they are specified on command line.

-mlink-cuda-bitcode replaces -fcuda-uses-libdevice flag.

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

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

8 years ago[ms-inline-asm] Test case for alignment directive change in LLVM r251418
Reid Kleckner [Tue, 27 Oct 2015 17:34:29 +0000 (17:34 +0000)]
[ms-inline-asm] Test case for alignment directive change in LLVM r251418

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

8 years ago[MSVC] Workaround for ICE in cl.exe when compiling ASTContext.cpp in Release Win32
Will Wilson [Tue, 27 Oct 2015 17:01:10 +0000 (17:01 +0000)]
[MSVC] Workaround for ICE in cl.exe when compiling ASTContext.cpp in Release Win32

Microsoft connect bug: https://connect.microsoft.com/VisualStudio/feedback/details/1741530

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

8 years agoWiden this enum bitfield by one bit to prevent sign extension in MSVC
Reid Kleckner [Tue, 27 Oct 2015 16:24:03 +0000 (16:24 +0000)]
Widen this enum bitfield by one bit to prevent sign extension in MSVC

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

8 years agoIndex: expose is_mutable_field
Saleem Abdulrasool [Tue, 27 Oct 2015 15:50:22 +0000 (15:50 +0000)]
Index: expose is_mutable_field

Expose isMutable via libClang and python bindings.

Patch by Jonathan B Coe!

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

8 years ago[analyzer] Fix lambdas that are capturing constants.
Gabor Horvath [Tue, 27 Oct 2015 13:46:39 +0000 (13:46 +0000)]
[analyzer] Fix lambdas that are capturing constants.

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

8 years agoclang-format: Undo unwanted format change done in r251405.
Daniel Jasper [Tue, 27 Oct 2015 13:42:08 +0000 (13:42 +0000)]
clang-format: Undo unwanted format change done in r251405.

Specifically, don't wrap between the {} of an empty constructor if the
"}" falls on column 81 and ConstructorInitializerAllOnOneLineOrOnePerLine
is set.

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

8 years agoclang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.
Daniel Jasper [Tue, 27 Oct 2015 12:38:37 +0000 (12:38 +0000)]
clang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.

Summary:
If this option is set, clang-format will always insert a line wrap, e.g.
before the first parameter of a function call unless all parameters fit
on the same line. This obviates the need to make a decision on the
alignment itself.

Use this style for Google's JavaScript style and add some minor tweaks
to correctly handle nested blocks etc. with it. Don't use this option
for for/while loops.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

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

8 years ago[analyzer] Fix another crash when analyzing lambda functions.
Gabor Horvath [Tue, 27 Oct 2015 12:36:26 +0000 (12:36 +0000)]
[analyzer] Fix another crash when analyzing lambda functions.

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

8 years agoProperly clear current coroutine promise on FunctionScopeInfo reuse. Should
Richard Smith [Tue, 27 Oct 2015 07:47:45 +0000 (07:47 +0000)]
Properly clear current coroutine promise on FunctionScopeInfo reuse. Should
hopefully make bots happy again.

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

8 years agoAccess the right triple field for IAMCU.
Michael Kuperstein [Tue, 27 Oct 2015 07:46:22 +0000 (07:46 +0000)]
Access the right triple field for IAMCU.

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

8 years agoWork around incomplete list initialization support in older MSVC.
Richard Smith [Tue, 27 Oct 2015 07:25:29 +0000 (07:25 +0000)]
Work around incomplete list initialization support in older MSVC.

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

8 years agoHandle target builtin options that are all required rather than
Eric Christopher [Tue, 27 Oct 2015 06:11:03 +0000 (06:11 +0000)]
Handle target builtin options that are all required rather than
only one of a group of possibilities.

This changes the syntax in the builtin files to represent:

, as the and operator
| as the or operator

The former syntax matches how the backend tablegen files represent
multiple subtarget features being required.

Updated the builtin and intrinsic headers accordingly for the new
syntax.

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

8 years ago[coroutines] Creation of promise object, lookup of operator co_await, building
Richard Smith [Tue, 27 Oct 2015 06:02:45 +0000 (06:02 +0000)]
[coroutines] Creation of promise object, lookup of operator co_await, building
of await_* calls, and AST representation for same.

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

8 years agoCreate undef reference to profile hook symbol
Xinliang David Li [Tue, 27 Oct 2015 05:15:35 +0000 (05:15 +0000)]
Create undef reference to profile hook symbol

Create undef reference to profile hook symbol when
PGO instrumentation is turned on. This allows
LLVM to omit emission of hook variable use method
for every single module instrumented.

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

8 years agoBe more conservative about diagnosing "incorrect" uses of __weak:
John McCall [Tue, 27 Oct 2015 04:54:50 +0000 (04:54 +0000)]
Be more conservative about diagnosing "incorrect" uses of __weak:
allow them to be written in certain kinds of user declaration and
diagnose on the use-site instead.

Also, improve and fix some diagnostics relating to __weak and
properties.

rdar://23228631

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

8 years agoUse early exits to reduce indentation.
Eric Christopher [Tue, 27 Oct 2015 00:06:21 +0000 (00:06 +0000)]
Use early exits to reduce indentation.

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

8 years agoMismatchingNewDeleteDetector uses incorrect field, and finds no initializer
Ismail Pazarbasi [Mon, 26 Oct 2015 19:20:24 +0000 (19:20 +0000)]
MismatchingNewDeleteDetector uses incorrect field, and finds no initializer

Summary:
In `MismatchingNewDeleteDetector::analyzeInClassInitializer`, if
`Field`'s initializer expression is null, lookup the field in
implicit instantiation, and use found field's the initializer.

Reviewers: rsmith, rtrieu

Subscribers: cfe-commits

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

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

8 years ago[analyzer] Added a missing test case for r251289.
Gabor Horvath [Mon, 26 Oct 2015 17:42:14 +0000 (17:42 +0000)]
[analyzer] Added a missing test case for r251289.

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

8 years ago[analyzer] ccc-analyzer: Fix -isystem value passing.
Devin Coughlin [Mon, 26 Oct 2015 17:19:51 +0000 (17:19 +0000)]
[analyzer] ccc-analyzer: Fix -isystem value passing.

The regex for -isystem matching is broken. -[D,I,Usystem] matches "-D", "-,",
"-I", "-U", "-s" "-y", etc. Besides that, "-isystem /foo" gets interpreted as
"-i" with a non-empty value "system" and thus the next "/foo" argument is not
read. This patch corrects the regex.

This fixes PR13237 <https://llvm.org/bugs/show_bug.cgi?id=13237>.

A patch by Peter Wu!

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

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

8 years ago[analyzer] Fixed a rare crash when analyzing lambda functions.
Gabor Horvath [Mon, 26 Oct 2015 13:32:26 +0000 (13:32 +0000)]
[analyzer] Fixed a rare crash when analyzing lambda functions.

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

8 years agoclang-format: Fix false positive in cast detection.
Daniel Jasper [Mon, 26 Oct 2015 12:08:47 +0000 (12:08 +0000)]
clang-format: Fix false positive in cast detection.

Before (with spaces in parentheses):
  void inFunction() { std::function<void( int, int )> fct; }

After:
  void inFunction() { std::function<void( int, int)> fct; }

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

8 years ago[X86] Mark inregs correctly for MCU psABI
Michael Kuperstein [Sun, 25 Oct 2015 08:18:20 +0000 (08:18 +0000)]
[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

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

8 years ago[analyzer] scan-build: Teach ccc-analyzer about -Xclang.
Devin Coughlin [Sun, 25 Oct 2015 01:30:18 +0000 (01:30 +0000)]
[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.

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

8 years agoSimplify boolean conditional return statements in lib/Basic.
Rafael Espindola [Sat, 24 Oct 2015 23:15:31 +0000 (23:15 +0000)]
Simplify boolean conditional return statements in lib/Basic.

Patch by Richard.

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

8 years agoclang/module.modulemap: s/Basic/BuiltinsR600.def/Basic/BuiltinsAMDGPU.def/
NAKAMURA Takumi [Sat, 24 Oct 2015 07:16:41 +0000 (07:16 +0000)]
clang/module.modulemap: s/Basic/BuiltinsR600.def/Basic/BuiltinsAMDGPU.def/

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

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