summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2018-11-28 21:54:04 +0000
committerErich Keane <erich.keane@intel.com>2018-11-28 21:54:04 +0000
commita3e7a167c499bfe35628676137637c5265bb06aa (patch)
tree70cc06298f7a2187aa9516fd270e72f1a946f81e /clang/lib/Sema/SemaDecl.cpp
parentc9f2473b4306117a409bc3167f0988681ecb518f (diff)
downloadbcm5719-llvm-a3e7a167c499bfe35628676137637c5265bb06aa.tar.gz
bcm5719-llvm-a3e7a167c499bfe35628676137637c5265bb06aa.zip
Allow cpu-dispatch forward declarations.
As a followup to r347805, allow forward declarations of cpu-dispatch and cpu-specific for the same reasons. Change-Id: Ic1bde9be369b1f8f1d47d58e6fbdc2f9dfcdd785 llvm-svn: 347812
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 8ccd9ae322b..5b2d2899f81 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9822,6 +9822,15 @@ static bool CheckMultiVersionAdditionalDecl(
return true;
}
+ // Permit forward declarations in the case where these two are compatible.
+ if (!OldFD->isMultiVersion()) {
+ OldFD->setIsMultiVersion();
+ NewFD->setIsMultiVersion();
+ Redeclaration = true;
+ OldDecl = OldFD;
+ return false;
+ }
+
NewFD->setIsMultiVersion();
Redeclaration = false;
MergeTypeWithPrevious = false;
@@ -9896,14 +9905,6 @@ static bool CheckMultiVersionFunction(Sema &S, FunctionDecl *NewFD,
return CheckTargetCausesMultiVersioning(S, OldFD, NewFD, NewTA,
Redeclaration, OldDecl,
MergeTypeWithPrevious, Previous);
- // Previous declarations lack CPUDispatch/CPUSpecific.
- if (!OldFD->isMultiVersion()) {
- S.Diag(OldFD->getLocation(), diag::err_multiversion_required_in_redecl)
- << 1;
- S.Diag(NewFD->getLocation(), diag::note_multiversioning_caused_here);
- NewFD->setInvalidDecl();
- return true;
- }
// At this point, we have a multiversion function decl (in OldFD) AND an
// appropriate attribute in the current function decl. Resolve that these are
OpenPOWER on IntegriCloud