Skip to content

Commit 4cee805

Browse files
committed
Merge from '"main"' to '"sycl-web"' (7 commits)
CONFLICT (content): Merge conflict in clang/test/CodeGenCXX/attr-annotate.cpp
2 parents c458aed + aad244d commit 4cee805

File tree

285 files changed

+6096
-2049
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+6096
-2049
lines changed

clang/examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ add_subdirectory(PrintFunctionNames)
88
add_subdirectory(AnnotateFunctions)
99
add_subdirectory(Attribute)
1010
add_subdirectory(CallSuperAttribute)
11+
add_subdirectory(PluginsOrder)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
add_llvm_library(PluginsOrder MODULE PluginsOrder.cpp PLUGIN_TOOL clang)
2+
3+
if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
4+
set(LLVM_LINK_COMPONENTS
5+
Support
6+
)
7+
clang_target_link_libraries(PluginsOrder PRIVATE
8+
clangAST
9+
clangFrontend
10+
)
11+
endif()
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
//===- PluginsOrder.cpp ---------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "clang/AST/AST.h"
10+
#include "clang/AST/ASTConsumer.h"
11+
#include "clang/Frontend/FrontendPluginRegistry.h"
12+
using namespace clang;
13+
14+
namespace {
15+
16+
class AlwaysBeforeConsumer : public ASTConsumer {
17+
public:
18+
void HandleTranslationUnit(ASTContext &) override {
19+
llvm::errs() << "always-before\n";
20+
}
21+
};
22+
23+
class AlwaysBeforeAction : public PluginASTAction {
24+
public:
25+
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
26+
llvm::StringRef) override {
27+
return std::make_unique<AlwaysBeforeConsumer>();
28+
}
29+
30+
bool ParseArgs(const CompilerInstance &CI,
31+
const std::vector<std::string> &args) override {
32+
return true;
33+
}
34+
35+
PluginASTAction::ActionType getActionType() override {
36+
return AddBeforeMainAction;
37+
}
38+
};
39+
40+
class AlwaysAfterConsumer : public ASTConsumer {
41+
public:
42+
void HandleTranslationUnit(ASTContext &) override {
43+
llvm::errs() << "always-after\n";
44+
}
45+
};
46+
47+
class AlwaysAfterAction : public PluginASTAction {
48+
public:
49+
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
50+
llvm::StringRef) override {
51+
return std::make_unique<AlwaysAfterConsumer>();
52+
}
53+
54+
bool ParseArgs(const CompilerInstance &CI,
55+
const std::vector<std::string> &args) override {
56+
return true;
57+
}
58+
59+
PluginASTAction::ActionType getActionType() override {
60+
return AddAfterMainAction;
61+
}
62+
};
63+
64+
class CmdAfterConsumer : public ASTConsumer {
65+
public:
66+
void HandleTranslationUnit(ASTContext &) override {
67+
llvm::errs() << "cmd-after\n";
68+
}
69+
};
70+
71+
class CmdAfterAction : public PluginASTAction {
72+
public:
73+
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
74+
llvm::StringRef) override {
75+
return std::make_unique<CmdAfterConsumer>();
76+
}
77+
78+
bool ParseArgs(const CompilerInstance &CI,
79+
const std::vector<std::string> &args) override {
80+
return true;
81+
}
82+
83+
PluginASTAction::ActionType getActionType() override {
84+
return CmdlineAfterMainAction;
85+
}
86+
};
87+
88+
class CmdBeforeConsumer : public ASTConsumer {
89+
public:
90+
void HandleTranslationUnit(ASTContext &) override {
91+
llvm::errs() << "cmd-before\n";
92+
}
93+
};
94+
95+
class CmdBeforeAction : public PluginASTAction {
96+
public:
97+
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
98+
llvm::StringRef) override {
99+
return std::make_unique<CmdBeforeConsumer>();
100+
}
101+
102+
bool ParseArgs(const CompilerInstance &CI,
103+
const std::vector<std::string> &args) override {
104+
return true;
105+
}
106+
107+
PluginASTAction::ActionType getActionType() override {
108+
return CmdlineBeforeMainAction;
109+
}
110+
};
111+
112+
} // namespace
113+
114+
static FrontendPluginRegistry::Add<CmdBeforeAction> X1("cmd-before", "");
115+
static FrontendPluginRegistry::Add<CmdAfterAction> X2("cmd-after", "");
116+
static FrontendPluginRegistry::Add<AlwaysBeforeAction> X3("always-before", "");
117+
static FrontendPluginRegistry::Add<AlwaysAfterAction> X4("always-after", "");

clang/include/clang/Basic/BuiltinsWebAssembly.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,10 @@ TARGET_BUILTIN(__builtin_wasm_laneselect_i64x2, "V2LLiV2LLiV2LLiV2LLi", "nc", "r
174174

175175
TARGET_BUILTIN(__builtin_wasm_relaxed_swizzle_i8x16, "V16ScV16ScV16Sc", "nc", "relaxed-simd")
176176

177+
TARGET_BUILTIN(__builtin_wasm_relaxed_min_f32x4, "V4fV4fV4f", "nc", "relaxed-simd")
178+
TARGET_BUILTIN(__builtin_wasm_relaxed_max_f32x4, "V4fV4fV4f", "nc", "relaxed-simd")
179+
TARGET_BUILTIN(__builtin_wasm_relaxed_min_f64x2, "V2dV2dV2d", "nc", "relaxed-simd")
180+
TARGET_BUILTIN(__builtin_wasm_relaxed_max_f64x2, "V2dV2dV2d", "nc", "relaxed-simd")
181+
177182
#undef BUILTIN
178183
#undef TARGET_BUILTIN

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7564,7 +7564,8 @@ def note_throw_in_function : Note<"function declared non-throwing here">;
75647564
def err_seh_try_outside_functions : Error<
75657565
"cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
75667566
def err_mixing_cxx_try_seh_try : Error<
7567-
"cannot use C++ 'try' in the same function as SEH '__try'">;
7567+
"cannot use %select{C++ 'try'|Objective-C '@try'}0 "
7568+
"in the same function as SEH '__try'">;
75687569
def err_seh_try_unsupported : Error<
75697570
"SEH '__try' is not supported on this target">;
75707571
def note_conflicting_try_here : Note<

clang/include/clang/Frontend/FrontendAction.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,17 +270,18 @@ class PluginASTAction : public ASTFrontendAction {
270270
const std::vector<std::string> &arg) = 0;
271271

272272
enum ActionType {
273-
Cmdline, ///< Action is determined by the cc1 command-line
274-
ReplaceAction, ///< Replace the main action
275-
AddBeforeMainAction, ///< Execute the action before the main action
276-
AddAfterMainAction ///< Execute the action after the main action
273+
CmdlineBeforeMainAction, ///< Execute the action before the main action if
274+
///< on the command line
275+
CmdlineAfterMainAction, ///< Execute the action after the main action if on
276+
///< the command line
277+
ReplaceAction, ///< Replace the main action
278+
AddBeforeMainAction, ///< Execute the action before the main action
279+
AddAfterMainAction ///< Execute the action after the main action
277280
};
278281
/// Get the action type for this plugin
279282
///
280-
/// \return The action type. If the type is Cmdline then by default the
281-
/// plugin does nothing and what it does is determined by the cc1
282-
/// command-line.
283-
virtual ActionType getActionType() { return Cmdline; }
283+
/// \return The action type. By default we use CmdlineAfterMainAction.
284+
virtual ActionType getActionType() { return CmdlineAfterMainAction; }
284285
};
285286

286287
/// Abstract base class to use for preprocessor-based frontend actions.

clang/include/clang/Sema/ScopeInfo.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@ class FunctionScopeInfo {
175175
/// First 'return' statement in the current function.
176176
SourceLocation FirstReturnLoc;
177177

178-
/// First C++ 'try' statement in the current function.
179-
SourceLocation FirstCXXTryLoc;
178+
/// First C++ 'try' or ObjC @try statement in the current function.
179+
SourceLocation FirstCXXOrObjCTryLoc;
180+
enum { TryLocIsCXX, TryLocIsObjC, Unknown } FirstTryType = Unknown;
180181

181182
/// First SEH '__try' statement in the current function.
182183
SourceLocation FirstSEHTryLoc;
@@ -446,7 +447,14 @@ class FunctionScopeInfo {
446447

447448
void setHasCXXTry(SourceLocation TryLoc) {
448449
setHasBranchProtectedScope();
449-
FirstCXXTryLoc = TryLoc;
450+
FirstCXXOrObjCTryLoc = TryLoc;
451+
FirstTryType = TryLocIsCXX;
452+
}
453+
454+
void setHasObjCTry(SourceLocation TryLoc) {
455+
setHasBranchProtectedScope();
456+
FirstCXXOrObjCTryLoc = TryLoc;
457+
FirstTryType = TryLocIsObjC;
450458
}
451459

452460
void setHasSEHTry(SourceLocation TryLoc) {

clang/lib/AST/DeclPrinter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,14 @@ static QualType GetBaseType(QualType T) {
153153
while (!BaseType->isSpecifierType()) {
154154
if (const PointerType *PTy = BaseType->getAs<PointerType>())
155155
BaseType = PTy->getPointeeType();
156+
else if (const ObjCObjectPointerType *OPT =
157+
BaseType->getAs<ObjCObjectPointerType>())
158+
BaseType = OPT->getPointeeType();
156159
else if (const BlockPointerType *BPy = BaseType->getAs<BlockPointerType>())
157160
BaseType = BPy->getPointeeType();
158-
else if (const ArrayType* ATy = dyn_cast<ArrayType>(BaseType))
161+
else if (const ArrayType *ATy = dyn_cast<ArrayType>(BaseType))
159162
BaseType = ATy->getElementType();
160-
else if (const FunctionType* FTy = BaseType->getAs<FunctionType>())
163+
else if (const FunctionType *FTy = BaseType->getAs<FunctionType>())
161164
BaseType = FTy->getReturnType();
162165
else if (const VectorType *VTy = BaseType->getAs<VectorType>())
163166
BaseType = VTy->getElementType();

clang/lib/AST/Type.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2785,7 +2785,6 @@ bool Type::isSpecifierType() const {
27852785
case DependentTemplateSpecialization:
27862786
case ObjCInterface:
27872787
case ObjCObject:
2788-
case ObjCObjectPointer: // FIXME: object pointers aren't really specifiers
27892788
return true;
27902789
default:
27912790
return false;

clang/lib/Basic/Targets/ARM.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ bool ARMTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
446446
HasFloat16 = true;
447447
ARMCDECoprocMask = 0;
448448
HasBFloat16 = false;
449+
FPRegsDisabled = false;
449450

450451
// This does not diagnose illegal cases like having both
451452
// "+vfpv2" and "+vfpv3" or having "+neon" and "-fp64".
@@ -522,6 +523,8 @@ bool ARMTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
522523
ARMCDECoprocMask |= (1U << Coproc);
523524
} else if (Feature == "+bf16") {
524525
HasBFloat16 = true;
526+
} else if (Feature == "-fpregs") {
527+
FPRegsDisabled = true;
525528
}
526529
}
527530

@@ -978,6 +981,8 @@ bool ARMTargetInfo::validateAsmConstraint(
978981
case 't': // s0-s31, d0-d31, or q0-q15
979982
case 'w': // s0-s15, d0-d7, or q0-q3
980983
case 'x': // s0-s31, d0-d15, or q0-q7
984+
if (FPRegsDisabled)
985+
return false;
981986
Info.setAllowsRegister();
982987
return true;
983988
case 'j': // An immediate integer between 0 and 65535 (valid for MOVW)

0 commit comments

Comments
 (0)