Skip to content

Commit

Permalink
Merge branch 'main' into dev/AffineCrashFixNew
Browse files Browse the repository at this point in the history
  • Loading branch information
DarshanRamakant committed Aug 11, 2024
2 parents e19ce80 + f070f61 commit 695b04f
Show file tree
Hide file tree
Showing 423 changed files with 9,546 additions and 25,169 deletions.
7 changes: 7 additions & 0 deletions .github/new-prs-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,13 @@ clang:openmp:
- llvm/unittests/Frontend/OpenMP*
- llvm/test/Transforms/OpenMP/**

clang:as-a-library:
- clang/tools/libclang/**
- clang/bindings/**
- clang/include/clang-c/**
- clang/test/LibClang/**
- clang/unittest/libclang/**

openmp:libomp:
- any: ['openmp/**', '!openmp/libomptarget/**']

Expand Down
40 changes: 40 additions & 0 deletions clang/docs/ClangFormatStyleOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3300,6 +3300,46 @@ the configuration (without a prefix: ``Auto``).
firstValue :
SecondValueVeryVeryVeryVeryLong;

.. _BreakBinaryOperations:

**BreakBinaryOperations** (``BreakBinaryOperationsStyle``) :versionbadge:`clang-format 20` :ref:`<BreakBinaryOperations>`
The break constructor initializers style to use.

Possible values:

* ``BBO_Never`` (in configuration: ``Never``)
Don't break binary operations

.. code-block:: c++

aaa + bbbb * ccccc - ddddd +
eeeeeeeeeeeeeeee;

* ``BBO_OnePerLine`` (in configuration: ``OnePerLine``)
Binary operations will either be all on the same line, or each operation
will have one line each.

.. code-block:: c++

aaa +
bbbb *
ccccc -
ddddd +
eeeeeeeeeeeeeeee;

* ``BBO_RespectPrecedence`` (in configuration: ``RespectPrecedence``)
Binary operations of a particular precedence that exceed the column
limit will have one line each.

.. code-block:: c++

aaa +
bbbb * ccccc -
ddddd +
eeeeeeeeeeeeeeee;



.. _BreakConstructorInitializers:

**BreakConstructorInitializers** (``BreakConstructorInitializersStyle``) :versionbadge:`clang-format 5` :ref:`<BreakConstructorInitializers>`
Expand Down
3 changes: 2 additions & 1 deletion clang/docs/OpenMPSupport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ considered for standardization. Please post on the
| device extension | `'ompx_bare' clause on 'target teams' construct | :good:`prototyped` | #66844, #70612 |
| | <https://www.osti.gov/servlets/purl/2205717>`_ | | |
+------------------------------+-----------------------------------------------------------------------------------+--------------------------+--------------------------------------------------------+
| device extension | Multi-dim 'num_teams' clause on 'target teams ompx_bare' construct | :good:`partial` | #99732, #101407 |
| device extension | Multi-dim 'num_teams' and 'thread_limit' clause on 'target teams ompx_bare' | :good:`partial` | #99732, #101407, #102715 |
| | construct | | |
+------------------------------+-----------------------------------------------------------------------------------+--------------------------+--------------------------------------------------------+

.. _Discourse forums (Runtimes - OpenMP category): https://discourse.llvm.org/c/runtimes/openmp/35
14 changes: 9 additions & 5 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ Clang Frontend Potentially Breaking Changes
Clang Python Bindings Potentially Breaking Changes
--------------------------------------------------
- Parts of the interface returning string results will now return
the empty string `""` when no result is available, instead of `None`.
- Calling a property on the `CompletionChunk` or `CompletionString` class
statically now leads to an error, instead of returning a `CachedProperty` object
the empty string ``""`` when no result is available, instead of ``None``.
- Calling a property on the ``CompletionChunk`` or ``CompletionString`` class
statically now leads to an error, instead of returning a ``CachedProperty`` object
that is used internally. Properties are only available on instances.

What's New in Clang |release|?
Expand Down Expand Up @@ -202,6 +202,7 @@ Bug Fixes to C++ Support
^^^^^^^^^^^^^^^^^^^^^^^^

- Fixed a crash when an expression with a dependent ``__typeof__`` type is used as the operand of a unary operator. (#GH97646)
- Fixed incorrect pack expansion of init-capture references in requires expresssions.
- Fixed a failed assertion when checking invalid delete operator declaration. (#GH96191)
- Fix a crash when checking destructor reference with an invalid initializer. (#GH97230)
- Clang now correctly parses potentially declarative nested-name-specifiers in pointer-to-member declarators.
Expand Down Expand Up @@ -315,6 +316,8 @@ AST Matchers
clang-format
------------

- Adds ``BreakBinaryOperations`` option.

libclang
--------

Expand Down Expand Up @@ -359,8 +362,9 @@ Improvements
^^^^^^^^^^^^
- Improve the handling of mapping array-section for struct containing nested structs with user defined mappers

- `num_teams` now accepts multiple expressions when it is used along in ``target teams ompx_bare`` construct.
This allows the target region to be launched with multi-dim grid on GPUs.
- `num_teams` and `thead_limit` now accept multiple expressions when it is used
along in ``target teams ompx_bare`` construct. This allows the target region
to be launched with multi-dim grid on GPUs.

Additional Information
======================
Expand Down
81 changes: 49 additions & 32 deletions clang/include/clang/AST/OpenMPClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -6462,61 +6462,78 @@ class OMPNumTeamsClause final
/// \endcode
/// In this example directive '#pragma omp teams' has clause 'thread_limit'
/// with single expression 'n'.
class OMPThreadLimitClause : public OMPClause, public OMPClauseWithPreInit {
friend class OMPClauseReader;
///
/// When 'ompx_bare' clause exists on a 'target' directive, 'thread_limit'
/// clause can accept up to three expressions.
///
/// \code
/// #pragma omp target teams ompx_bare thread_limit(x, y, z)
/// \endcode
class OMPThreadLimitClause final
: public OMPVarListClause<OMPThreadLimitClause>,
public OMPClauseWithPreInit,
private llvm::TrailingObjects<OMPThreadLimitClause, Expr *> {
friend OMPVarListClause;
friend TrailingObjects;

/// Location of '('.
SourceLocation LParenLoc;

/// ThreadLimit number.
Stmt *ThreadLimit = nullptr;
OMPThreadLimitClause(const ASTContext &C, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation EndLoc,
unsigned N)
: OMPVarListClause(llvm::omp::OMPC_thread_limit, StartLoc, LParenLoc,
EndLoc, N),
OMPClauseWithPreInit(this) {}

/// Set the ThreadLimit number.
///
/// \param E ThreadLimit number.
void setThreadLimit(Expr *E) { ThreadLimit = E; }
/// Build an empty clause.
OMPThreadLimitClause(unsigned N)
: OMPVarListClause(llvm::omp::OMPC_thread_limit, SourceLocation(),
SourceLocation(), SourceLocation(), N),
OMPClauseWithPreInit(this) {}

public:
/// Build 'thread_limit' clause.
/// Creates clause with a list of variables \a VL.
///
/// \param E Expression associated with this clause.
/// \param HelperE Helper Expression associated with this clause.
/// \param CaptureRegion Innermost OpenMP region where expressions in this
/// clause must be captured.
/// \param C AST context.
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
OMPThreadLimitClause(Expr *E, Stmt *HelperE,
OpenMPDirectiveKind CaptureRegion,
SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc)
: OMPClause(llvm::omp::OMPC_thread_limit, StartLoc, EndLoc),
OMPClauseWithPreInit(this), LParenLoc(LParenLoc), ThreadLimit(E) {
setPreInitStmt(HelperE, CaptureRegion);
}
/// \param VL List of references to the variables.
/// \param PreInit
static OMPThreadLimitClause *
Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion,
SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc, ArrayRef<Expr *> VL, Stmt *PreInit);

/// Build an empty clause.
OMPThreadLimitClause()
: OMPClause(llvm::omp::OMPC_thread_limit, SourceLocation(),
SourceLocation()),
OMPClauseWithPreInit(this) {}
/// Creates an empty clause with \a N variables.
///
/// \param C AST context.
/// \param N The number of variables.
static OMPThreadLimitClause *CreateEmpty(const ASTContext &C, unsigned N);

/// Sets the location of '('.
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }

/// Returns the location of '('.
SourceLocation getLParenLoc() const { return LParenLoc; }

/// Return ThreadLimit number.
Expr *getThreadLimit() { return cast<Expr>(ThreadLimit); }
/// Return ThreadLimit expressions.
ArrayRef<Expr *> getThreadLimit() { return getVarRefs(); }

/// Return ThreadLimit number.
Expr *getThreadLimit() const { return cast<Expr>(ThreadLimit); }
/// Return ThreadLimit expressions.
ArrayRef<Expr *> getThreadLimit() const {
return const_cast<OMPThreadLimitClause *>(this)->getThreadLimit();
}

child_range children() { return child_range(&ThreadLimit, &ThreadLimit + 1); }
child_range children() {
return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
reinterpret_cast<Stmt **>(varlist_end()));
}

const_child_range children() const {
return const_child_range(&ThreadLimit, &ThreadLimit + 1);
auto Children = const_cast<OMPThreadLimitClause *>(this)->children();
return const_child_range(Children.begin(), Children.end());
}

child_range used_children() {
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/RecursiveASTVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3836,8 +3836,8 @@ bool RecursiveASTVisitor<Derived>::VisitOMPNumTeamsClause(
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPThreadLimitClause(
OMPThreadLimitClause *C) {
TRY_TO(VisitOMPClauseList(C));
TRY_TO(VisitOMPClauseWithPreInit(C));
TRY_TO(TraverseStmt(C->getThreadLimit()));
return true;
}

Expand Down
6 changes: 4 additions & 2 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ def warn_drv_amdgpu_cov6: Warning<
"code object v6 is still in development and not ready for production use yet;"
" use at your own risk">;
def err_drv_undetermined_gpu_arch : Error<
"cannot determine %0 architecture: %1; consider passing it via "
"'%2'">;
"cannot determine %0 architecture: %1; consider passing it via '%2'; "
"environment variable CLANG_TOOLCHAIN_PROGRAM_TIMEOUT specifies the tool "
"timeout (integer secs, <=0 is infinite)">;

def warn_drv_multi_gpu_arch : Warning<
"multiple %0 architectures are detected: %1; only the first one is used for "
"'%2'">, InGroup<MultiGPU>;
Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/Basic/PointerAuthOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ class PointerAuthSchema {
};

struct PointerAuthOptions {
/// Should return addresses be authenticated?
bool ReturnAddresses = false;

/// Do authentication failures cause a trap?
bool AuthTraps = false;

/// Do indirect goto label addresses need to be authenticated?
bool IndirectGotos = false;

Expand Down
3 changes: 1 addition & 2 deletions clang/include/clang/Driver/ToolChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ class ToolChain {

/// Executes the given \p Executable and returns the stdout.
llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
executeToolChainProgram(StringRef Executable,
unsigned SecondsToWait = 0) const;
executeToolChainProgram(StringRef Executable) const;

void setTripleEnvironment(llvm::Triple::EnvironmentType Env);

Expand Down
36 changes: 36 additions & 0 deletions clang/include/clang/Format/Format.h
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,41 @@ struct FormatStyle {
/// \version 3.7
bool BreakBeforeTernaryOperators;

/// Different ways to break binary operations.
enum BreakBinaryOperationsStyle : int8_t {
/// Don't break binary operations
/// \code
/// aaa + bbbb * ccccc - ddddd +
/// eeeeeeeeeeeeeeee;
/// \endcode
BBO_Never,

/// Binary operations will either be all on the same line, or each operation
/// will have one line each.
/// \code
/// aaa +
/// bbbb *
/// ccccc -
/// ddddd +
/// eeeeeeeeeeeeeeee;
/// \endcode
BBO_OnePerLine,

/// Binary operations of a particular precedence that exceed the column
/// limit will have one line each.
/// \code
/// aaa +
/// bbbb * ccccc -
/// ddddd +
/// eeeeeeeeeeeeeeee;
/// \endcode
BBO_RespectPrecedence
};

/// The break constructor initializers style to use.
/// \version 20
BreakBinaryOperationsStyle BreakBinaryOperations;

/// Different ways to break initializers.
enum BreakConstructorInitializersStyle : int8_t {
/// Break constructor initializers before the colon and after the commas.
Expand Down Expand Up @@ -5037,6 +5072,7 @@ struct FormatStyle {
BreakBeforeConceptDeclarations == R.BreakBeforeConceptDeclarations &&
BreakBeforeInlineASMColon == R.BreakBeforeInlineASMColon &&
BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators &&
BreakBinaryOperations == R.BreakBinaryOperations &&
BreakConstructorInitializers == R.BreakConstructorInitializers &&
BreakFunctionDefinitionParameters ==
R.BreakFunctionDefinitionParameters &&
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -14186,6 +14186,10 @@ class Sema final : public SemaBase {
std::optional<unsigned> getNumArgumentsInExpansion(
QualType T, const MultiLevelTemplateArgumentList &TemplateArgs);

std::optional<unsigned> getNumArgumentsInExpansionFromUnexpanded(
llvm::ArrayRef<UnexpandedParameterPack> Unexpanded,
const MultiLevelTemplateArgumentList &TemplateArgs);

/// Determine whether the given declarator contains any unexpanded
/// parameter packs.
///
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Sema/SemaOpenMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ class SemaOpenMP : public SemaBase {
SourceLocation LParenLoc,
SourceLocation EndLoc);
/// Called on well-formed 'thread_limit' clause.
OMPClause *ActOnOpenMPThreadLimitClause(Expr *ThreadLimit,
OMPClause *ActOnOpenMPThreadLimitClause(ArrayRef<Expr *> VarList,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc);
Expand Down
11 changes: 8 additions & 3 deletions clang/lib/AST/DeclBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,15 +1177,20 @@ int64_t Decl::getID() const {

const FunctionType *Decl::getFunctionType(bool BlocksToo) const {
QualType Ty;
if (isa<BindingDecl>(this))
return nullptr;
else if (const auto *D = dyn_cast<ValueDecl>(this))
if (const auto *D = dyn_cast<ValueDecl>(this))
Ty = D->getType();
else if (const auto *D = dyn_cast<TypedefNameDecl>(this))
Ty = D->getUnderlyingType();
else
return nullptr;

if (Ty.isNull()) {
// BindingDecls do not have types during parsing, so return nullptr. This is
// the only known case where `Ty` is null.
assert(isa<BindingDecl>(this));
return nullptr;
}

if (Ty->isFunctionPointerType())
Ty = Ty->castAs<PointerType>()->getPointeeType();
else if (Ty->isFunctionReferenceType())
Expand Down
Loading

0 comments on commit 695b04f

Please sign in to comment.