diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index fd310234a4422..19d1963e97aea 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -14948,24 +14948,6 @@ Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, if (!D) continue; - auto *VD = dyn_cast(D); - - /// CHERIoT-specific check. If a variable is declared with a sealed type, it - /// can't have external storage, since its initializer must be available in - /// the unit. - /// - /// For example - /// ``` - /// typedef int MySealedType __attribute__((cheriot_sealed("MyCompartment", - /// "MySealingKeyType"))); extern MySealedType mySealedObject; - /// ``` - /// would not really make sense. - if (VD && VD->getType().hasCHERIoTSealedAttr() && - VD->hasExternalStorage()) { - Diag(D->getLocation(), diag::err_cheriot_invalid_sealed_declaration) - << "external"; - } - // Check if the Decl has been declared in '#pragma omp declare target' // directive and has static storage duration. if (auto *VD = dyn_cast(D); diff --git a/clang/test/Sema/cheri/cheriot-static-sealed-value-attr.c b/clang/test/Sema/cheri/cheriot-static-sealed-value-attr.c index 8ff49b69a95f2..d2af841f9c5c4 100644 --- a/clang/test/Sema/cheri/cheriot-static-sealed-value-attr.c +++ b/clang/test/Sema/cheri/cheriot-static-sealed-value-attr.c @@ -18,7 +18,7 @@ MyObj4 Obj4 = {0, 0, 0, 0}; struct PlainObj plainObj = {10}; MyObj5 Obj5 = &plainObj; -extern MyObj5 Obj6; // expected-error{{cannot declare a sealed variable as external}} +extern MyObj5 Obj6; // No warnings here, it is allowed to declare it `extern`. void useStruct(struct MyObj x); void useStructSealedCap(struct MyObj *__sealed_capability x); diff --git a/clang/test/SemaCXX/cheri/cheriot-static-sealed-value-attr.cpp b/clang/test/SemaCXX/cheri/cheriot-static-sealed-value-attr.cpp index c8f657c932c6b..478db715f55bf 100644 --- a/clang/test/SemaCXX/cheri/cheriot-static-sealed-value-attr.cpp +++ b/clang/test/SemaCXX/cheri/cheriot-static-sealed-value-attr.cpp @@ -17,7 +17,7 @@ MyObj4 Obj4 = {0, 0, 0, 0}; struct PlainObj plainObj = {10}; MyObj5 Obj5 = &plainObj; -extern MyObj5 Obj6; // expected-error{{cannot declare a sealed variable as external}} +extern MyObj5 Obj6; // No warnings here, it is allowed to declare it `extern`. void useStruct(struct MyObj x); void useStructSealedCap(struct MyObj *__sealed_capability x);