]> granicus.if.org Git - clang/log
clang
6 years agoUpdate for layering fix in LLVM CodeGen<>Target
David Blaikie [Fri, 17 Nov 2017 01:07:20 +0000 (01:07 +0000)]
Update for layering fix in LLVM CodeGen<>Target

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

6 years agoRe-revert "Refactor debuginfo-tests"
Zachary Turner [Fri, 17 Nov 2017 00:41:18 +0000 (00:41 +0000)]
Re-revert "Refactor debuginfo-tests"

This is still broken because it causes certain tests to be
run twice with slightly different configurations, which is
wrong in some cases.

You can observe this by running:

  ninja -nv check-all | grep debuginfo-tests

And seeing that it passes clang/test and clang/test/debuginfo-tests
to lit, which causes it to run debuginfo-tests twice.  The fix is
going to involve either:

  a) figuring out that we're running in this "deprecated" configuration,
     and then deleting the clang/test/debuginfo-tests path, which should
     cause it to behave identically to before, or:
  b) make lit smart enough that it doesn't descend into a sub-suite if
     that sub-suite already has a lit.cfg file.

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

6 years agoPR22763: if a defaulted (non-user-provided) special member function is
Richard Smith [Thu, 16 Nov 2017 23:54:56 +0000 (23:54 +0000)]
PR22763: if a defaulted (non-user-provided) special member function is
explicitly instantiated, still emit it with each use.

We don't emit a definition of the member with an explicit instantiation
definition (and indeed it appears that we're not allowed to, since an explicit
instantiation definition does not constitute an odr-use and only odr-use
permits definition for defaulted special members). So we still need to emit a
weak definition with each use.

This also makes defaulted-in-class declarations behave more like
implicitly-declared special members, which matches their design intent.
And it matches the way this problem was solved in GCC.

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

6 years agoIssue -Wempty-body warnings for else blocks
Reid Kleckner [Thu, 16 Nov 2017 21:26:18 +0000 (21:26 +0000)]
Issue -Wempty-body warnings for else blocks

This looks like it was just an oversight.

Fixes http://llvm.org/pr35319

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

6 years ago[VirtualFileSystem] Support creating directories then adding files inside
Ben Hamilton [Thu, 16 Nov 2017 19:34:08 +0000 (19:34 +0000)]
[VirtualFileSystem] Support creating directories then adding files inside

Summary:
In https://reviews.llvm.org/D39572 , I added support for specifying
`Type` when invoking `InMemoryFileSystem::addFile()`.

However, I didn't account for the fact that when `Type` is
`directory_file`, we need to construct an `InMemoryDirectory`, not an
`InMemoryFile`, or else clients cannot create files inside that
directory.

This diff fixes the bug and adds a test.

Test Plan: New test added. Ran test with:

  % make -j12 check-clang-tools

Reviewers: bkramer, hokein

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D40140

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

6 years ago[MS] Apply adjustments after storing 'this'
Reid Kleckner [Thu, 16 Nov 2017 19:09:36 +0000 (19:09 +0000)]
[MS] Apply adjustments after storing 'this'

Summary:
The MS ABI convention is that the 'this' pointer on entry is the address
of the vfptr that was used to make the virtual method call. In other
words, the pointer on entry always points to the base subobject that
introduced the virtual method. Consider this hierarchy:

  struct A { virtual void f() = 0; };
  struct B { virtual void g() = 0; };
  struct C : A, B {
    void f() override;
    void g() override;
  };

On entry to C::g, [ER]CX will contain the address of C's B subobject,
and C::g will have to subtract sizeof(A) to recover a pointer to C.

Before this change, we applied this adjustment in the prologue and
stored the new value into the "this" local variable alloca used for
debug info. However, MSVC does not do this, presumably because it is
often profitable to fold the adjustment into later field accesses. This
creates a problem, because the debugger expects the variable to be
unadjusted. Unfortunately, CodeView doesn't have anything like DWARF
expressions for computing variables that aren't in the program anymore,
so we have to declare 'this' to be the unadjusted value if we want the
debugger to see the right value.

This has the side benefit that, in optimized builds, the 'this' pointer
will usually be available on function entry because it doesn't require
any adjustment.

Reviewers: hans

Subscribers: aprantl, cfe-commits

Differential Revision: https://reviews.llvm.org/D40109

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

6 years agoResubmit "Refactor debuginfo-tests"
Zachary Turner [Thu, 16 Nov 2017 18:26:20 +0000 (18:26 +0000)]
Resubmit "Refactor debuginfo-tests"

This was reverted due to some failures on specific darwin buildbots,
the issue being that the new lit configuration was not setting the
SDKROOT environment variable.  We've tested a fix locally and confirmed
that it works, so this patch resubmits everything with the fix
applied.

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

6 years ago[OPENMP] Add support for cancelling inside target parallel for
Alexey Bataev [Thu, 16 Nov 2017 18:20:21 +0000 (18:20 +0000)]
[OPENMP] Add support for cancelling inside target parallel for
directive.

Added missed support for cancelling of target parallel for construct.

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

6 years agoUpdate tests for llvm.invariant.group.barrier becoming mangled
Yaxun Liu [Thu, 16 Nov 2017 16:33:04 +0000 (16:33 +0000)]
Update tests for llvm.invariant.group.barrier becoming mangled

Differential Revision: https://reviews.llvm.org/D40062

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

6 years agoAllow to store precompiled preambles in memory.
Ilya Biryukov [Thu, 16 Nov 2017 16:25:01 +0000 (16:25 +0000)]
Allow to store precompiled preambles in memory.

Summary:
These preambles are built by ASTUnit and clangd. Previously, preambles
were always stored on disk.

In-memory preambles are routed back to the compiler as virtual files in
a custom VFS.

Interface of ASTUnit does not allow to use in-memory preambles, as
ASTUnit::CodeComplete receives FileManager as a parameter, so we can't
change VFS used by the compiler inside the CodeComplete method.

A follow-up commit will update clangd in clang-tools-extra to use
in-memory preambles.

Reviewers: klimek, sammccall, bkramer

Reviewed By: klimek

Subscribers: ioeric, cfe-commits

Differential Revision: https://reviews.llvm.org/D39842

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

6 years agoAdd NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.
Eric Christopher [Thu, 16 Nov 2017 03:18:09 +0000 (03:18 +0000)]
Add NDEBUG checks around LLVM_DUMP_METHOD functions for Wunused-function warnings.

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

6 years ago[DeclPrinter] Extract function PrintConstructorInitializers, NFC
Alex Lorenz [Thu, 16 Nov 2017 01:31:27 +0000 (01:31 +0000)]
[DeclPrinter] Extract function PrintConstructorInitializers, NFC

Patch by Nikolai Kosjar!

Differential Revision: https://reviews.llvm.org/D40066

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

6 years ago[DeclPrinter] Honor TerseOutput for constructors
Alex Lorenz [Thu, 16 Nov 2017 01:28:25 +0000 (01:28 +0000)]
[DeclPrinter] Honor TerseOutput for constructors

Patch by Nikolai Kosjar!

Differential Revision: https://reviews.llvm.org/D39957

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

6 years agoclang/module.modulemap: clang/Basic/X86Target.def may be textual header.
NAKAMURA Takumi [Wed, 15 Nov 2017 23:04:44 +0000 (23:04 +0000)]
clang/module.modulemap: clang/Basic/X86Target.def may be textual header.

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

6 years agoAdd X86Target.def that was forgotten in r30734
Erich Keane [Wed, 15 Nov 2017 22:36:24 +0000 (22:36 +0000)]
Add X86Target.def that was forgotten in r30734

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

6 years agoSplit x86 "Processor" info into its own def file. [NFC]
Erich Keane [Wed, 15 Nov 2017 22:25:39 +0000 (22:25 +0000)]
Split x86 "Processor" info into its own def file. [NFC]

A first step toward removing the repetition of
features/CPU info in the x86 target info, this
patch pulls all the processor information out into
its own .def file.

Differential Revision: https://reviews.llvm.org/D40093

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

6 years ago[AST, Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 15 Nov 2017 22:00:04 +0000 (22:00 +0000)]
[AST, Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoTry to fix test/SemaCXX/deleted-operator.cpp after r318309
Hans Wennborg [Wed, 15 Nov 2017 17:47:58 +0000 (17:47 +0000)]
Try to fix test/SemaCXX/deleted-operator.cpp after r318309

The number of 'built-in candidate' notes now varies since __float128 may
or may not be a candidate depending on the target.

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

6 years agoBuiltinOperatorOverloadBuilder: Don't consider types that are unavailable on the...
Hans Wennborg [Wed, 15 Nov 2017 17:11:53 +0000 (17:11 +0000)]
BuiltinOperatorOverloadBuilder: Don't consider types that are unavailable on the target (PR35174)

In the PR, Clang ended up in a situation where it tried to mangle the
__float128 type, which isn't supported when targetingt MSVC, because
Clang instantiated a variable template with that type when searching for
a conversion to use in an arithmetic expression.

Differential revision: https://reviews.llvm.org/D39579

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

6 years agoASTMatchers.h: Fix ODR violations by avoiding internal linkage variables in headers
David Blaikie [Wed, 15 Nov 2017 16:52:12 +0000 (16:52 +0000)]
ASTMatchers.h: Fix ODR violations by avoiding internal linkage variables in headers

Internal linkage variables ODR referenced from inline functions create
ODR violations (the same inline function ends up having different
definitions in each TU, since it references different variables - rather
than one definition).

This also happens to break modular code generation - so this is the last
fix to allow clang to compile with modular code generation.

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

6 years ago[libclang] Fix cursors for in-class initializer of field declarations
Benjamin Kramer [Wed, 15 Nov 2017 12:20:41 +0000 (12:20 +0000)]
[libclang] Fix cursors for in-class initializer of field declarations

Fixes PR33745.

Patch by Nikolai Kosjar!

Differential Revision: https://reviews.llvm.org/D40027

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

6 years ago[OpenCL] Fix code generation of function-scope constant samplers.
Alexey Bader [Wed, 15 Nov 2017 11:38:17 +0000 (11:38 +0000)]
[OpenCL] Fix code generation of function-scope constant samplers.

Summary:
Constant samplers are handled as static variables and clang's code generation
library, which leads to llvm::unreachable. We bypass emitting sampler variable
as static since it's translated to a function call later.

Reviewers: yaxunl, Anastasia

Reviewed By: yaxunl, Anastasia

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D34342

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

6 years ago[clang] Expose orderedString from CodeCompletionResult. NFC
Sam McCall [Wed, 15 Nov 2017 09:15:06 +0000 (09:15 +0000)]
[clang] Expose orderedString from CodeCompletionResult. NFC

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

6 years agoASTMatchers.h: Avoid warnings due to "@throw". [-Wdocumentation]
NAKAMURA Takumi [Wed, 15 Nov 2017 06:53:45 +0000 (06:53 +0000)]
ASTMatchers.h: Avoid warnings due to "@throw". [-Wdocumentation]

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

6 years agoPR35214: don't crash if we see an array of unknown bound added to an empty but invali...
Richard Smith [Wed, 15 Nov 2017 03:03:56 +0000 (03:03 +0000)]
PR35214: don't crash if we see an array of unknown bound added to an empty but invalid designator.

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

6 years ago[modules] Fix crash in complex class merging scenario.
Richard Smith [Wed, 15 Nov 2017 01:33:46 +0000 (01:33 +0000)]
[modules] Fix crash in complex class merging scenario.

When we merge together class definitions, we can end up with the canonical
declaration of a field not being the one that was lexically within the
canonical definition of the class. Additionally, when we merge class
definitions via update records (eg, for a template specialization whose
declaration is instantiated in one module and whose definition is instantiated
in multiple others), we can end up with the list of lexical contents for the
class not including a particular declaration of a field whose lexical parent is
that class definition. In the worst case, we have a field whose canonical
declaration's lexical parent has no fields, and in that case this attempt to
number the fields by walking the fields in the declaration of the class that
contained one of the canonical fields will fail.

Instead, when numbering fields in a class, do the obvious thing: walk the
fields in the definition.

I'm still trying to reduce a testcase; the setup that leads to the above
scenario seems to be quite fragile.

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

6 years agoSimplify CpuIs code to use include from LLVM
Erich Keane [Wed, 15 Nov 2017 00:11:24 +0000 (00:11 +0000)]
Simplify CpuIs code to use include from LLVM

LLVM exposes a file in the backend (X86TargetParser.def) that
contains information about the correct list of CpuIs values.

This patch removes 2 of the copied and pasted versions of this
list from clang and instead includes the data from the .def file.

Differential Revision: https://reviews.llvm.org/D40054

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

6 years ago[PGO] Detect more structural changes with the stable hash
Vedant Kumar [Tue, 14 Nov 2017 23:56:53 +0000 (23:56 +0000)]
[PGO] Detect more structural changes with the stable hash

Lifting from Bob Wilson's notes: The hash value that we compute and
store in PGO profile data to detect out-of-date profiles does not
include enough information. This means that many significant changes to
the source will not cause compiler warnings about the profile being out
of date, and worse, we may continue to use the outdated profile data to
make bad optimization decisions.  There is some tension here because
some source changes won't affect PGO and we don't want to invalidate the
profile unnecessarily.

This patch adds a new hashing scheme which is more sensitive to loop
nesting, conditions, and out-of-order control flow. Here are examples
which show snippets which get the same hash under the current scheme,
and different hashes under the new scheme:

Loop Nesting Example
--------------------

  // Snippet 1
  while (foo()) {
    while (bar()) {}
  }

  // Snippet 2
  while (foo()) {}
  while (bar()) {}

Condition Example
-----------------

  // Snippet 1
  if (foo())
    bar();
  baz();

  // Snippet 2
  if (foo())
    bar();
  else
    baz();

Out-of-order Control Flow Example
---------------------------------

  // Snippet 1
  while (foo()) {
    if (bar()) {}
    baz();
  }

  // Snippet 2
  while (foo()) {
    if (bar())
      continue;
    baz();
  }

In each of these cases, it's useful to differentiate between the
snippets because swapping their profiles gives bad optimization hints.

The new hashing scheme considers some logical operators in an effort to
detect more changes in conditions. This isn't a perfect scheme. E.g, it
does not produce the same hash for these equivalent snippets:

  // Snippet 1
  bool c = !a || b;
  if (d && e) {}

  // Snippet 2
  bool f = d && e;
  bool c = !a || b;
  if (f) {}

This would require an expensive data flow analysis. Short of that, the
new hashing scheme looks reasonably complete, based on a scan over the
statements we place counters on.

Profiles which use the old version of the PGO hash remain valid and can
be used without issue (there are tests in tree which check this).

rdar://17068282

Differential Revision: https://reviews.llvm.org/D39446

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

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 14 Nov 2017 23:35:42 +0000 (23:35 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 14 Nov 2017 23:13:32 +0000 (23:13 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[refactor][selection] canonicalize decl ref callee to the call expr
Alex Lorenz [Tue, 14 Nov 2017 23:10:50 +0000 (23:10 +0000)]
[refactor][selection] canonicalize decl ref callee to the call expr

We would like to extract the full call when just the callee function is
selected

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

6 years agoTry to fix the instrument-functions tests
Hans Wennborg [Tue, 14 Nov 2017 23:10:04 +0000 (23:10 +0000)]
Try to fix the instrument-functions tests

On e.g. PPC the return value and argument were marked 'signext'. This
makes the test expectations a bit more flexible.

Follow-up to r318199.

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

6 years ago[refactor][selection] canonicalize member expr callee to the full
Alex Lorenz [Tue, 14 Nov 2017 22:06:55 +0000 (22:06 +0000)]
[refactor][selection] canonicalize member expr callee to the full
member call expression

We would like to extract the full call when just the callee is selected.

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

6 years agoSwitch -mcount and -finstrument-functions to emit EnterExitInstrumenter attributes
Hans Wennborg [Tue, 14 Nov 2017 21:13:27 +0000 (21:13 +0000)]
Switch -mcount and -finstrument-functions to emit EnterExitInstrumenter attributes

This updates -mcount to use the new attribute names (LLVM r318195), and
switches over -finstrument-functions to also use these attributes rather
than inserting instrumentation in the frontend.

It also adds a new flag, -finstrument-functions-after-inlining, which
makes the cygprofile instrumentation get inserted after inlining rather
than before.

Differential Revision: https://reviews.llvm.org/D39331

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

6 years ago[OPENMP] Fix DSA analysis for threadprivates after deserialization.
Alexey Bataev [Tue, 14 Nov 2017 21:01:01 +0000 (21:01 +0000)]
[OPENMP] Fix DSA analysis for threadprivates after deserialization.

If threadprivate vaible is deserialized, it is not marked as
threadprivate in DSAStack.

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

6 years ago[refactor][extract] avoid extracting expressions from types in functions
Alex Lorenz [Tue, 14 Nov 2017 18:59:01 +0000 (18:59 +0000)]
[refactor][extract] avoid extracting expressions from types in functions

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

6 years ago[tooling] Make compile_flags.txt negative test more hermetic
Sam McCall [Tue, 14 Nov 2017 15:22:34 +0000 (15:22 +0000)]
[tooling] Make compile_flags.txt negative test more hermetic

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

6 years agoMake isDefinition matcher support ObjCMethodDecl
Dave Lee [Tue, 14 Nov 2017 14:17:26 +0000 (14:17 +0000)]
Make isDefinition matcher support ObjCMethodDecl

Summary:
Allow the `isDefinition()` matcher to apply to `ObjCMethodDecl` nodes, in
addition to those it already supports. For whatever reason, `ObjCMethodDecl`
does not inherit from `FunctionDecl` and so this is specialization is necessary.

Reviewers: aaron.ballman, malcolm.parsons, alexshap

Reviewed By: aaron.ballman

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D39948

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

6 years agoMake DiagnosticIDs::getAllDiagnostics static. NFC.
Gabor Horvath [Tue, 14 Nov 2017 12:14:49 +0000 (12:14 +0000)]
Make DiagnosticIDs::getAllDiagnostics static. NFC.

Patch by: Andras Leitereg!

Differential Revision: https://reviews.llvm.org/D39372

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

6 years ago[ASTImporter] TypeAliasTemplate and PackExpansion importing capability
Gabor Horvath [Tue, 14 Nov 2017 11:30:38 +0000 (11:30 +0000)]
[ASTImporter] TypeAliasTemplate and PackExpansion importing capability

Patch by: Zoltan Gera!

Differential Revision: https://reviews.llvm.org/D39247

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

6 years ago[libclang] Allow crash recovery with LIBCLANG_NOTHREADS
Erik Verbruggen [Tue, 14 Nov 2017 09:34:39 +0000 (09:34 +0000)]
[libclang] Allow crash recovery with LIBCLANG_NOTHREADS

Enabled crash recovery for some libclang operations on a calling thread even
when LIBCLANG_NOTHREAD is specified.

Previously it would only run under crash recovery if LIBCLANG_NOTHREAD is not
set. Moved handling of LIBCLANG_NOTHREAD env variable into RunSafely from its
call sites.

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

6 years agoRefactor ContinuationIndenter's breakProtrudingToken logic.
Manuel Klimek [Tue, 14 Nov 2017 09:19:53 +0000 (09:19 +0000)]
Refactor ContinuationIndenter's breakProtrudingToken logic.

Create more orthogonal pieces. The restructuring made it easy to try out
several alternatives to D33589, and while none of the alternatives
turned out to be the right solution, the underlying simplification of
the structure is helpful.

Differential Revision: https://reviews.llvm.org/D39900

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

6 years ago[NewPassManager] Pass the -fdebug-pass-manager flag setting into the Analysis manager...
Craig Topper [Tue, 14 Nov 2017 08:48:28 +0000 (08:48 +0000)]
[NewPassManager] Pass the -fdebug-pass-manager flag setting into the Analysis managers to match what we do in opt

Summary: Currently the -fdebug-pass-manager flag for clang doesn't enable the debug logging in the analysis managers. This is different than what the switch does when passed to opt.

Reviewers: chandlerc

Reviewed By: chandlerc

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D40007

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

6 years ago[PM] Require a registered x86 target for this test which uses the x86
Chandler Carruth [Tue, 14 Nov 2017 05:20:03 +0000 (05:20 +0000)]
[PM] Require a registered x86 target for this test which uses the x86
triple.

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

6 years ago[PM] Wire up support for the bounds checking sanitizer with the new PM.
Chandler Carruth [Tue, 14 Nov 2017 01:59:18 +0000 (01:59 +0000)]
[PM] Wire up support for the bounds checking sanitizer with the new PM.

Not much interesting here. Mostly wiring things together.

One thing worth noting is that the approach is substantially different
from the old PM. Here, the -O0 case works fundamentally differently in
that we just directly build the pipeline without any callbacks or other
cruft. In some ways, this is nice and clean. However, I don't like that
it causes the sanitizers to be enabled with different changes at
different times. =/ Suggestions for a better way to do this are welcome.

Differential Revision: https://reviews.llvm.org/D39085

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

6 years ago[PM] Add a missing header that I had in the next commit but was needed
Chandler Carruth [Tue, 14 Nov 2017 01:47:24 +0000 (01:47 +0000)]
[PM] Add a missing header that I had in the next commit but was needed
in r318128. Should fix the build.

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

6 years ago[completion] complete ObjC interface names in an expression
Alex Lorenz [Tue, 14 Nov 2017 01:46:24 +0000 (01:46 +0000)]
[completion] complete ObjC interface names in an expression

Objective-C interfaces can be used in a class property expression.

rdar://26982192

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

6 years ago[PM] Port BoundsChecking to the new PM.
Chandler Carruth [Tue, 14 Nov 2017 01:30:04 +0000 (01:30 +0000)]
[PM] Port BoundsChecking to the new PM.

Registers it and everything, updates all the references, etc.

Next patch will add support to Clang's `-fexperimental-new-pass-manager`
path to actually enable BoundsChecking correctly.

Differential Revision: https://reviews.llvm.org/D39084

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

6 years ago[Sema] Stable sort OverloadCandidates to remove non-deterministic ordering
Mandeep Singh Grang [Tue, 14 Nov 2017 00:22:24 +0000 (00:22 +0000)]
[Sema] Stable sort OverloadCandidates to remove non-deterministic ordering

Summary: This fixes failure in Misc/diag-template-diffing.cpp uncovered by D39245.

Reviewers: rjmccall, rsmith

Reviewed By: rjmccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D39944

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

6 years agoRevert "Update test_debuginfo.pl script to point to new tree location."
Zachary Turner [Mon, 13 Nov 2017 23:33:29 +0000 (23:33 +0000)]
Revert "Update test_debuginfo.pl script to point to new tree location."

This reverts the aforementioned patch and 2 subsequent follow-ups,
as some buildbots are still failing 2 tests because of it.
Investigation is ongoing into the cause of the failures.

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

6 years agoUpdate link to protobuf
Hans Wennborg [Mon, 13 Nov 2017 23:27:55 +0000 (23:27 +0000)]
Update link to protobuf

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

6 years agoUpdate a link to the old code.google.com bug tracker
Hans Wennborg [Mon, 13 Nov 2017 23:27:54 +0000 (23:27 +0000)]
Update a link to the old code.google.com bug tracker

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

6 years agoUpdate link to the Chromium Clang page
Hans Wennborg [Mon, 13 Nov 2017 23:27:53 +0000 (23:27 +0000)]
Update link to the Chromium Clang page

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

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Mon, 13 Nov 2017 23:01:27 +0000 (23:01 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoOpenCL: Assume inline asm is convergent
Matt Arsenault [Mon, 13 Nov 2017 22:40:55 +0000 (22:40 +0000)]
OpenCL: Assume inline asm is convergent

Already done for CUDA.

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

6 years ago[CodeGen] fix const-ness of cbrt and fma
Sanjay Patel [Mon, 13 Nov 2017 22:11:49 +0000 (22:11 +0000)]
[CodeGen] fix const-ness of cbrt and fma

cbrt() is always constant because it can't overflow or underflow. Therefore, it can't set errno.

fma() is not always constant because it can overflow or underflow. Therefore, it can set errno.
But we know that it never sets errno on GNU / MSVC, so make it constant in those environments.

Differential Revision: https://reviews.llvm.org/D39641

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

6 years ago [clang] Remove redundant return [NFC]
Mandeep Singh Grang [Mon, 13 Nov 2017 19:29:31 +0000 (19:29 +0000)]
 [clang] Remove redundant return [NFC]

Reviewers: rsmith, sfantao, mcrosier

Reviewed By: mcrosier

Subscribers: jholewinski, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D39915

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

6 years ago[analyzer] ObjCGenerics: Don't warn on cast conversions involving explicit cast
Devin Coughlin [Mon, 13 Nov 2017 17:35:29 +0000 (17:35 +0000)]
[analyzer] ObjCGenerics: Don't warn on cast conversions involving explicit cast

The ObjCGenerics checker warns on a cast when there is no subtyping relationship
between the tracked type of the value and the destination type of the cast. It
does this even if the cast was explicitly written. This means the user can't
write an explicit cast to silence the diagnostic.

This commit treats explicit casts involving generic types as an indication from
the programmer that the Objective-C type system is not rich enough to express
the needed invariant. On explicit casts, the checker now removes any existing
information inferred about the type arguments. Further, it no longer assumes
the casted-to specialized type because the invariant the programmer specifies
in the cast may only hold at a particular program point and not later ones. This
prevents a suppressing cast from requiring a cascade of casts down the
line.

rdar://problem/33603303

Differential Revision: https://reviews.llvm.org/D39711

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

6 years ago[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
Teresa Johnson [Mon, 13 Nov 2017 15:38:33 +0000 (15:38 +0000)]
[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang

Recommit of r317951 and r317951 along with what I believe should fix
the remaining buildbot failures - the target triple should be specified
for both the ThinLTO pre-thinlink compile and backend (post-thinlink)
compile to ensure it is consistent.

Original description:
The LTO Config field wasn't being set when invoking a ThinLTO backend
via clang (i.e. for distributed builds).

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

6 years ago[X86] test/testn intrinsics lowering to IR. clang side
Uriel Korach [Mon, 13 Nov 2017 12:50:52 +0000 (12:50 +0000)]
[X86] test/testn intrinsics lowering to IR. clang side

Change Header files of the intrinsics for lowering test and testn intrinsics to IR code.
Removed test and testn builtins from clang

Differential Revision: https://reviews.llvm.org/D38737

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

6 years agoChange
Jina Nahias [Mon, 13 Nov 2017 11:41:41 +0000 (11:41 +0000)]
Change
// CHECK: shufflevector <8 x double> %0, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 8, i32 9>
To
// CHECK: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 8, i32 9>
for fixing 318025 commit warning

Change-Id: Id48a1fe1f247fe6a0b84e7189f18d2e637678e79

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

6 years ago[analyzer] Document the issue hash debugging facility
Gabor Horvath [Mon, 13 Nov 2017 11:13:02 +0000 (11:13 +0000)]
[analyzer] Document the issue hash debugging facility

Differential Revision: https://reviews.llvm.org/D39543

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

6 years ago[x86][AVX512] Lowering shuffle i/f intrinsics to LLVM IR
Jina Nahias [Mon, 13 Nov 2017 09:15:31 +0000 (09:15 +0000)]
[x86][AVX512] Lowering shuffle i/f intrinsics to LLVM IR

This patch, together with a matching llvm patch (https://reviews.llvm.org/D38671), implements the lowering of X86 shuffle i/f intrinsics to IR.

Differential Revision: https://reviews.llvm.org/D38672

Change-Id: I9b3c2f2b34323bd9ccb21d0c1832f848b88ec047

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

6 years agoFix AST matcher documentation typo
Dave Lee [Sat, 11 Nov 2017 23:53:27 +0000 (23:53 +0000)]
Fix AST matcher documentation typo

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

6 years agoAdd ObjC exception statement AST matchers
Dave Lee [Sat, 11 Nov 2017 22:46:15 +0000 (22:46 +0000)]
Add ObjC exception statement AST matchers

Summary: Add AST matchers for Objective-C @throw, @try, @catch and @finally.

Reviewers: aaron.ballman, malcolm.parsons, alexshap, compnerd

Reviewed By: aaron.ballman

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D39940

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

6 years ago[python] [tests] Fix test_linkage for unique external linkage
Michal Gorny [Sat, 11 Nov 2017 20:01:41 +0000 (20:01 +0000)]
[python] [tests] Fix test_linkage for unique external linkage

Starting with r314037, anonymous namespaces no longer give
unique-external linkage to variables. However, this linkage can still be
achieved by using a type which is not exterally visible,
e.g. through being declared in an anonymous namespace but used outside
it. Fix the test to take advantage of that.

Differential Revision: https://reviews.llvm.org/D39810

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

6 years agoAdjust r316292 - remove the anonymous union for sharing a bitfield in FunctionDecl.
Faisal Vali [Sat, 11 Nov 2017 18:02:29 +0000 (18:02 +0000)]
Adjust r316292 - remove the anonymous union for sharing a bitfield in FunctionDecl.

The anonymous union did NOT save us storage, but instead behaved as if we added an additional integer data member to FunctionDecl.

For additional context, the anonymous union renders the bit fields as non-adjacent and prevents them from sharing the same 'memory location' (i.e. bit-storage) by requiring the anonymous union object to be appropriately aligned.

This was confirmed through discussion with Richard Smith in Albuquerque (ISO C++ Meeting)

https://reviews.llvm.org/rL316292

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

6 years ago[cxx_status] Add resolution of CWG issue 1581, since it's an important, visible change.
Richard Smith [Sat, 11 Nov 2017 18:00:16 +0000 (18:00 +0000)]
[cxx_status] Add resolution of CWG issue 1581, since it's an important, visible change.

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

6 years ago[cxx_status] Update for moved Albuquerque papers.
Richard Smith [Sat, 11 Nov 2017 17:54:46 +0000 (17:54 +0000)]
[cxx_status] Update for moved Albuquerque papers.

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

6 years ago[coroutines] Promote cleanup.dest.slot allocas to registers to avoid storing it in...
Gor Nishanov [Sat, 11 Nov 2017 17:00:43 +0000 (17:00 +0000)]
[coroutines] Promote cleanup.dest.slot allocas to registers to avoid storing it in the coroutine frame

Summary:
We don't want to store cleanup dest slot saved into the coroutine frame (as some of the cleanup code may
access them after coroutine frame destroyed).

This is an alternative to https://reviews.llvm.org/D37093

It is possible to do this for all functions, but, cursory check showed that in -O0, we get slightly longer function (by 1-3 instructions), thus, we are only limiting cleanup.dest.slot elimination to coroutines.

Reviewers: rjmccall, hfinkel, eric_niebler

Reviewed By: eric_niebler

Subscribers: EricWF, cfe-commits

Differential Revision: https://reviews.llvm.org/D39768

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

6 years ago[CUDA] Fix std::min on device side to return the min, not the max.
Justin Lebar [Sat, 11 Nov 2017 01:25:44 +0000 (01:25 +0000)]
[CUDA] Fix std::min on device side to return the min, not the max.

Summary:
How embarrassing.

This is tested in the test-suite -- fix to come there in a separate
patch.

Reviewers: tra

Subscribers: sanjoy, cfe-commits

Differential Revision: https://reviews.llvm.org/D39817

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

6 years agoAdd CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission
Jake Ehrlich [Sat, 11 Nov 2017 01:15:41 +0000 (01:15 +0000)]
Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fission

llvm-objcopy is getting to where it can be used in non-trivial ways
(such as for dwarf fission in clang). It now supports dwarf fission but
this feature hasn't been thoroughly tested yet. This change allows
people to optionally build clang to use llvm-objcopy rather than GNU
objcopy. By default GNU objcopy is still used so nothing should change.

Differential Revision: https://reviews.llvm.org/D39029

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

6 years agoRevert "[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang"
Teresa Johnson [Sat, 11 Nov 2017 01:06:41 +0000 (01:06 +0000)]
Revert "[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang"

This reverts commit r317951 and r317952. The new test is aborting on
some bots and I'll need to investigate later.

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

6 years agoHandle lambda captures of variable length arrays in profiling and printing.
Richard Trieu [Sat, 11 Nov 2017 00:54:25 +0000 (00:54 +0000)]
Handle lambda captures of variable length arrays in profiling and printing.

From http://reviews.llvm.org/D4368 these cases were thought to not be reachable
and the checks removed before the rest of the code was committed in r216649.
However, these cases are reachable and the checks are added back.

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

6 years ago[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings;...
Eugene Zelenko [Sat, 11 Nov 2017 00:08:50 +0000 (00:08 +0000)]
[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoAdd x86-registered-target to REQUIRES for new test
Teresa Johnson [Sat, 11 Nov 2017 00:05:39 +0000 (00:05 +0000)]
Add x86-registered-target to REQUIRES for new test

Should fix test added in r317951.

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

6 years ago[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
Teresa Johnson [Fri, 10 Nov 2017 23:37:39 +0000 (23:37 +0000)]
[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang

Summary:
The LTO Config field wasn't being set when invoking a ThinLTO backend
via clang (i.e. for distributed builds).

Reviewers: danielcdh

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

Differential Revision: https://reviews.llvm.org/D39923

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

6 years agoRemove declaration of EmitMCountInstrumentation(). NFC
Hans Wennborg [Fri, 10 Nov 2017 22:34:23 +0000 (22:34 +0000)]
Remove declaration of EmitMCountInstrumentation(). NFC

The definition was removed in r280355.

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

6 years agoFix for skipped CMake configuration on debuginfo-tests.
Zachary Turner [Fri, 10 Nov 2017 22:12:04 +0000 (22:12 +0000)]
Fix for skipped CMake configuration on debuginfo-tests.

This should have been part of the change to debuginfo-tests, but
it was left out.  This should get the buildbots green.

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

6 years ago[debuginfo-tests] Make debuginfo-tests work in a standard configuration.
Zachary Turner [Fri, 10 Nov 2017 20:57:57 +0000 (20:57 +0000)]
[debuginfo-tests] Make debuginfo-tests work in a standard configuration.

Previously, debuginfo-tests was expected to be checked out into
clang/test and then the tests would automatically run as part of
check-clang.  This is not a standard workflow for handling
external projects, and it brings with it some serious drawbacks
such as the inability to depend on things other than clang, which
we will need going forward.

The goal of this patch is to migrate towards a more standard
workflow.  To ease the transition for build bot maintainers,
this patch tries not to break the existing workflow, but instead
simply deprecate it to give maintainers a chance to update
the build infrastructure.

Differential Revision: https://reviews.llvm.org/D39605

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

6 years agoAMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature
Konstantin Zhuravlyov [Fri, 10 Nov 2017 19:28:25 +0000 (19:28 +0000)]
AMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature

Differential Revision: https://reviews.llvm.org/D39878

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

6 years agoAMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain
Konstantin Zhuravlyov [Fri, 10 Nov 2017 19:09:57 +0000 (19:09 +0000)]
AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain

Differential Revision: https://reviews.llvm.org/D39877

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

6 years ago[clang-format] Handle leading comments in using declaration
Daniel Jasper [Fri, 10 Nov 2017 17:11:18 +0000 (17:11 +0000)]
[clang-format] Handle leading comments in using declaration

This fixes clang-format internal assertion for the following code:

  /* override */ using std::string;

Patch by Igor Sugak. Thank you.

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

6 years ago[NFC] Pacify bbot for OpenMP 'teams distribute parallel for'
Carlo Bertolli [Fri, 10 Nov 2017 16:49:09 +0000 (16:49 +0000)]
[NFC] Pacify bbot for OpenMP 'teams distribute parallel for'

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

6 years ago[python] [tests] Rewrite to use standard unittest module
Michal Gorny [Fri, 10 Nov 2017 16:44:12 +0000 (16:44 +0000)]
[python] [tests] Rewrite to use standard unittest module

Rewrite the tests from using plain 'assert' mixed with some nosetests
methods to the standard unittest module layout. Improve the code
to use the most canonical assertion methods whenever possible.

This has a few major advantages:

- the code uses standard methods now, resulting in a reduced number
of WTFs whenever someone with basic Python knowledge gets to read it,

- completely unnecessary dependency on nosetests is removed since
the standard library supplies all that is necessary for the tests
to run,

- the tests can be run via any test runner, including the one built-in
in Python,

- the failure output for most of the tests is improved from 'assertion
x == y failed' to actually telling the values.

Differential Revision: https://reviews.llvm.org/D39763

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

6 years ago[OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'
Carlo Bertolli [Fri, 10 Nov 2017 16:05:00 +0000 (16:05 +0000)]
[OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'

https://reviews.llvm.org/D39902

Simply leverage existing implementation and verify correct functioning with two regression tests.

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

6 years ago[OpenMP] diagnose assign to firstprivate const, patch by Joel E. Denny
Alexey Bataev [Fri, 10 Nov 2017 15:39:50 +0000 (15:39 +0000)]
[OpenMP] diagnose assign to firstprivate const, patch by Joel E. Denny

Summary:
[OpenMP] diagnose assign to firstprivate const

Clang does not diagnose assignments to const variables declared
firstprivate.  Furthermore, codegen is broken such that, at run time,
such assignments simply have no effect.  For example, the following
prints 0 not 1:

int main() {
  const int i = 0;
  #pragma omp parallel firstprivate(i)
  { i=1; printf("%d\n", i); }
  return 0;
}

This commit makes these assignments a compile error, which is
consistent with other OpenMP compilers I've tried (pgcc 17.4-0, gcc
6.3.0).

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D39859

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

6 years ago[clang-format] Support python-style comments in text protos
Krasimir Georgiev [Fri, 10 Nov 2017 12:50:09 +0000 (12:50 +0000)]
[clang-format] Support python-style comments in text protos

Summary: This patch adds support for python-style comments in text protos.

Reviewers: djasper

Reviewed By: djasper

Subscribers: bkramer, cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D39806

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

6 years agoRevert "[XRay][darwin] Initial XRay in Darwin Support"
Dean Michael Berris [Fri, 10 Nov 2017 07:00:55 +0000 (07:00 +0000)]
Revert "[XRay][darwin] Initial XRay in Darwin Support"

This reverts r317875.

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

6 years ago[XRay][darwin] Initial XRay in Darwin Support
Dean Michael Berris [Fri, 10 Nov 2017 05:50:13 +0000 (05:50 +0000)]
[XRay][darwin] Initial XRay in Darwin Support

Summary:
This change implements the changes required in both clang and
compiler-rt to allow building XRay-instrumented binaries in Darwin. For
now we limit this to x86_64. We also start building the XRay runtime
library in compiler-rt for osx.

A caveat to this is that we don't have the tests set up and running
yet, which we'll do in a set of follow-on changes.

This patch uses the monorepo layout for the coordinated change across
multiple projects.

Reviewers: kubamracek

Subscribers: mgorny, cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D39114

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

6 years ago[X86] Reduce the number of FMA builtins needed by the frontend by adding negates...
Craig Topper [Fri, 10 Nov 2017 05:20:32 +0000 (05:20 +0000)]
[X86] Reduce the number of FMA builtins needed by the frontend by adding negates to operands of the fmadd and fmaddsub builtins.

The backend should be able to combine the negates to create fmsub, fnmadd, and fnmsub. faddsub converting to fsubadd still needs work I think, but should be very doable.

This matches what we already do for the masked builtins.

This only covers the packed builtins. Scalar builtins will be done after FMA4 is fixed.

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

6 years ago[Driver] Make clang/cc conforms to UNIX standard
Steven Wu [Fri, 10 Nov 2017 01:32:47 +0000 (01:32 +0000)]
[Driver] Make clang/cc conforms to UNIX standard

Summary:
This is basically reverting r261774 with a tweak for clang-cl. UNIX
standard states:
When c99 encounters a compilation error that causes an object file not
to be created, it shall write a diagnostic to standard error and
continue to compile other source code operands, but it shall not perform
the link phase and it shall return a non-zero exit status

The same goes for c89 or cc. And they are all alias or shims pointing to
clang on Darwin.

The original commit was intended for CUDA so the error message doesn't
get emit twice for both host and device. It seems that the clang driver
has been changed to model the CUDA dependency differently. Now the
driver behaves the same without this commit.

rdar://problem/32223263

Reviewers: thakis, dexonsmith, tra

Reviewed By: tra

Subscribers: jlebar, cfe-commits

Differential Revision: https://reviews.llvm.org/D39502

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

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 10 Nov 2017 00:59:22 +0000 (00:59 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[analyzer] [NFC] Minor ExprEngineC refactoring
George Karpenkov [Thu, 9 Nov 2017 23:33:37 +0000 (23:33 +0000)]
[analyzer] [NFC] Minor ExprEngineC refactoring

Move a repeated block of code into a function.

Differential Revision: https://reviews.llvm.org/D39584

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

6 years ago[analyzer] do not crash when trying to convert an APSInt to an unexpected type
George Karpenkov [Thu, 9 Nov 2017 21:49:38 +0000 (21:49 +0000)]
[analyzer] do not crash when trying to convert an APSInt to an unexpected type

This is the issue breaking the postgresql bot, purely by chance exposed
through taint checker, somehow appearing after
https://reviews.llvm.org/D38358 got committed.

The backstory is that the taint checker requests SVal for the value of
the pointer, and analyzer has a "fast path" in the getter to return a
constant when we know that the value is constant.
Unfortunately, the getter requires a cast to get signedness correctly,
and for the pointer `void *` the cast crashes.

This is more of a band-aid patch, as I am not sure what could be done
here "correctly", but it should be applied in any case to avoid the
crash.

Differential Revision: https://reviews.llvm.org/D39862

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

6 years ago[index] tag declarations should use the decl role instead of ref
Alex Lorenz [Thu, 9 Nov 2017 20:50:59 +0000 (20:50 +0000)]
[index] tag declarations should use the decl role instead of ref

The 'decl' role is more canonical than the 'ref'. This helps us establish the
'specialization-of' relation just by looking at decls or defs.

rdar://31884960

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

6 years ago[python] [tests] Update priority values in code completion test
Michal Gorny [Thu, 9 Nov 2017 20:17:41 +0000 (20:17 +0000)]
[python] [tests] Update priority values in code completion test

The priority for destructors and operators was reduced in r314019.
Adjust the values used in the test appropriately to fix the test
failure.

Differential Revision: https://reviews.llvm.org/D39838

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

6 years ago[analyzer] assume bitwise arithmetic axioms
George Karpenkov [Thu, 9 Nov 2017 19:06:22 +0000 (19:06 +0000)]
[analyzer] assume bitwise arithmetic axioms

Patches the solver to assume that bitwise OR of an unsigned value with a
constant always produces a value larger-or-equal than the constant, and
bitwise AND with a constant always produces a value less-or-equal than
the constant.

This patch is especially useful in the context of using bitwise
arithmetic for error code encoding: the analyzer would be able to state
that the error code produced using a bitwise OR is non-zero.

Differential Revision: https://reviews.llvm.org/D39707

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

6 years ago[OPENMP] Codegen for `#pragma omp target parallel for simd`.
Alexey Bataev [Thu, 9 Nov 2017 17:32:15 +0000 (17:32 +0000)]
[OPENMP] Codegen for `#pragma omp target parallel for simd`.

Added codegen for `#pragma omp target parallel for simd` and clauses.

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

6 years ago[OPENMP] Treat '#pragma omp target parallel for simd' as simd directive.
Alexey Bataev [Thu, 9 Nov 2017 17:01:35 +0000 (17:01 +0000)]
[OPENMP] Treat '#pragma omp target parallel for simd' as simd directive.

`#pragma omp target parallel for simd` mistakenly was not treated as a
simd directive, fixed this problem.

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