Skip to content

Commit f5e5c6a

Browse files
committed
Merge from 'master' to 'sycl-web' (intel#13)
CONFLICT (content): Merge conflict in clang/lib/Driver/Compilation.cpp
2 parents 3423e0b + 2ae2564 commit f5e5c6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1503
-478
lines changed

clang/include/clang/AST/DependenceFlags.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,32 @@ inline ExprDependence turnTypeToValueDependence(ExprDependence D) {
115115
// type dependency.
116116
return D & ~ExprDependence::Type;
117117
}
118+
inline ExprDependence turnValueToTypeDependence(ExprDependence D) {
119+
// Type-dependent expressions are always be value-dependent.
120+
if (D & ExprDependence::Value)
121+
D |= ExprDependence::Type;
122+
return D;
123+
}
124+
125+
// Returned type-dependence will never have VariablyModified set.
126+
inline TypeDependence toTypeDependence(ExprDependence D) {
127+
// Supported bits all have the same representation.
128+
return static_cast<TypeDependence>(D & (ExprDependence::UnexpandedPack |
129+
ExprDependence::Instantiation |
130+
ExprDependence::Type));
131+
}
132+
inline TypeDependence toTypeDependence(NestedNameSpecifierDependence D) {
133+
// Supported bits all have the same representation.
134+
return static_cast<TypeDependence>(D);
135+
}
136+
inline TypeDependence toTypeDependence(TemplateNameDependence D) {
137+
// Supported bits all have the same representation.
138+
return static_cast<TypeDependence>(D);
139+
}
140+
inline TypeDependence toTypeDependence(TemplateArgumentDependence D) {
141+
// Supported bits all have the same representation.
142+
return static_cast<TypeDependence>(D);
143+
}
118144

119145
inline NestedNameSpecifierDependence
120146
toNestedNameSpecifierDependendence(TypeDependence D) {

clang/include/clang/AST/LocInfoType.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ class LocInfoType : public Type {
3535
TypeSourceInfo *DeclInfo;
3636

3737
LocInfoType(QualType ty, TypeSourceInfo *TInfo)
38-
: Type((TypeClass)LocInfo, ty, ty->isDependentType(),
39-
ty->isInstantiationDependentType(), ty->isVariablyModifiedType(),
40-
ty->containsUnexpandedParameterPack()),
41-
DeclInfo(TInfo) {
38+
: Type((TypeClass)LocInfo, ty, ty->getDependence()), DeclInfo(TInfo) {
4239
assert(getTypeClass() == (TypeClass)LocInfo && "LocInfo didn't fit in TC?");
4340
}
4441
friend class Sema;

clang/include/clang/AST/Type.h

Lines changed: 65 additions & 180 deletions
Large diffs are not rendered by default.

clang/include/clang/AST/TypeProperties.td

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,9 @@ let Class = TagType in {
458458
let Class = EnumType in {
459459
def : Creator<[{
460460
QualType result = ctx.getEnumType(cast<EnumDecl>(declaration));
461-
const_cast<Type*>(result.getTypePtr())->setDependent(dependent);
461+
if (dependent)
462+
const_cast<Type *>(result.getTypePtr())
463+
->addDependence(TypeDependence::DependentInstantiation);
462464
return result;
463465
}]>;
464466
}
@@ -467,7 +469,9 @@ let Class = RecordType in {
467469
def : Creator<[{
468470
auto record = cast<RecordDecl>(declaration);
469471
QualType result = ctx.getRecordType(record);
470-
const_cast<Type*>(result.getTypePtr())->setDependent(dependent);
472+
if (dependent)
473+
const_cast<Type *>(result.getTypePtr())
474+
->addDependence(TypeDependence::DependentInstantiation);
471475
return result;
472476
}]>;
473477
}
@@ -610,7 +614,9 @@ let Class = TemplateSpecializationType in {
610614
templateArguments,
611615
*underlyingType);
612616
}
613-
const_cast<Type*>(result.getTypePtr())->setDependent(dependent);
617+
if (dependent)
618+
const_cast<Type *>(result.getTypePtr())
619+
->addDependence(TypeDependence::DependentInstantiation);
614620
return result;
615621
}]>;
616622
}

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,10 @@ def Xanalyzer : Separate<["-"], "Xanalyzer">,
468468
HelpText<"Pass <arg> to the static analyzer">, MetaVarName<"<arg>">,
469469
Group<StaticAnalyzer_Group>;
470470
def Xarch__ : JoinedAndSeparate<["-"], "Xarch_">, Flags<[DriverOption]>;
471+
def Xarch_host : Separate<["-"], "Xarch_host">, Flags<[DriverOption]>,
472+
HelpText<"Pass <arg> to the CUDA/HIP host compilation">, MetaVarName<"<arg>">;
473+
def Xarch_device : Separate<["-"], "Xarch_device">, Flags<[DriverOption]>,
474+
HelpText<"Pass <arg> to the CUDA/HIP device compilation">, MetaVarName<"<arg>">;
471475
def Xassembler : Separate<["-"], "Xassembler">,
472476
HelpText<"Pass <arg> to the assembler">, MetaVarName<"<arg>">,
473477
Group<CompileOnly_Group>;

clang/include/clang/Driver/ToolChain.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,20 @@ class ToolChain {
311311
Action::OffloadKind DeviceOffloadKind) const;
312312

313313
/// Append the argument following \p A to \p DAL assuming \p A is an Xarch
314-
/// argument.
315-
virtual void TranslateXarchArgs(const llvm::opt::DerivedArgList &Args,
316-
llvm::opt::Arg *&A,
317-
llvm::opt::DerivedArgList *DAL) const;
314+
/// argument. If \p AllocatedArgs is null pointer, synthesized arguments are
315+
/// added to \p DAL, otherwise they are appended to \p AllocatedArgs.
316+
virtual void TranslateXarchArgs(
317+
const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
318+
llvm::opt::DerivedArgList *DAL,
319+
SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs = nullptr) const;
320+
321+
/// Translate -Xarch_ arguments. If there are no such arguments, return
322+
/// a null pointer, otherwise return a DerivedArgList containing the
323+
/// translated arguments.
324+
virtual llvm::opt::DerivedArgList *
325+
TranslateXarchArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
326+
Action::OffloadKind DeviceOffloadKind,
327+
SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs) const;
318328

319329
/// Choose a tool to use to handle the action \p JA.
320330
///

clang/lib/AST/ASTContext.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "clang/AST/DeclOpenMP.h"
3030
#include "clang/AST/DeclTemplate.h"
3131
#include "clang/AST/DeclarationName.h"
32+
#include "clang/AST/DependenceFlags.h"
3233
#include "clang/AST/Expr.h"
3334
#include "clang/AST/ExprCXX.h"
3435
#include "clang/AST/ExprConcepts.h"
@@ -5130,8 +5131,12 @@ ASTContext::getAutoType(QualType DeducedType, AutoTypeKeyword Keyword,
51305131
void *Mem = Allocate(sizeof(AutoType) +
51315132
sizeof(TemplateArgument) * TypeConstraintArgs.size(),
51325133
TypeAlignment);
5133-
auto *AT = new (Mem) AutoType(DeducedType, Keyword, IsDependent, IsPack,
5134-
TypeConstraintConcept, TypeConstraintArgs);
5134+
auto *AT = new (Mem) AutoType(
5135+
DeducedType, Keyword,
5136+
(IsDependent ? TypeDependence::DependentInstantiation
5137+
: TypeDependence::None) |
5138+
(IsPack ? TypeDependence::UnexpandedPack : TypeDependence::None),
5139+
TypeConstraintConcept, TypeConstraintArgs);
51355140
Types.push_back(AT);
51365141
if (InsertPos)
51375142
AutoTypes.InsertNode(AT, InsertPos);
@@ -5191,11 +5196,11 @@ QualType ASTContext::getAtomicType(QualType T) const {
51915196
/// getAutoDeductType - Get type pattern for deducing against 'auto'.
51925197
QualType ASTContext::getAutoDeductType() const {
51935198
if (AutoDeductTy.isNull())
5194-
AutoDeductTy = QualType(
5195-
new (*this, TypeAlignment) AutoType(QualType(), AutoTypeKeyword::Auto,
5196-
/*dependent*/false, /*pack*/false,
5197-
/*concept*/nullptr, /*args*/{}),
5198-
0);
5199+
AutoDeductTy = QualType(new (*this, TypeAlignment)
5200+
AutoType(QualType(), AutoTypeKeyword::Auto,
5201+
TypeDependence::None,
5202+
/*concept*/ nullptr, /*args*/ {}),
5203+
0);
51995204
return AutoDeductTy;
52005205
}
52015206

0 commit comments

Comments
 (0)