Skip to content

Commit 26c543f

Browse files
AutomergerAutomerger
authored andcommitted
Propagating prior merge from 'llvm.org/master'.
apple-llvm-split-commit: 260fae54d051a87c52818c3d3cf30e75d5eb3916 apple-llvm-split-dir: clang/
2 parents 62c58a2 + 5980232 commit 26c543f

Some content is hidden

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

42 files changed

+800
-213
lines changed

clang/cmake/caches/Apple-stage1.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ set(CLANG_BOOTSTRAP_PASSTHROUGH
2727
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
2828
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
2929

30-
# LIBCXX Settings
31-
set(LIBCXX_INSTALL_LIBRARY OFF CACHE BOOL "")
32-
set(LIBCXX_INSTALL_HEADERS ON CACHE BOOL "")
33-
set(LIBCXX_OVERRIDE_DARWIN_INSTALL ON CACHE BOOL "")
34-
3530
set(CLANG_BOOTSTRAP_TARGETS
3631
generate-order-file
3732
check-all

clang/docs/UsersManual.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Clang Compiler User's Manual
33
============================
44

5+
.. include:: <isonum.txt>
6+
57
.. contents::
68
:local:
79

@@ -1650,7 +1652,7 @@ features. You can "tune" the debug info for one of several different debuggers.
16501652

16511653
.. option:: -ggdb, -glldb, -gsce
16521654

1653-
Tune the debug info for the ``gdb``, ``lldb``, or Sony Computer Entertainment
1655+
Tune the debug info for the ``gdb``, ``lldb``, or Sony PlayStation\ |reg|
16541656
debugger, respectively. Each of these options implies **-g**. (Therefore, if
16551657
you want both **-gline-tables-only** and debugger tuning, the tuning option
16561658
must come first.)

clang/include/clang/AST/ASTContext.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ class ASTContext : public RefCountedBase<ASTContext> {
324324
};
325325
llvm::DenseMap<Module*, PerModuleInitializers*> ModuleInitializers;
326326

327+
/// Diagnostics that are emitted if and only if the given function is
328+
/// codegen'ed. Access these through FunctionDecl::addDeferredDiag() and
329+
/// FunctionDecl::takeDeferredDiags().
330+
llvm::DenseMap<const FunctionDecl *, std::vector<PartialDiagnosticAt>>
331+
DeferredDiags;
332+
327333
public:
328334
/// \brief A type synonym for the TemplateOrInstantiation mapping.
329335
typedef llvm::PointerUnion<VarTemplateDecl *, MemberSpecializationInfo *>
@@ -597,6 +603,11 @@ class ASTContext : public RefCountedBase<ASTContext> {
597603
return DiagAllocator;
598604
}
599605

606+
decltype(DeferredDiags) &getDeferredDiags() { return DeferredDiags; }
607+
const decltype(DeferredDiags) &getDeferredDiags() const {
608+
return DeferredDiags;
609+
}
610+
600611
const TargetInfo &getTargetInfo() const { return *Target; }
601612
const TargetInfo *getAuxTargetInfo() const { return AuxTarget; }
602613

clang/include/clang/AST/Decl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,14 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext,
22712271
/// returns 0.
22722272
unsigned getMemoryFunctionKind() const;
22732273

2274+
/// Add a diagnostic to be emitted if and when this function is codegen'ed.
2275+
void addDeferredDiag(PartialDiagnosticAt PD);
2276+
2277+
/// Gets this object's list of deferred diagnostics, if there are any.
2278+
///
2279+
/// Although this is logically const, it clears our list of deferred diags.
2280+
std::vector<PartialDiagnosticAt> takeDeferredDiags() const;
2281+
22742282
// Implement isa/cast/dyncast/etc.
22752283
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
22762284
static bool classofKind(Kind K) {

clang/include/clang/Analysis/CFG.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@ template <> struct simplify_type< ::clang::CFGTerminator> {
999999

10001000
template <> struct GraphTraits< ::clang::CFGBlock *> {
10011001
typedef ::clang::CFGBlock NodeType;
1002+
typedef ::clang::CFGBlock *NodeRef;
10021003
typedef ::clang::CFGBlock::succ_iterator ChildIteratorType;
10031004

10041005
static NodeType* getEntryNode(::clang::CFGBlock *BB)
@@ -1013,6 +1014,7 @@ template <> struct GraphTraits< ::clang::CFGBlock *> {
10131014

10141015
template <> struct GraphTraits< const ::clang::CFGBlock *> {
10151016
typedef const ::clang::CFGBlock NodeType;
1017+
typedef const ::clang::CFGBlock *NodeRef;
10161018
typedef ::clang::CFGBlock::const_succ_iterator ChildIteratorType;
10171019

10181020
static NodeType* getEntryNode(const clang::CFGBlock *BB)
@@ -1027,6 +1029,7 @@ template <> struct GraphTraits< const ::clang::CFGBlock *> {
10271029

10281030
template <> struct GraphTraits<Inverse< ::clang::CFGBlock*> > {
10291031
typedef ::clang::CFGBlock NodeType;
1032+
typedef ::clang::CFGBlock *NodeRef;
10301033
typedef ::clang::CFGBlock::const_pred_iterator ChildIteratorType;
10311034

10321035
static NodeType *getEntryNode(Inverse< ::clang::CFGBlock*> G)
@@ -1041,6 +1044,7 @@ template <> struct GraphTraits<Inverse< ::clang::CFGBlock*> > {
10411044

10421045
template <> struct GraphTraits<Inverse<const ::clang::CFGBlock*> > {
10431046
typedef const ::clang::CFGBlock NodeType;
1047+
typedef const ::clang::CFGBlock *NodeRef;
10441048
typedef ::clang::CFGBlock::const_pred_iterator ChildIteratorType;
10451049

10461050
static NodeType *getEntryNode(Inverse<const ::clang::CFGBlock*> G)

clang/include/clang/Analysis/CallGraph.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ class CallGraphNode {
172172
namespace llvm {
173173
template <> struct GraphTraits<clang::CallGraphNode*> {
174174
typedef clang::CallGraphNode NodeType;
175+
typedef clang::CallGraphNode *NodeRef;
175176
typedef clang::CallGraphNode::CallRecord CallRecordTy;
176177
typedef std::pointer_to_unary_function<CallRecordTy,
177178
clang::CallGraphNode*> CGNDerefFun;
@@ -190,6 +191,7 @@ template <> struct GraphTraits<clang::CallGraphNode*> {
190191

191192
template <> struct GraphTraits<const clang::CallGraphNode*> {
192193
typedef const clang::CallGraphNode NodeType;
194+
typedef const clang::CallGraphNode *NodeRef;
193195
typedef NodeType::const_iterator ChildIteratorType;
194196
static NodeType *getEntryNode(const clang::CallGraphNode *CGN) { return CGN; }
195197
static inline ChildIteratorType child_begin(NodeType *N) { return N->begin();}

clang/include/clang/Basic/BuiltinsX86.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,8 @@ TARGET_BUILTIN(__builtin_ia32_fxsave64, "vv*", "", "fxsr")
644644
// XSAVE
645645
TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "", "xsave")
646646
TARGET_BUILTIN(__builtin_ia32_xsave64, "vv*ULLi", "", "xsave")
647+
TARGET_BUILTIN(__builtin_ia32_xgetbv, "ULLiUi", "", "xsave")
648+
TARGET_BUILTIN(__builtin_ia32_xsetbv, "vUiULLi", "", "xsave")
647649
TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "", "xsave")
648650
TARGET_BUILTIN(__builtin_ia32_xrstor64, "vv*ULLi", "", "xsave")
649651
TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "", "xsaveopt")

clang/include/clang/Sema/Sema.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9222,6 +9222,18 @@ class Sema {
92229222
void maybeAddCUDAHostDeviceAttrs(Scope *S, FunctionDecl *FD,
92239223
const LookupResult &Previous);
92249224

9225+
/// Check whether we're allowed to call Callee from the current context.
9226+
///
9227+
/// If the call is never allowed in a semantically-correct program
9228+
/// (CFP_Never), emits an error and returns false.
9229+
///
9230+
/// If the call is allowed in semantically-correct programs, but only if it's
9231+
/// never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to be
9232+
/// emitted if and when the caller is codegen'ed, and returns true.
9233+
///
9234+
/// Otherwise, returns true without emitting any diagnostics.
9235+
bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee);
9236+
92259237
/// Finds a function in \p Matches with highest calling priority
92269238
/// from \p Caller context and erases all functions with lower
92279239
/// calling priority.

clang/lib/AST/Decl.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3446,6 +3446,20 @@ unsigned FunctionDecl::getMemoryFunctionKind() const {
34463446
return 0;
34473447
}
34483448

3449+
void FunctionDecl::addDeferredDiag(PartialDiagnosticAt PD) {
3450+
getASTContext().getDeferredDiags()[this].push_back(std::move(PD));
3451+
}
3452+
3453+
std::vector<PartialDiagnosticAt> FunctionDecl::takeDeferredDiags() const {
3454+
auto &DD = getASTContext().getDeferredDiags();
3455+
auto It = DD.find(this);
3456+
if (It == DD.end())
3457+
return {};
3458+
auto Ret = std::move(It->second);
3459+
DD.erase(It);
3460+
return Ret;
3461+
}
3462+
34493463
//===----------------------------------------------------------------------===//
34503464
// FieldDecl Implementation
34513465
//===----------------------------------------------------------------------===//

clang/lib/AST/DeclCXX.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,17 @@ void CXXRecordDecl::addedMember(Decl *D) {
807807
data().DefaultedDestructorIsDeleted = true;
808808
}
809809

810+
// For an anonymous union member, our overload resolution will perform
811+
// overload resolution for its members.
812+
if (Field->isAnonymousStructOrUnion()) {
813+
data().NeedOverloadResolutionForMoveConstructor |=
814+
FieldRec->data().NeedOverloadResolutionForMoveConstructor;
815+
data().NeedOverloadResolutionForMoveAssignment |=
816+
FieldRec->data().NeedOverloadResolutionForMoveAssignment;
817+
data().NeedOverloadResolutionForDestructor |=
818+
FieldRec->data().NeedOverloadResolutionForDestructor;
819+
}
820+
810821
// C++0x [class.ctor]p5:
811822
// A default constructor is trivial [...] if:
812823
// -- for all the non-static data members of its class that are of

0 commit comments

Comments
 (0)