Skip to content

Commit

Permalink
Merge from 'master' to 'sycl-web' (intel#11)
Browse files Browse the repository at this point in the history
  CONFLICT (content): Merge conflict in llvm/test/CMakeLists.txt
  • Loading branch information
bader committed Feb 26, 2020
2 parents 237e8be + e4af56d commit 7fa4ab4
Show file tree
Hide file tree
Showing 19 changed files with 787 additions and 541 deletions.
45 changes: 32 additions & 13 deletions clang/lib/Sema/ParsedAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,26 @@ struct ParsedAttrInfo {
unsigned IsKnownToGCC : 1;
unsigned IsSupportedByPragmaAttribute : 1;

bool (*DiagAppertainsToDecl)(Sema &S, const ParsedAttr &Attr, const Decl *);
bool (*DiagLangOpts)(Sema &S, const ParsedAttr &Attr);
bool (*ExistsInTarget)(const TargetInfo &Target);
unsigned (*SpellingIndexToSemanticSpelling)(const ParsedAttr &Attr);
void (*GetPragmaAttributeMatchRules)(
llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &Rules,
const LangOptions &LangOpts);
virtual ~ParsedAttrInfo() = default;

virtual bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr,
const Decl *) const {
return true;
}
virtual bool diagLangOpts(Sema &S, const ParsedAttr &Attr) const {
return true;
}
virtual bool existsInTarget(const TargetInfo &Target) const {
return true;
}
virtual unsigned
spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const {
return UINT_MAX;
}
virtual void getPragmaAttributeMatchRules(
llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &Rules,
const LangOptions &LangOpts) const {
}
};

namespace {
Expand All @@ -126,7 +139,13 @@ namespace {
} // namespace

static const ParsedAttrInfo &getInfo(const ParsedAttr &A) {
return AttrInfoMap[A.getKind()];
// If we have a ParsedAttrInfo for this ParsedAttr then return that,
// otherwise return a default ParsedAttrInfo.
if (A.getKind() < llvm::array_lengthof(AttrInfoMap))
return *AttrInfoMap[A.getKind()];

static ParsedAttrInfo DefaultParsedAttrInfo;
return DefaultParsedAttrInfo;
}

unsigned ParsedAttr::getMinArgs() const { return getInfo(*this).NumArgs; }
Expand All @@ -140,7 +159,7 @@ bool ParsedAttr::hasCustomParsing() const {
}

bool ParsedAttr::diagnoseAppertainsTo(Sema &S, const Decl *D) const {
return getInfo(*this).DiagAppertainsToDecl(S, *this, D);
return getInfo(*this).diagAppertainsToDecl(S, *this, D);
}

bool ParsedAttr::appliesToDecl(const Decl *D,
Expand All @@ -152,11 +171,11 @@ void ParsedAttr::getMatchRules(
const LangOptions &LangOpts,
SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules)
const {
return getInfo(*this).GetPragmaAttributeMatchRules(MatchRules, LangOpts);
return getInfo(*this).getPragmaAttributeMatchRules(MatchRules, LangOpts);
}

bool ParsedAttr::diagnoseLangOpts(Sema &S) const {
return getInfo(*this).DiagLangOpts(S, *this);
return getInfo(*this).diagLangOpts(S, *this);
}

bool ParsedAttr::isTargetSpecificAttr() const {
Expand All @@ -168,7 +187,7 @@ bool ParsedAttr::isTypeAttr() const { return getInfo(*this).IsType; }
bool ParsedAttr::isStmtAttr() const { return getInfo(*this).IsStmt; }

bool ParsedAttr::existsInTarget(const TargetInfo &Target) const {
return getInfo(*this).ExistsInTarget(Target);
return getInfo(*this).existsInTarget(Target);
}

bool ParsedAttr::isKnownToGCC() const { return getInfo(*this).IsKnownToGCC; }
Expand All @@ -178,7 +197,7 @@ bool ParsedAttr::isSupportedByPragmaAttribute() const {
}

unsigned ParsedAttr::getSemanticSpelling() const {
return getInfo(*this).SpellingIndexToSemanticSpelling(*this);
return getInfo(*this).spellingIndexToSemanticSpelling(*this);
}

bool ParsedAttr::hasVariadicArg() const {
Expand Down
9 changes: 3 additions & 6 deletions clang/test/CodeGenCXX/member-function-pointer-calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ int f(A* a, int (A::*fp)()) {
}

// CHECK-LABEL: define i32 @_Z2g1v()
// CHECK-LEGACY: ret i32 1
// CHECK-NEWPM: [[A:%.*]] = alloca %struct.A, align 8
// CHECK-NEWPM: [[TMP:%.*]] = getelementptr inbounds %struct.A, %struct.A* %a, i64 0, i32 0
// CHECK-NEWPM: store i32 (...)** bitcast (i8** getelementptr inbounds ({ [4 x i8*] }, { [4 x i8*] }* @_ZTV1A, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** [[TMP]], align 8
// CHECK-NEWPM: [[RET:%.*]] = call i32 @_ZN1A3vf1Ev(%struct.A* nonnull %a) #2
// CHECK-NEWPM: ret i32 [[RET]]
// CHECK-NOT: }
// CHECK: ret i32 1
// MINGW64-LABEL: define dso_local i32 @_Z2g1v()
// MINGW64: call i32 @_Z1fP1AMS_FivE(%struct.A* %{{.*}}, { i64, i64 }* %{{.*}})
int g1() {
Expand All @@ -25,6 +21,7 @@ int g1() {
}

// CHECK-LABEL: define i32 @_Z2g2v()
// CHECK-NOT: }
// CHECK: ret i32 2
// MINGW64-LABEL: define dso_local i32 @_Z2g2v()
// MINGW64: call i32 @_Z1fP1AMS_FivE(%struct.A* %{{.*}}, { i64, i64 }* %{{.*}})
Expand Down
Loading

0 comments on commit 7fa4ab4

Please sign in to comment.