Skip to content

Commit

Permalink
SWDEV-179954 - OpenCL/LC - Merge branch amd-master into amd-common
Browse files Browse the repository at this point in the history
Change-Id: I0ee933644ceaf90580a5be734299adb993daaa48
  • Loading branch information
Jenkins committed Oct 3, 2019
2 parents 45fa31a + c8297e1 commit a09d37e
Show file tree
Hide file tree
Showing 95 changed files with 1,575 additions and 447 deletions.
52 changes: 37 additions & 15 deletions docs/ClangFormatStyleOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -778,24 +778,46 @@ the configuration (without a prefix: ``Auto``).
class foo
{};

* ``bool AfterControlStatement`` Wrap control statements (``if``/``for``/``while``/``switch``/..).
* ``BraceWrappingAfterControlStatementStyle AfterControlStatement``
Wrap control statements (``if``/``for``/``while``/``switch``/..).

.. code-block:: c++
Possible values:

true:
if (foo())
{
} else
{}
for (int i = 0; i < 10; ++i)
{}
* ``BWACS_Never`` (in configuration: ``Never``)
Never wrap braces after a control statement.

false:
if (foo()) {
} else {
}
for (int i = 0; i < 10; ++i) {
}
.. code-block:: c++

if (foo()) {
} else {
}
for (int i = 0; i < 10; ++i) {
}

* ``BWACS_MultiLine`` (in configuration: ``MultiLine``)
Only wrap braces after a multi-line control statement.

.. code-block:: c++

if (foo && bar &&
baz)
{
quux();
}
while (foo || bar) {
}

* ``BWACS_Always`` (in configuration: ``Always``)
Always wrap braces after a control statement.

.. code-block:: c++

if (foo())
{
} else
{}
for (int i = 0; i < 10; ++i)
{}

* ``bool AfterEnum`` Wrap enum definitions.

Expand Down
5 changes: 5 additions & 0 deletions include/clang/AST/CharUnits.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define LLVM_CLANG_AST_CHARUNITS_H

#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/MathExtras.h"

Expand Down Expand Up @@ -177,6 +178,10 @@ namespace clang {
/// getQuantity - Get the raw integer representation of this quantity.
QuantityType getQuantity() const { return Quantity; }

/// getAsAlign - Returns Quantity as a valid llvm::Align,
/// Beware llvm::Align assumes power of two 8-bit bytes.
llvm::Align getAsAlign() const { return llvm::Align(Quantity); }

/// alignTo - Returns the next integer (mod 2**64) that is
/// greater than or equal to this quantity and is a multiple of \p Align.
/// Align must be non-zero.
Expand Down
8 changes: 4 additions & 4 deletions include/clang/AST/ExternalASTMerger.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace clang {
/// ExternalASTSource implementation that merges information from several
/// ASTContexts.
///
/// ExtermalASTMerger maintains a vector of ASTImporters that it uses to import
/// ExternalASTMerger maintains a vector of ASTImporters that it uses to import
/// (potentially incomplete) Decls and DeclContexts from the source ASTContexts
/// in response to ExternalASTSource API calls.
///
Expand All @@ -37,7 +37,7 @@ namespace clang {
/// lookup. In this case, Origins contains an entry overriding lookup and
/// specifying the correct pair of DeclContext/ASTContext.
///
/// - The DeclContext of origin was determined by another ExterenalASTMerger.
/// - The DeclContext of origin was determined by another ExternalASTMerger.
/// (This is possible when the source ASTContext for one of the Importers has
/// its own ExternalASTMerger). The origin must be properly forwarded in this
/// case.
Expand Down Expand Up @@ -94,7 +94,7 @@ class ExternalASTMerger : public ExternalASTSource {
};

private:
/// The target for this ExtenralASTMerger.
/// The target for this ExternalASTMerger.
ImporterTarget Target;
/// ExternalASTMerger has multiple ASTImporters that import into the same
/// TU. This is the shared state for all ASTImporters of this
Expand Down Expand Up @@ -158,7 +158,7 @@ class ExternalASTMerger : public ExternalASTSource {
/// OriginContext.
bool HasImporterForOrigin(ASTContext &OriginContext);

/// Returns a reference to the ASTRImporter from Importers whose origin
/// Returns a reference to the ASTImporter from Importers whose origin
/// is OriginContext. This allows manual import of ASTs while preserving the
/// OriginMap correctly.
ASTImporter &ImporterForOrigin(ASTContext &OriginContext);
Expand Down
15 changes: 15 additions & 0 deletions include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -3290,12 +3290,19 @@ def OMPDeclareVariant : InheritableAttr {
let Documentation = [OMPDeclareVariantDocs];
let Args = [
ExprArgument<"VariantFuncRef">,
ExprArgument<"Score">,
EnumArgument<"CtxSelectorSet", "CtxSelectorSetType",
[ "", "implementation"
],
[
"CtxSetUnknown", "CtxSetImplementation"
]>,
EnumArgument<"CtxScore", "ScoreType",
[ "", "score"
],
[
"ScoreUnknown", "ScoreSpecified"
]>,
EnumArgument<"CtxSelector", "CtxSelectorType",
[ "", "vendor"
],
Expand All @@ -3305,6 +3312,13 @@ def OMPDeclareVariant : InheritableAttr {
StringArgument<"ImplVendor", 1>
];
let AdditionalMembers = [{
void printScore(raw_ostream & OS, const PrintingPolicy &Policy) const {
if (const Expr *E = getScore()) {
OS << "score(";
E->printPretty(OS, nullptr, Policy);
OS << "):";
}
}
void printPrettyPragma(raw_ostream & OS, const PrintingPolicy &Policy)
const {
assert(getCtxSelectorSet() != CtxSetUnknown &&
Expand All @@ -3322,6 +3336,7 @@ def OMPDeclareVariant : InheritableAttr {
switch (getCtxSelector()) {
case CtxVendor:
OS << "vendor(";
printScore(OS, Policy);
OS << getImplVendor();
OS << ")";
break;
Expand Down
59 changes: 42 additions & 17 deletions include/clang/Basic/DiagnosticASTKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def note_constexpr_pure_virtual_call : Note<
"pure virtual function %q0 called">;
def note_constexpr_polymorphic_unknown_dynamic_type : Note<
"%select{|||||virtual function called on|dynamic_cast applied to|"
"typeid applied to|destruction of}0 object '%1' whose dynamic type "
"is not constant">;
"typeid applied to|construction of|destruction of}0 object '%1' "
"whose dynamic type is not constant">;
def note_constexpr_dynamic_cast_to_reference_failed : Note<
"reference dynamic_cast failed: %select{"
"static type %1 of operand is a non-public base class of dynamic type %2|"
Expand Down Expand Up @@ -121,11 +121,12 @@ def note_constexpr_this : Note<
"evaluation of a call to a 'constexpr' member function">;
def note_constexpr_lifetime_ended : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 "
"%select{temporary|variable}1 whose lifetime has ended">;
"member call on|dynamic_cast of|typeid applied to|construction of|"
"destruction of}0 %select{temporary|variable}1 whose "
"%plural{8:storage duration|:lifetime}0 has ended">;
def note_constexpr_access_uninit : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 "
"member call on|dynamic_cast of|typeid applied to|<ERRPR>|destruction of}0 "
"%select{object outside its lifetime|uninitialized object}1 "
"is not allowed in a constant expression">;
def note_constexpr_use_uninit_reference : Note<
Expand All @@ -136,18 +137,19 @@ def note_constexpr_modify_const_type : Note<
"in a constant expression">;
def note_constexpr_access_volatile_type : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"<ERROR>|<ERROR>|<ERROR>}0 "
"<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
"volatile-qualified type %1 is not allowed in a constant expression">;
def note_constexpr_access_volatile_obj : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"<ERROR>|<ERROR>|<ERROR>}0 "
"<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
"volatile %select{temporary|object %2|member %2}1 is not allowed in "
"a constant expression">;
def note_constexpr_volatile_here : Note<
"volatile %select{temporary created|object declared|member declared}0 here">;
def note_constexpr_access_mutable : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 "
"member call on|dynamic_cast of|typeid applied to|construction of|"
"destruction of}0 "
"mutable member %1 is not allowed in a constant expression">;
def note_constexpr_ltor_non_const_int : Note<
"read of non-const variable %0 is not allowed in a constant expression">;
Expand All @@ -157,35 +159,42 @@ def note_constexpr_ltor_incomplete_type : Note<
"read of incomplete type %0 is not allowed in a constant expression">;
def note_constexpr_access_null : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 "
"member call on|dynamic_cast of|typeid applied to|construction of|"
"destruction of}0 "
"dereferenced null pointer is not allowed in a constant expression">;
def note_constexpr_access_past_end : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 "
"member call on|dynamic_cast of|typeid applied to|construction of|"
"destruction of}0 "
"dereferenced one-past-the-end pointer is not allowed "
"in a constant expression">;
def note_constexpr_access_unsized_array : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 "
"member call on|dynamic_cast of|typeid applied to|construction of|"
"destruction of}0 "
"element of array without known bound "
"is not allowed in a constant expression">;
def note_constexpr_access_inactive_union_member : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 "
"member call on|dynamic_cast of|typeid applied to|"
"construction of subobject of|destruction of}0 "
"member %1 of union with %select{active member %3|no active member}2 "
"is not allowed in a constant expression">;
def note_constexpr_access_static_temporary : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 temporary "
"member call on|dynamic_cast of|typeid applied to|reconstruction of|"
"destruction of}0 temporary "
"is not allowed in a constant expression outside the expression that "
"created the temporary">;
def note_constexpr_access_unreadable_object : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 "
"member call on|dynamic_cast of|typeid applied to|construction of|"
"destruction of}0 "
"object '%1' whose value is not known">;
def note_constexpr_access_deleted_object : Note<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|destruction of}0 "
"member call on|dynamic_cast of|typeid applied to|construction of|"
"destruction of}0 "
"heap allocated object that has been deleted">;
def note_constexpr_modify_global : Note<
"a constant expression cannot modify an object that is visible outside "
Expand Down Expand Up @@ -255,6 +264,9 @@ def note_constexpr_bit_cast_indet_dest : Note<
def note_constexpr_pseudo_destructor : Note<
"pseudo-destructor call is not permitted in constant expressions "
"until C++20">;
def note_constexpr_construct_complex_elem : Note<
"construction of individual component of complex number is not yet supported "
"in constant expressions">;
def note_constexpr_destroy_complex_elem : Note<
"destruction of individual component of complex number is not yet supported "
"in constant expressions">;
Expand All @@ -265,22 +277,35 @@ def note_constexpr_new_non_replaceable : Note<
"call to %select{placement|class-specific}0 %1">;
def note_constexpr_new_placement : Note<
"this placement new expression is not yet supported in constant expressions">;
def note_constexpr_placement_new_wrong_type : Note<
"placement new would change type of storage from %0 to %1">;
def note_constexpr_new_negative : Note<
"cannot allocate array; evaluated array bound %0 is negative">;
def note_constexpr_new_too_large : Note<
"cannot allocate array; evaluated array bound %0 is too large">;
def note_constexpr_new_too_small : Note<
"cannot allocate array; evaluated array bound %0 is too small to hold "
"%1 explicitly initialized elements">;
def note_constexpr_new_untyped : Note<
"cannot allocate untyped memory in a constant expression; "
"use 'std::allocator<T>::allocate' to allocate memory of type 'T'">;
def note_constexpr_new_not_complete_object_type : Note<
"cannot allocate memory of %select{incomplete|function}0 type %1">;
def note_constexpr_operator_new_bad_size : Note<
"allocated size %0 is not a multiple of size %1 of element type %2">;
def note_constexpr_delete_not_heap_alloc : Note<
"delete of pointer '%0' that does not point to a heap-allocated object">;
def note_constexpr_double_delete : Note<
"delete of pointer that has already been deleted">;
def note_constexpr_double_destroy : Note<
"destruction of object that is already being destroyed">;
def note_constexpr_new_delete_mismatch : Note<
"%select{non-|}0array delete used to delete pointer to "
"%select{|non-}0array object of type %1">;
"%plural{2:'delete' used to delete pointer to object "
"allocated with 'std::allocator<...>::allocate'|"
":%select{non-array delete|array delete|'std::allocator<...>::deallocate'}0 "
"used to delete pointer to "
"%select{array object of type %2|non-array object of type %2|"
"object allocated with 'new'}0}1">;
def note_constexpr_delete_subobject : Note<
"delete of pointer%select{ to subobject|}1 '%0' "
"%select{|that does not point to complete object}1">;
Expand Down
5 changes: 5 additions & 0 deletions include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -6211,6 +6211,8 @@ def err_invalid_qualified_function_type : Error<
def err_compound_qualified_function_type : Error<
"%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
"cannot have '%3' qualifier">;
def err_qualified_function_typeid : Error<
"type operand %0 of 'typeid' cannot have '%1' qualifier">;

def err_ref_qualifier_overload : Error<
"cannot overload a member function %select{without a ref-qualifier|with "
Expand Down Expand Up @@ -6635,6 +6637,9 @@ def note_member_declared_here : Note<
"member %0 declared here">;
def note_member_first_declared_here : Note<
"member %0 first declared here">;
def warn_bitwise_negation_bool : Warning<
"bitwise negation of a boolean expression always evaluates to 'true'">,
InGroup<DiagGroup<"bool-operation">>;
def err_decrement_bool : Error<"cannot decrement expression of type bool">;
def warn_increment_bool : Warning<
"incrementing expression of type bool is deprecated and "
Expand Down
52 changes: 35 additions & 17 deletions include/clang/Format/Format.h
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,40 @@ struct FormatStyle {
/// The brace breaking style to use.
BraceBreakingStyle BreakBeforeBraces;

// Different ways to wrap braces after control statements.
enum BraceWrappingAfterControlStatementStyle {
/// Never wrap braces after a control statement.
/// \code
/// if (foo()) {
/// } else {
/// }
/// for (int i = 0; i < 10; ++i) {
/// }
/// \endcode
BWACS_Never,
/// Only wrap braces after a multi-line control statement.
/// \code
/// if (foo && bar &&
/// baz)
/// {
/// quux();
/// }
/// while (foo || bar) {
/// }
/// \endcode
BWACS_MultiLine,
/// Always wrap braces after a control statement.
/// \code
/// if (foo())
/// {
/// } else
/// {}
/// for (int i = 0; i < 10; ++i)
/// {}
/// \endcode
BWACS_Always
};

/// Precise control over the wrapping of braces.
/// \code
/// # Should be declared this way:
Expand Down Expand Up @@ -817,23 +851,7 @@ struct FormatStyle {
/// \endcode
bool AfterClass;
/// Wrap control statements (``if``/``for``/``while``/``switch``/..).
/// \code
/// true:
/// if (foo())
/// {
/// } else
/// {}
/// for (int i = 0; i < 10; ++i)
/// {}
///
/// false:
/// if (foo()) {
/// } else {
/// }
/// for (int i = 0; i < 10; ++i) {
/// }
/// \endcode
bool AfterControlStatement;
BraceWrappingAfterControlStatementStyle AfterControlStatement;
/// Wrap enum definitions.
/// \code
/// true:
Expand Down
Loading

0 comments on commit a09d37e

Please sign in to comment.