Skip to content

Commit

Permalink
Merge branch 'sycl' into private/abatashe/user_docs
Browse files Browse the repository at this point in the history
* sycl: (65 commits)
  [SYCL] Host task implementation (intel#1471)
  [SYCL] Update getting dependencies documentation (intel#1699)
  [SYCL] Fix types and transparent functors recognition in reduction (intel#1709)
  [SYCL][Doc] Get started guide clean-up (intel#1697)
  Add --spirv-fp-contract={on|off|fast} option (intel#509)
  [SYCL][Doc] Fix tbb target path in Get Started Guide. (intel#1695)
  [SYCL] Add support for kernel name types templated using enums. (intel#1675)
  [Driver][SYCL] Make -std=c++17 the default for DPC++ (intel#1662)
  AllocaInst should store Align instead of MaybeAlign.
  [X86] Replace selectScalarSSELoad ComplexPattern with PatFrags to handle the 3 types of loads we currently match.
  Harden IR and bitcode parsers against infinite size types.
  Revert "[nfc] test commit"
  [nfc] test commit
  Expose IRGen API to add the default IR attributes to a function definition.
  The release notes for ObjCBreakBeforeNestedBlockParam was placed between the release note for IndentCaseBlocks and its example code
  [VectorCombine] forward walk through instructions to improve chaining of transforms
  [PhaseOrdering] add vector reduction tests; NFC
  [InstCombine] Clean up alignment handling (NFC)
  [ARM] Patterns for VQSHRN
  [VectorCombine] add reduction-like patterns; NFC
  ...
  • Loading branch information
Alexander Batashev committed May 20, 2020
2 parents 37c6596 + ae3fd5c commit fdf6d93
Show file tree
Hide file tree
Showing 323 changed files with 7,012 additions and 2,650 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ void TransformerClangTidyCheck::check(
}
}

void TransformerClangTidyCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "IncludeStyle", IncludeStyle,
IncludeSorter::getMapping());
}

} // namespace utils
} // namespace tidy
} // namespace clang
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ class TransformerClangTidyCheck : public ClangTidyCheck {
void registerMatchers(ast_matchers::MatchFinder *Finder) final;
void check(const ast_matchers::MatchFinder::MatchResult &Result) final;

/// Derived classes that override this function should call this method from
/// the overridden method.
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;

private:
Optional<transformer::RewriteRule> Rule;
const IncludeSorter::IncludeStyle IncludeStyle;
Expand Down
32 changes: 13 additions & 19 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ Non-comprehensive list of changes in this release
- clang adds support for a set of extended integer types (``_ExtInt(N)``) that
permit non-power of 2 integers, exposing the LLVM integer types. Since a major
motivating use case for these types is to limit 'bit' usage, these types don't
automatically promote to 'int' when operations are done between two ``ExtInt(N)``
types, instead math occurs at the size of the largest ``ExtInt(N)`` type.
automatically promote to 'int' when operations are done between two
``ExtInt(N)`` types, instead math occurs at the size of the largest
``ExtInt(N)`` type.

- Users of UBSan, PGO, and coverage on Windows will now need to add clang's
library resource directory to their library search path. These features all
Expand All @@ -81,17 +82,15 @@ Non-comprehensive list of changes in this release
linker. If the user links the program with the ``clang`` or ``clang-cl``
drivers, the driver will pass this flag for them.


New Compiler Flags
------------------


- -fstack-clash-protection will provide a protection against the stack clash
attack for x86 architecture through automatic probing of each page of
allocated stack.

- -ffp-exception-behavior={ignore,maytrap,strict} allows the user to specify
the floating-point exception behavior. The default setting is ``ignore``.
the floating-point exception behavior. The default setting is ``ignore``.

- -ffp-model={precise,strict,fast} provides the user an umbrella option to
simplify access to the many single purpose floating point options. The default
Expand All @@ -110,11 +109,11 @@ Modified Compiler Flags

- -fno-common has been enabled as the default for all targets. Therefore, C
code that uses tentative definitions as definitions of a variable in multiple
translation units will trigger multiple-definition linker errors. Generally,
this occurs when the use of the ``extern`` keyword is neglected in the declaration
of a variable in a header file. In some cases, no specific translation unit
provides a definition of the variable. The previous behavior can be restored by
specifying ``-fcommon``.
translation units will trigger multiple-definition linker errors. Generally,
this occurs when the use of the ``extern`` keyword is neglected in the
declaration of a variable in a header file. In some cases, no specific
translation unit provides a definition of the variable. The previous
behavior can be restored by specifying ``-fcommon``.
- -Wasm-ignored-qualifier (ex. `asm const ("")`) has been removed and replaced
with an error (this matches a recent change in GCC-9).
- -Wasm-file-asm-volatile (ex. `asm volatile ("")` at global scope) has been
Expand Down Expand Up @@ -176,7 +175,7 @@ C++ Language Changes in Clang
Previous versions of Clang rejected some constructs of this form
(specifically, where the linkage of the type happened to be computed
before the parser reached the typedef name); those cases are still rejected
in Clang 11. In addition, cases that previous versions of Clang did not
in Clang 11. In addition, cases that previous versions of Clang did not
reject now produce an extension warning. This warning can be disabled with
the warning flag ``-Wno-non-c-typedef-for-linkage``.

Expand Down Expand Up @@ -207,7 +206,6 @@ C++1z Feature Support
Objective-C Language Changes in Clang
-------------------------------------


OpenCL C Language Changes in Clang
----------------------------------

Expand All @@ -216,7 +214,6 @@ OpenCL C Language Changes in Clang
ABI Changes in Clang
--------------------


OpenMP Support in Clang
-----------------------

Expand All @@ -234,7 +231,6 @@ These are major API changes that have happened since the 10.0.0 release of
Clang. If upgrading an external codebase that uses Clang as a library,
this section should help get you past the largest hurdles of upgrading.


Build System Changes
--------------------

Expand All @@ -255,15 +251,11 @@ AST Matchers
clang-format
------------


- Option ``IndentCaseBlocks`` has been added to support treating the block
following a switch case label as a scope block which gets indented itself.
It helps avoid having the closing bracket align with the switch statement's
closing bracket (when ``IndentCaseLabels`` is ``false``).

- Option ``ObjCBreakBeforeNestedBlockParam`` has been added to optionally apply
linebreaks for function arguments declarations before nested blocks.

.. code-block:: c++

switch (fool) { vs. switch (fool) {
Expand All @@ -278,6 +270,9 @@ clang-format
}
}

- Option ``ObjCBreakBeforeNestedBlockParam`` has been added to optionally apply
linebreaks for function arguments declarations before nested blocks.

- Option ``InsertTrailingCommas`` can be set to ``TCS_Wrapped`` to insert
trailing commas in container literals (arrays and objects) that wrap across
multiple lines. It is currently only available for JavaScript and disabled by
Expand Down Expand Up @@ -317,7 +312,6 @@ Static Analyzer
Undefined Behavior Sanitizer (UBSan)
------------------------------------


Core Analysis Improvements
==========================

Expand Down
7 changes: 4 additions & 3 deletions clang/include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,16 @@ class NamedDecl : public Decl {
/// Creating this name is expensive, so it should be called only when
/// performance doesn't matter.
void printQualifiedName(raw_ostream &OS) const;
void printQualifiedName(raw_ostream &OS, const PrintingPolicy &Policy) const;
void printQualifiedName(raw_ostream &OS, const PrintingPolicy &Policy,
bool WithGlobalNsPrefix = false) const;

/// Print only the nested name specifier part of a fully-qualified name,
/// including the '::' at the end. E.g.
/// when `printQualifiedName(D)` prints "A::B::i",
/// this function prints "A::B::".
void printNestedNameSpecifier(raw_ostream &OS) const;
void printNestedNameSpecifier(raw_ostream &OS,
const PrintingPolicy &Policy) const;
void printNestedNameSpecifier(raw_ostream &OS, const PrintingPolicy &Policy,
bool WithGlobalNsPrefix = false) const;

// FIXME: Remove string version.
std::string getQualifiedNameAsString() const;
Expand Down
4 changes: 3 additions & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -10789,7 +10789,9 @@ def err_builtin_matrix_disabled: Error<
// SYCL-specific diagnostics
def err_sycl_kernel_incorrectly_named : Error<
"kernel %select{name is missing"
"|needs to have a globally-visible name}0">;
"|needs to have a globally-visible name"
"|name is invalid. Unscoped enum requires fixed underlying type"
"}0">;
def err_sycl_restrict : Error<
"SYCL kernel cannot "
"%select{use a non-const global variable"
Expand Down
20 changes: 20 additions & 0 deletions clang/include/clang/CodeGen/CodeGenABITypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "clang/CodeGen/CGFunctionInfo.h"

namespace llvm {
class AttrBuilder;
class Constant;
class DataLayout;
class Module;
Expand Down Expand Up @@ -86,6 +87,25 @@ llvm::Type *convertTypeForMemory(CodeGenModule &CGM, QualType T);
unsigned getLLVMFieldNumber(CodeGenModule &CGM,
const RecordDecl *RD, const FieldDecl *FD);

/// Given the language and code-generation options that Clang was configured
/// with, set the default LLVM IR attributes for a function definition.
/// The attributes set here are mostly global target-configuration and
/// pipeline-configuration options like the target CPU, variant stack
/// rules, whether to optimize for size, and so on. This is useful for
/// frontends (such as Swift) that generally intend to interoperate with
/// C code and rely on Clang's target configuration logic.
///
/// As a general rule, this function assumes that meaningful attributes
/// haven't already been added to the builder. It won't intentionally
/// displace any existing attributes, but it also won't check to avoid
/// overwriting them. Callers should generally apply customizations after
/// making this call.
///
/// This function assumes that the caller is not defining a function that
/// requires special no-builtin treatment.
void addDefaultFunctionDefinitionAttributes(CodeGenModule &CGM,
llvm::AttrBuilder &attrs);

/// Returns the default constructor for a C struct with non-trivially copyable
/// fields, generating it if necessary. The returned function uses the `cdecl`
/// calling convention, returns void, and takes a single argument that is a
Expand Down
15 changes: 9 additions & 6 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1538,14 +1538,14 @@ void NamedDecl::printQualifiedName(raw_ostream &OS) const {
printQualifiedName(OS, getASTContext().getPrintingPolicy());
}

void NamedDecl::printQualifiedName(raw_ostream &OS,
const PrintingPolicy &P) const {
void NamedDecl::printQualifiedName(raw_ostream &OS, const PrintingPolicy &P,
bool WithGlobalNsPrefix) const {
if (getDeclContext()->isFunctionOrMethod()) {
// We do not print '(anonymous)' for function parameters without name.
printName(OS);
return;
}
printNestedNameSpecifier(OS, P);
printNestedNameSpecifier(OS, P, WithGlobalNsPrefix);
if (getDeclName())
OS << *this;
else {
Expand All @@ -1566,7 +1566,8 @@ void NamedDecl::printNestedNameSpecifier(raw_ostream &OS) const {
}

void NamedDecl::printNestedNameSpecifier(raw_ostream &OS,
const PrintingPolicy &P) const {
const PrintingPolicy &P,
bool WithGlobalNsPrefix) const {
const DeclContext *Ctx = getDeclContext();

// For ObjC methods and properties, look through categories and use the
Expand All @@ -1593,6 +1594,9 @@ void NamedDecl::printNestedNameSpecifier(raw_ostream &OS,
Ctx = Ctx->getParent();
}

if (WithGlobalNsPrefix)
OS << "::";

for (const DeclContext *DC : llvm::reverse(Contexts)) {
if (const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(DC)) {
OS << Spec->getName();
Expand All @@ -1605,8 +1609,7 @@ void NamedDecl::printNestedNameSpecifier(raw_ostream &OS,
if (ND->isAnonymousNamespace()) {
OS << (P.MSVCFormatting ? "`anonymous namespace\'"
: "(anonymous namespace)");
}
else
} else
OS << *ND;
} else if (const auto *RD = dyn_cast<RecordDecl>(DC)) {
if (!RD->getIdentifier())
Expand Down
Loading

0 comments on commit fdf6d93

Please sign in to comment.