[clang] Add visibility features for z/OS (eg. _Export, pragma export) (PR #111035)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 3 11:05:01 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 34d0c99d82791607d96db18b94218269106ef3b8 9cfc3ccba6bca8b9b2146e0830e21dc42e5cecdb --extensions h,cpp,c -- clang/test/CodeGen/attr-export-failing.cpp clang/test/CodeGen/attr-export.cpp clang/test/CodeGen/pragma-export.c clang/test/CodeGen/pragma-export.cpp clang/test/CodeGen/zos-pragmas.c clang/test/CodeGen/zos-pragmas.cpp clang/include/clang/AST/ASTConsumer.h clang/include/clang/Parse/Parser.h clang/include/clang/Sema/DeclSpec.h clang/include/clang/Sema/Sema.h clang/lib/CodeGen/BackendConsumer.h clang/lib/CodeGen/CodeGenAction.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenModule.h clang/lib/CodeGen/ModuleBuilder.cpp clang/lib/Driver/ToolChains/ZOS.cpp clang/lib/Parse/ParseDecl.cpp clang/lib/Parse/ParseDeclCXX.cpp clang/lib/Parse/ParsePragma.cpp clang/lib/Parse/Parser.cpp clang/lib/Sema/DeclSpec.cpp clang/lib/Sema/Sema.cpp clang/lib/Sema/SemaAttr.cpp clang/lib/Sema/SemaDecl.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h
index d03a6b11d2..243776ada2 100644
--- a/clang/include/clang/Sema/DeclSpec.h
+++ b/clang/include/clang/Sema/DeclSpec.h
@@ -496,9 +496,8 @@ public:
TypeQualifiers(TQ_unspecified), FS_inline_specified(false),
FS_forceinline_specified(false), FS_virtual_specified(false),
FS_noreturn_specified(false), export_specified(false),
- FriendSpecifiedFirst(false),
- ConstexprSpecifier(
- static_cast<unsigned>(ConstexprSpecKind::Unspecified)),
+ FriendSpecifiedFirst(false), ConstexprSpecifier(static_cast<unsigned>(
+ ConstexprSpecKind::Unspecified)),
Attrs(attrFactory), writtenBS(), ObjCQualifiers(nullptr) {}
// storage-class-specifier
@@ -668,7 +667,7 @@ public:
bool isExportSpecified() const { return export_specified; }
SourceLocation getExportSpecLoc() const { return exportLoc; }
- void ClearFunctionSpecs() {
+ void ClearFunctionSpecs() {
FS_inline_specified = false;
FS_inlineLoc = SourceLocation();
FS_forceinline_specified = false;
@@ -2046,7 +2045,7 @@ public:
FunctionDefinitionKind::Declaration)),
Redeclaration(false), Extension(false), ObjCIvar(false),
ObjCWeakProperty(false), InlineStorageUsed(false),
- ExportSpecified(false), HasInitializer(false),
+ ExportSpecified(false), HasInitializer(false),
Attrs(DS.getAttributePool().getFactory()),
DeclarationAttrs(DeclarationAttrs), AsmLabel(nullptr),
TrailingRequiresClause(nullptr),
diff --git a/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp
index 7658d97af0..e0c7ae03f9 100644
--- a/clang/lib/CodeGen/ModuleBuilder.cpp
+++ b/clang/lib/CodeGen/ModuleBuilder.cpp
@@ -318,7 +318,7 @@ namespace {
Builder->EmitPragmaExport(D);
}
- void HandleVTable(CXXRecordDecl *RD) override {
+ void HandleVTable(CXXRecordDecl *RD) override {
if (Diags.hasUnrecoverableErrorOccurred())
return;
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
index af892115f1..d661cab4fc 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -1448,9 +1448,9 @@ NestedNameSpecifier *Parser::zOSParseIdentifier(StringRef PragmaName,
return NestedId;
}
-bool Parser::zOSParseParameterList(StringRef PragmaName,
- std::optional<SmallVector<QualType, 4>> &TypeList,
- Qualifiers &CVQual) {
+bool Parser::zOSParseParameterList(
+ StringRef PragmaName, std::optional<SmallVector<QualType, 4>> &TypeList,
+ Qualifiers &CVQual) {
if (Tok.is(tok::l_paren)) {
TypeList = SmallVector<QualType, 4>();
PP.Lex(Tok);
@@ -1544,7 +1544,7 @@ bool Parser::zOSHandlePragmaHelper(tok::TokenKind PragmaKind) {
Actions.ActOnPragmaExport(NestedId, IdentNameLoc, std::move(TypeList),
CVQual);
- //Because export is also a C++ keyword, we also check for that
+ // Because export is also a C++ keyword, we also check for that
if (Tok.is(tok::identifier) || Tok.is(tok::kw_export)) {
IsPragmaExport = false;
PragmaName = Tok.getIdentifierInfo()->getName();
@@ -4298,8 +4298,7 @@ void PragmaMaxTokensTotalHandler::HandlePragma(Preprocessor &PP,
}
/// Helper function for handling z/OS pragmas like #pragma export.
-static void zOSPragmaHandlerHelper(Preprocessor &PP,
- Token &Tok,
+static void zOSPragmaHandlerHelper(Preprocessor &PP, Token &Tok,
tok::TokenKind TokKind) {
Token EoF, AnnotTok;
EoF.startToken();
@@ -4322,9 +4321,9 @@ static void zOSPragmaHandlerHelper(Preprocessor &PP,
auto TokenArray = std::make_unique<Token[]>(TokenVector.size());
std::copy(TokenVector.begin(), TokenVector.end(), TokenArray.get());
auto Value = new (PP.getPreprocessorAllocator())
- std::pair<std::unique_ptr<Token[]>, size_t>(std::move(TokenArray),
+ std::pair<std::unique_ptr<Token[]>, size_t>(std::move(TokenArray),
- TokenVector.size());
+ TokenVector.size());
AnnotTok.setAnnotationValue(Value);
PP.EnterToken(AnnotTok, /*IsReinject*/ false);
}
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 6964a70ef5..83f35342f4 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -1429,8 +1429,8 @@ void Sema::ActOnEndOfTranslationUnit() {
} else
Consumer.CompletePragmaExport(D);
} else
- Diag(D->getLocation(), diag::warn_pragma_not_applied) << "export"
- << D;
+ Diag(D->getLocation(), diag::warn_pragma_not_applied)
+ << "export" << D;
} else
Diag(I.NameLoc, diag::warn_failed_to_resolve_pragma) << "export";
}
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 15c1a36d9c..969cda2790 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5090,12 +5090,13 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
if (DS.isExportSpecified()) {
VisibilityAttr *existingAttr = TagD->getAttr<VisibilityAttr>();
if (existingAttr) {
- VisibilityAttr::VisibilityType existingValue = existingAttr->getVisibility();
+ VisibilityAttr::VisibilityType existingValue =
+ existingAttr->getVisibility();
if (existingValue != VisibilityAttr::Default)
Diag(DS.getExportSpecLoc(), diag::err_mismatched_visibility);
} else {
- Tag->addAttr(VisibilityAttr::CreateImplicit(Context,
- VisibilityAttr::Default));
+ Tag->addAttr(
+ VisibilityAttr::CreateImplicit(Context, VisibilityAttr::Default));
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/111035
More information about the cfe-commits
mailing list