Skip to content

Commit

Permalink
Manually merged master:30bb113beb3 into amd-gfx:6aa2f8eadfd
Browse files Browse the repository at this point in the history
Local branch amd-gfx 6aa2f8e Manually merged master:d1a7bfca743 into amd-gfx:8b1c0b36a16
Remote branch master 30bb113 [AMDGPU][NFC] Refactor emitEntryFunctionPrologue

Change-Id: I079e924ef454c719b6558e7171ae1aedda21f304
  • Loading branch information
jayfoad committed Mar 20, 2020
2 parents 6aa2f8e + 30bb113 commit c818b13
Show file tree
Hide file tree
Showing 470 changed files with 16,697 additions and 4,546 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ void UnconventionalAssignOperatorCheck::check(
} else {
static const char *const Messages[][2] = {
{"ReturnType", "operator=() should return '%0&'"},
{"ArgumentType", "operator=() should take '%0 const&', '%0&&' or '%0'"},
{"ArgumentType",
getLangOpts().CPlusPlus11
? "operator=() should take '%0 const&', '%0&&' or '%0'"
: "operator=() should take '%0 const&' or '%0'"},
{"cv", "operator=() should not be marked '%1'"}};

const auto *Method = Result.Nodes.getNodeAs<CXXMethodDecl>("method");
Expand Down
5 changes: 5 additions & 0 deletions clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ void RenamerClangTidyCheck::check(const MatchFinder::MatchResult &Result) {
}

if (const auto *Decl = Result.Nodes.getNodeAs<NamedDecl>("decl")) {
// Fix using namespace declarations.
if (const auto *UsingNS = dyn_cast<UsingDirectiveDecl>(Decl))
addUsage(NamingCheckFailures, UsingNS->getNominatedNamespaceAsWritten(),
UsingNS->getIdentLocation());

if (!Decl->getIdentifier() || Decl->getName().empty() || Decl->isImplicit())
return;

Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/Preamble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ buildPreamble(PathRef FileName, CompilerInvocation &CI,
SerializedDeclsCollector.takeMacros(), std::move(StatCache),
SerializedDeclsCollector.takeCanonicalIncludes());
} else {
elog("Could not build a preamble for file {0} version {2}", FileName,
elog("Could not build a preamble for file {0} version {1}", FileName,
Inputs.Version);
return nullptr;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %check_clang_tidy -std=c++98,c++03 %s misc-unconventional-assign-operator %t

struct BadArgument {
BadArgument &operator=(BadArgument &);
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should take 'BadArgument const&' or 'BadArgument'
};
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,8 @@ void MyPoiterFunction(int * p_normal_pointer, int * const constant_ptr){
// CHECK-FIXES: {{^}} int * const lc_PointerB = nullptr;{{$}}
}

using namespace FOO_NS;
// CHECK-FIXES: {{^}}using namespace foo_ns;

using namespace FOO_NS::InlineNamespace;
// CHECK-FIXES: {{^}}using namespace foo_ns::inline_namespace;
1 change: 1 addition & 0 deletions clang/cmake/caches/Fuchsia-stage2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ set(LLVM_TOOLCHAIN_TOOLS
llvm-cxxfilt
llvm-dwarfdump
llvm-dwp
llvm-gsymutil
llvm-lib
llvm-nm
llvm-objcopy
Expand Down
6 changes: 5 additions & 1 deletion clang/docs/OpenMPSupport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| loop extension | clause: if for SIMD directives | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| loop extension | inclusive scan extension (matching C++17 PSTL) | :none:`unclaimed` | |
| loop extension | inclusive scan extension (matching C++17 PSTL) | :none:`claimed` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| memory mangagement | memory allocators | :good:`done` | r341687,r357929 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
Expand Down Expand Up @@ -179,6 +179,10 @@ implementation.
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device extension | clause: device_type | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device extension | clause: extended device | :good:`done` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device extension | clause: uses_allocators clause | :none:`claimed` | |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device extension | clause: in_reduction | :part:`worked on` | r308768 |
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
| device extension | omp_get_device_num() | :part:`worked on` | D54342 |
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/AST/ASTDumperUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ static const TerminalColor LocationColor = {llvm::raw_ostream::YELLOW, false};
static const TerminalColor ValueKindColor = {llvm::raw_ostream::CYAN, false};
// bitfield/objcproperty/objcsubscript/vectorcomponent
static const TerminalColor ObjectKindColor = {llvm::raw_ostream::CYAN, false};
// contains-errors
static const TerminalColor ErrorsColor = {llvm::raw_ostream::RED, true};

// Null statements
static const TerminalColor NullColor = {llvm::raw_ostream::BLUE, false};
Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/AST/CXXInheritance.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class CXXBasePaths {
friend class CXXRecordDecl;

/// The type from which this search originated.
CXXRecordDecl *Origin = nullptr;
const CXXRecordDecl *Origin = nullptr;

/// Paths - The actual set of paths that can be taken from the
/// derived class to the same base class.
Expand Down Expand Up @@ -225,8 +225,8 @@ class CXXBasePaths {

/// Retrieve the type from which this base-paths search
/// began
CXXRecordDecl *getOrigin() const { return Origin; }
void setOrigin(CXXRecordDecl *Rec) { Origin = Rec; }
const CXXRecordDecl *getOrigin() const { return Origin; }
void setOrigin(const CXXRecordDecl *Rec) { Origin = Rec; }

/// Clear the base-paths results.
void clear();
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/AST/ComputeDependence.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class CXXDeleteExpr;
class ArrayTypeTraitExpr;
class ExpressionTraitExpr;
class CXXNoexceptExpr;
class PackExpansionExpr;
class SubstNonTypeTemplateParmExpr;
class CoroutineSuspendExpr;
class DependentCoawaitExpr;
Expand All @@ -71,6 +72,7 @@ class LambdaExpr;
class CXXUnresolvedConstructExpr;
class CXXDependentScopeMemberExpr;
class MaterializeTemporaryExpr;
class CXXFoldExpr;
class TypeTraitExpr;
class ConceptSpecializationExpr;
class PredefinedExpr;
Expand Down Expand Up @@ -134,6 +136,7 @@ ExprDependence computeDependence(CXXDeleteExpr *E);
ExprDependence computeDependence(ArrayTypeTraitExpr *E);
ExprDependence computeDependence(ExpressionTraitExpr *E);
ExprDependence computeDependence(CXXNoexceptExpr *E, CanThrowResult CT);
ExprDependence computeDependence(PackExpansionExpr *E);
ExprDependence computeDependence(SubstNonTypeTemplateParmExpr *E);
ExprDependence computeDependence(CoroutineSuspendExpr *E);
ExprDependence computeDependence(DependentCoawaitExpr *E);
Expand All @@ -149,6 +152,7 @@ ExprDependence computeDependence(LambdaExpr *E,
ExprDependence computeDependence(CXXUnresolvedConstructExpr *E);
ExprDependence computeDependence(CXXDependentScopeMemberExpr *E);
ExprDependence computeDependence(MaterializeTemporaryExpr *E);
ExprDependence computeDependence(CXXFoldExpr *E);
ExprDependence computeDependence(TypeTraitExpr *E);
ExprDependence computeDependence(ConceptSpecializationExpr *E,
bool ValueDependent);
Expand Down
30 changes: 21 additions & 9 deletions clang/include/clang/AST/DependenceFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,23 @@ struct ExprDependenceScope {
Type = 4,
Value = 8,

// clang extension: this expr contains or references an error, and is
// considered dependent on how that error is resolved.
Error = 16,

None = 0,
All = 15,
All = 31,

TypeValue = Type | Value,
TypeInstantiation = Type | Instantiation,
ValueInstantiation = Value | Instantiation,
TypeValueInstantiation = Type | Value | Instantiation,

LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/Value)
LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/Error)
};
};
using ExprDependence = ExprDependenceScope::ExprDependence;
static constexpr unsigned ExprDependenceBits = 4;
static constexpr unsigned ExprDependenceBits = 5;

struct TypeDependenceScope {
enum TypeDependence : uint8_t {
Expand All @@ -47,6 +51,8 @@ struct TypeDependenceScope {
/// Whether this type is a variably-modified type (C99 6.7.5).
VariablyModified = 8,

// FIXME: add Error bit.

None = 0,
All = 15,

Expand Down Expand Up @@ -83,11 +89,14 @@ LLVM_COMMON_DEPENDENCE(TemplateArgumentDependence)
/// Computes dependencies of a reference with the name having template arguments
/// with \p TA dependencies.
inline ExprDependence toExprDependence(TemplateArgumentDependence TA) {
auto E =
static_cast<ExprDependence>(TA & ~TemplateArgumentDependence::Dependent);
auto D = ExprDependence::None;
if (TA & TemplateArgumentDependence::UnexpandedPack)
D |= ExprDependence::UnexpandedPack;
if (TA & TemplateArgumentDependence::Instantiation)
D |= ExprDependence::Instantiation;
if (TA & TemplateArgumentDependence::Dependent)
return E | ExprDependence::Type | ExprDependence::Value;
return E;
D |= ExprDependence::Type | ExprDependence::Value;
return D;
}
inline ExprDependence toExprDependence(TypeDependence TD) {
// This hack works because TypeDependence and TemplateArgumentDependence
Expand Down Expand Up @@ -127,10 +136,13 @@ toTemplateArgumentDependence(TemplateNameDependence D) {
}
inline TemplateArgumentDependence
toTemplateArgumentDependence(ExprDependence ED) {
TemplateArgumentDependence TAD = static_cast<TemplateArgumentDependence>(
ED & ~(ExprDependence::Type | ExprDependence::Value));
TemplateArgumentDependence TAD = TemplateArgumentDependence::None;
if (ED & (ExprDependence::Type | ExprDependence::Value))
TAD |= TemplateArgumentDependence::Dependent;
if (ED & ExprDependence::Instantiation)
TAD |= TemplateArgumentDependence::Instantiation;
if (ED & ExprDependence::UnexpandedPack)
TAD |= TemplateArgumentDependence::UnexpandedPack;
return TAD;
}

Expand Down
9 changes: 8 additions & 1 deletion clang/include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ class Expr : public ValueStmt {
return static_cast<bool>(getDependence() & ExprDependence::UnexpandedPack);
}

/// Whether this expression contains subexpressions which had errors, e.g. a
/// TypoExpr.
bool containsErrors() const {
return static_cast<bool>(getDependence() & ExprDependence::Error);
}

/// getExprLoc - Return the preferred location for the arrow when diagnosing
/// a problem with a generic expression.
SourceLocation getExprLoc() const LLVM_READONLY;
Expand Down Expand Up @@ -5881,7 +5887,8 @@ class TypoExpr : public Expr {
public:
TypoExpr(QualType T) : Expr(TypoExprClass, T, VK_LValue, OK_Ordinary) {
assert(T->isDependentType() && "TypoExpr given a non-dependent type");
setDependence(ExprDependence::TypeValueInstantiation);
setDependence(ExprDependence::TypeValueInstantiation |
ExprDependence::Error);
}

child_range children() {
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/AST/ExprCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -4020,7 +4020,7 @@ class PackExpansionExpr : public Expr {
EllipsisLoc(EllipsisLoc),
NumExpansions(NumExpansions ? *NumExpansions + 1 : 0),
Pattern(Pattern) {
setDependence(ExprDependence::TypeValueInstantiation);
setDependence(computeDependence(this));
}

PackExpansionExpr(EmptyShell Empty) : Expr(PackExpansionExprClass, Empty) {}
Expand Down Expand Up @@ -4531,7 +4531,7 @@ class CXXFoldExpr : public Expr {
NumExpansions(NumExpansions ? *NumExpansions + 1 : 0), Opcode(Opcode) {
SubExprs[0] = LHS;
SubExprs[1] = RHS;
setDependence(ExprDependence::TypeValueInstantiation);
setDependence(computeDependence(this));
}

CXXFoldExpr(EmptyShell Empty) : Expr(CXXFoldExprClass, Empty) {}
Expand Down
28 changes: 25 additions & 3 deletions clang/include/clang/AST/OpenMPClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -4433,6 +4433,12 @@ class OMPDeviceClause : public OMPClause, public OMPClauseWithPreInit {
/// Location of '('.
SourceLocation LParenLoc;

/// Device clause modifier.
OpenMPDeviceClauseModifier Modifier = OMPC_DEVICE_unknown;

/// Location of the modifier.
SourceLocation ModifierLoc;

/// Device number.
Stmt *Device = nullptr;

Expand All @@ -4441,20 +4447,30 @@ class OMPDeviceClause : public OMPClause, public OMPClauseWithPreInit {
/// \param E Device number.
void setDevice(Expr *E) { Device = E; }

/// Sets modifier.
void setModifier(OpenMPDeviceClauseModifier M) { Modifier = M; }

/// Setst modifier location.
void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }

public:
/// Build 'device' clause.
///
/// \param Modifier Clause modifier.
/// \param E Expression associated with this clause.
/// \param CaptureRegion Innermost OpenMP region where expressions in this
/// clause must be captured.
/// \param StartLoc Starting location of the clause.
/// \param ModifierLoc Modifier location.
/// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
OMPDeviceClause(Expr *E, Stmt *HelperE, OpenMPDirectiveKind CaptureRegion,
SourceLocation StartLoc, SourceLocation LParenLoc,
OMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *E, Stmt *HelperE,
OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation ModifierLoc,
SourceLocation EndLoc)
: OMPClause(OMPC_device, StartLoc, EndLoc), OMPClauseWithPreInit(this),
LParenLoc(LParenLoc), Device(E) {
LParenLoc(LParenLoc), Modifier(Modifier), ModifierLoc(ModifierLoc),
Device(E) {
setPreInitStmt(HelperE, CaptureRegion);
}

Expand All @@ -4475,6 +4491,12 @@ class OMPDeviceClause : public OMPClause, public OMPClauseWithPreInit {
/// Return device number.
Expr *getDevice() const { return cast<Expr>(Device); }

/// Gets modifier.
OpenMPDeviceClauseModifier getModifier() const { return Modifier; }

/// Gets modifier location.
SourceLocation getModifierLoc() const { return ModifierLoc; }

child_range children() { return child_range(&Device, &Device + 1); }

const_child_range children() const {
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
return CachedLocalOrUnnamed;
}
};
enum { NumTypeBits = 18 };
enum { NumTypeBits = 8 + TypeDependenceBits + 6 };

protected:
// These classes allow subclasses to somewhat cleanly pack bitfields
Expand Down
4 changes: 3 additions & 1 deletion clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ class TargetArch<list<string> arches> : TargetSpec {
let Arches = arches;
}
def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>;
def TargetAArch64 : TargetArch<["aarch64"]>;
def TargetAnyArm : TargetArch<!listconcat(TargetARM.Arches, TargetAArch64.Arches)>;
def TargetAVR : TargetArch<["avr"]>;
def TargetBPF : TargetArch<["bpfel", "bpfeb"]>;
def TargetMips32 : TargetArch<["mips", "mipsel"]>;
Expand Down Expand Up @@ -623,7 +625,7 @@ def Alias : Attr {
let Documentation = [Undocumented];
}

def ArmBuiltinAlias : InheritableAttr, TargetSpecificAttr<TargetARM> {
def ArmBuiltinAlias : InheritableAttr, TargetSpecificAttr<TargetAnyArm> {
let Spellings = [Clang<"__clang_arm_builtin_alias">];
let Args = [IdentifierArgument<"BuiltinName">];
let Subjects = SubjectList<[Function], ErrorDiag>;
Expand Down
1 change: 0 additions & 1 deletion clang/include/clang/Basic/CodeGenOptions.def
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ CODEGENOPT(ExperimentalNewPassManager, 1, 0) ///< Enables the new, experimental
CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new
///< pass manager.
CODEGENOPT(DisableRedZone , 1, 0) ///< Set when -mno-red-zone is enabled.
CODEGENOPT(EnableDebugEntryValues, 1, 0) ///< Emit call site parameter dbg info
CODEGENOPT(EmitCallSiteInfo, 1, 0) ///< Emit call site info only in the case of
///< '-g' + 'O>0' level.
CODEGENOPT(IndirectTlsSegRefs, 1, 0) ///< Set when -mno-tls-direct-seg-refs
Expand Down
8 changes: 8 additions & 0 deletions clang/include/clang/Basic/OpenMPKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@
#ifndef OPENMP_DEPOBJ_CLAUSE
#define OPENMP_DEPOBJ_CLAUSE(Name)
#endif
#ifndef OPENMP_DEVICE_MODIFIER
#define OPENMP_DEVICE_MODIFIER(Name)
#endif

// OpenMP clauses.
OPENMP_CLAUSE(allocator, OMPAllocatorClause)
Expand Down Expand Up @@ -366,6 +369,10 @@ OPENMP_SCHEDULE_MODIFIER(monotonic)
OPENMP_SCHEDULE_MODIFIER(nonmonotonic)
OPENMP_SCHEDULE_MODIFIER(simd)

// Modifiers for 'device' clause.
OPENMP_DEVICE_MODIFIER(ancestor)
OPENMP_DEVICE_MODIFIER(device_num)

// Static attributes for 'defaultmap' clause.
OPENMP_DEFAULTMAP_KIND(scalar)
OPENMP_DEFAULTMAP_KIND(aggregate)
Expand Down Expand Up @@ -1091,6 +1098,7 @@ OPENMP_DEPOBJ_CLAUSE(depend)
OPENMP_DEPOBJ_CLAUSE(destroy)
OPENMP_DEPOBJ_CLAUSE(update)

#undef OPENMP_DEVICE_MODIFIER
#undef OPENMP_DEPOBJ_CLAUSE
#undef OPENMP_FLUSH_CLAUSE
#undef OPENMP_ORDER_KIND
Expand Down
7 changes: 7 additions & 0 deletions clang/include/clang/Basic/OpenMPKinds.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ enum OpenMPScheduleClauseModifier {
OMPC_SCHEDULE_MODIFIER_last
};

/// OpenMP modifiers for 'device' clause.
enum OpenMPDeviceClauseModifier {
#define OPENMP_DEVICE_MODIFIER(Name) OMPC_DEVICE_##Name,
#include "clang/Basic/OpenMPKinds.def"
OMPC_DEVICE_unknown,
};

/// OpenMP attributes for 'depend' clause.
enum OpenMPDependClauseKind {
#define OPENMP_DEPEND_KIND(Name) \
Expand Down
Loading

0 comments on commit c818b13

Please sign in to comment.