[clang] 8869ba3 - [PS5] Add PS5OSTargetInfo class, update affected tests
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 1 13:30:48 PDT 2022
Author: Paul Robinson
Date: 2022-06-01T13:30:29-07:00
New Revision: 8869ba366268c644200784b15c4e6b8efe891397
URL: https://github.com/llvm/llvm-project/commit/8869ba366268c644200784b15c4e6b8efe891397
DIFF: https://github.com/llvm/llvm-project/commit/8869ba366268c644200784b15c4e6b8efe891397.diff
LOG: [PS5] Add PS5OSTargetInfo class, update affected tests
Added:
Modified:
clang/lib/Basic/LangStandards.cpp
clang/lib/Basic/Targets.cpp
clang/lib/Basic/Targets/OSTargets.h
clang/test/Preprocessor/init.c
clang/test/Sema/wchar.c
clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/LangStandards.cpp b/clang/lib/Basic/LangStandards.cpp
index a21898dd3c627..5bacc3b164960 100644
--- a/clang/lib/Basic/LangStandards.cpp
+++ b/clang/lib/Basic/LangStandards.cpp
@@ -61,8 +61,8 @@ LangStandard::Kind clang::getDefaultLanguageStandard(clang::Language Lang,
if (CLANG_DEFAULT_STD_C != LangStandard::lang_unspecified)
return CLANG_DEFAULT_STD_C;
- // The PS4 uses C99 as the default C standard.
- if (T.isPS4())
+ // The PS4 and PS5 use C99 as the default C standard.
+ if (T.isPS())
return LangStandard::lang_gnu99;
return LangStandard::lang_gnu17;
case Language::ObjC:
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 85c73abde1826..2d6ef998485ae 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -592,6 +592,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new NaClTargetInfo<X86_64TargetInfo>(Triple, Opts);
case llvm::Triple::PS4:
return new PS4OSTargetInfo<X86_64TargetInfo>(Triple, Opts);
+ case llvm::Triple::PS5:
+ return new PS5OSTargetInfo<X86_64TargetInfo>(Triple, Opts);
default:
return new X86_64TargetInfo(Triple, Opts);
}
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index cf317f58540e3..a814f681b1468 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -596,6 +596,23 @@ class LLVM_LIBRARY_VISIBILITY PS4OSTargetInfo : public PSOSTargetInfo<Target> {
: PSOSTargetInfo<Target>(Triple, Opts) {}
};
+// PS5 Target
+template <typename Target>
+class LLVM_LIBRARY_VISIBILITY PS5OSTargetInfo : public PSOSTargetInfo<Target> {
+protected:
+ void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+ MacroBuilder &Builder) const override {
+ // Start with base class defines.
+ PSOSTargetInfo<Target>::getOSDefines(Opts, Triple, Builder);
+
+ Builder.defineMacro("__PROSPERO__");
+ }
+
+public:
+ PS5OSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
+ : PSOSTargetInfo<Target>(Triple, Opts) {}
+};
+
// RTEMS Target
template <typename Target>
class LLVM_LIBRARY_VISIBILITY RTEMSTargetInfo : public OSTargetInfo<Target> {
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index 07b5fb86c45c2..61324fd5e43d8 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -1241,7 +1241,8 @@
// TCE:#define __tce__ 1
// TCE:#define tce 1
//
-// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 -triple=x86_64-scei-ps4 < /dev/null | FileCheck -match-full-lines -check-prefix PS4 %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-scei-ps4 < /dev/null | FileCheck --match-full-lines --check-prefixes=PS4,PS4ONLY %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-sie-ps5 < /dev/null | FileCheck --match-full-lines --check-prefixes=PS4,PS5ONLY %s
//
// PS4:#define _LP64 1
// PS4:#define __BIGGEST_ALIGNMENT__ 32
@@ -1311,8 +1312,9 @@
// PS4:#define __LP64__ 1
// PS4:#define __MMX__ 1
// PS4:#define __NO_MATH_INLINES 1
-// PS4:#define __ORBIS__ 1
+// PS4ONLY:#define __ORBIS__ 1
// PS4:#define __POINTER_WIDTH__ 64
+// PS5ONLY:#define __PROSPERO__ 1
// PS4:#define __PTRDIFF_MAX__ 9223372036854775807L
// PS4:#define __PTRDIFF_TYPE__ long int
// PS4:#define __PTRDIFF_WIDTH__ 64
@@ -1357,7 +1359,8 @@
// PS4:#define __x86_64__ 1
// PS4:#define unix 1
//
-// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-scei-ps4 < /dev/null | FileCheck -match-full-lines -check-prefix PS4-CXX %s
+// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-scei-ps4 < /dev/null | FileCheck --match-full-lines --check-prefix PS4-CXX %s
+// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-sie-ps5 < /dev/null | FileCheck --match-full-lines --check-prefix PS4-CXX %s
// PS4-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 32UL
//
// RUN: %clang_cc1 -E -dM -triple=x86_64-pc-mingw32 < /dev/null | FileCheck -match-full-lines -check-prefix X86-64-DECLSPEC %s
diff --git a/clang/test/Sema/wchar.c b/clang/test/Sema/wchar.c
index 5566207e50d7f..fa32ae6512fce 100644
--- a/clang/test/Sema/wchar.c
+++ b/clang/test/Sema/wchar.c
@@ -4,8 +4,8 @@
typedef __WCHAR_TYPE__ wchar_t;
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
- || defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR) \
- || (defined(_AIX) && !defined(__64BIT__))
+ || defined(_M_X64) || defined(__ORBIS__) || defined(__PROSPERO__) \
+ || defined(SHORT_WCHAR) || (defined(_AIX) && !defined(__64BIT__))
#define WCHAR_T_TYPE unsigned short
#elif defined(__aarch64__)
// See AArch64TargetInfo constructor -- unsigned on non-darwin non-OpenBSD non-NetBSD.
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp
index 4eaa1636d230e..183b0d3aa2078 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp
@@ -87,8 +87,8 @@ TEST(RecursiveASTVisitor, VisitsLambdaExprAndImplicitClass) {
}
TEST(RecursiveASTVisitor, VisitsAttributedLambdaExpr) {
- if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).isPS4())
- GTEST_SKIP(); // PS4 does not support fastcall.
+ if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).isPS())
+ GTEST_SKIP(); // PS4/PS5 do not support fastcall.
LambdaExprVisitor Visitor;
Visitor.ExpectMatch("", 1, 12);
EXPECT_TRUE(Visitor.runOver(
More information about the cfe-commits
mailing list