Integration from OS repo (#2541)
Includes OS PR #2130654: C++17 readiness: Enable /std:c++17 globally: Fixes for C2039 Errors
This commit is contained in:
Родитель
244670ec9e
Коммит
4391420da4
|
@ -35,7 +35,9 @@ namespace llvm {
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
template<class Ty>
|
template<class Ty>
|
||||||
struct identity : public std::unary_function<Ty, Ty> {
|
struct identity {
|
||||||
|
using argument_type = Ty;
|
||||||
|
|
||||||
Ty &operator()(Ty &self) const {
|
Ty &operator()(Ty &self) const {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -45,14 +47,14 @@ struct identity : public std::unary_function<Ty, Ty> {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Ty>
|
template<class Ty>
|
||||||
struct less_ptr : public std::binary_function<Ty, Ty, bool> {
|
struct less_ptr {
|
||||||
bool operator()(const Ty* left, const Ty* right) const {
|
bool operator()(const Ty* left, const Ty* right) const {
|
||||||
return *left < *right;
|
return *left < *right;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Ty>
|
template<class Ty>
|
||||||
struct greater_ptr : public std::binary_function<Ty, Ty, bool> {
|
struct greater_ptr {
|
||||||
bool operator()(const Ty* left, const Ty* right) const {
|
bool operator()(const Ty* left, const Ty* right) const {
|
||||||
return *right < *left;
|
return *right < *left;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +120,8 @@ public:
|
||||||
iterator_category;
|
iterator_category;
|
||||||
typedef typename std::iterator_traits<RootIt>::difference_type
|
typedef typename std::iterator_traits<RootIt>::difference_type
|
||||||
difference_type;
|
difference_type;
|
||||||
typedef typename UnaryFunc::result_type value_type;
|
typedef decltype(std::declval<UnaryFunc>()(*std::declval<RootIt>()))
|
||||||
|
value_type;
|
||||||
|
|
||||||
typedef void pointer;
|
typedef void pointer;
|
||||||
//typedef typename UnaryFunc::result_type *pointer;
|
//typedef typename UnaryFunc::result_type *pointer;
|
||||||
|
|
|
@ -75,7 +75,7 @@ class CallGraphNode;
|
||||||
class CallGraph {
|
class CallGraph {
|
||||||
Module &M;
|
Module &M;
|
||||||
|
|
||||||
typedef std::map<const Function *, CallGraphNode *> FunctionMapTy;
|
typedef std::map<const Function *, std::unique_ptr<CallGraphNode>> FunctionMapTy;
|
||||||
|
|
||||||
/// \brief A map from \c Function* to \c CallGraphNode*.
|
/// \brief A map from \c Function* to \c CallGraphNode*.
|
||||||
FunctionMapTy FunctionMap;
|
FunctionMapTy FunctionMap;
|
||||||
|
@ -90,7 +90,7 @@ class CallGraph {
|
||||||
|
|
||||||
/// \brief This node has edges to it from all functions making indirect calls
|
/// \brief This node has edges to it from all functions making indirect calls
|
||||||
/// or calling an external function.
|
/// or calling an external function.
|
||||||
CallGraphNode *CallsExternalNode;
|
std::unique_ptr<CallGraphNode> CallsExternalNode;
|
||||||
|
|
||||||
/// \brief Replace the function represented by this node by another.
|
/// \brief Replace the function represented by this node by another.
|
||||||
///
|
///
|
||||||
|
@ -105,7 +105,8 @@ class CallGraph {
|
||||||
|
|
||||||
void reset(); // HLSL Change
|
void reset(); // HLSL Change
|
||||||
public:
|
public:
|
||||||
CallGraph(Module &M);
|
explicit CallGraph(Module &M);
|
||||||
|
CallGraph(CallGraph &&Arg);
|
||||||
~CallGraph();
|
~CallGraph();
|
||||||
|
|
||||||
void print(raw_ostream &OS) const;
|
void print(raw_ostream &OS) const;
|
||||||
|
@ -126,21 +127,21 @@ public:
|
||||||
inline const CallGraphNode *operator[](const Function *F) const {
|
inline const CallGraphNode *operator[](const Function *F) const {
|
||||||
const_iterator I = FunctionMap.find(F);
|
const_iterator I = FunctionMap.find(F);
|
||||||
assert(I != FunctionMap.end() && "Function not in callgraph!");
|
assert(I != FunctionMap.end() && "Function not in callgraph!");
|
||||||
return I->second;
|
return I->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Returns the call graph node for the provided function.
|
/// \brief Returns the call graph node for the provided function.
|
||||||
inline CallGraphNode *operator[](const Function *F) {
|
inline CallGraphNode *operator[](const Function *F) {
|
||||||
const_iterator I = FunctionMap.find(F);
|
const_iterator I = FunctionMap.find(F);
|
||||||
assert(I != FunctionMap.end() && "Function not in callgraph!");
|
assert(I != FunctionMap.end() && "Function not in callgraph!");
|
||||||
return I->second;
|
return I->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Returns the \c CallGraphNode which is used to represent
|
/// \brief Returns the \c CallGraphNode which is used to represent
|
||||||
/// undetermined calls into the callgraph.
|
/// undetermined calls into the callgraph.
|
||||||
CallGraphNode *getExternalCallingNode() const { return ExternalCallingNode; }
|
CallGraphNode *getExternalCallingNode() const { return ExternalCallingNode; }
|
||||||
|
|
||||||
CallGraphNode *getCallsExternalNode() const { return CallsExternalNode; }
|
CallGraphNode *getCallsExternalNode() const { return CallsExternalNode.get(); }
|
||||||
|
|
||||||
//===---------------------------------------------------------------------
|
//===---------------------------------------------------------------------
|
||||||
// Functions to keep a call graph up to date with a function that has been
|
// Functions to keep a call graph up to date with a function that has been
|
||||||
|
@ -401,43 +402,39 @@ template <> struct GraphTraits<CallGraphNode *> {
|
||||||
typedef CallGraphNode NodeType;
|
typedef CallGraphNode NodeType;
|
||||||
|
|
||||||
typedef CallGraphNode::CallRecord CGNPairTy;
|
typedef CallGraphNode::CallRecord CGNPairTy;
|
||||||
typedef std::pointer_to_unary_function<CGNPairTy, CallGraphNode *>
|
|
||||||
CGNDerefFun;
|
|
||||||
|
|
||||||
static NodeType *getEntryNode(CallGraphNode *CGN) { return CGN; }
|
static NodeType *getEntryNode(CallGraphNode *CGN) { return CGN; }
|
||||||
|
|
||||||
typedef mapped_iterator<NodeType::iterator, CGNDerefFun> ChildIteratorType;
|
static CallGraphNode *CGNGetValue(CGNPairTy P) { return P.second; }
|
||||||
|
typedef mapped_iterator<NodeType::iterator, decltype(&CGNGetValue)> ChildIteratorType;
|
||||||
|
|
||||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||||
return map_iterator(N->begin(), CGNDerefFun(CGNDeref));
|
return ChildIteratorType(N->begin(), &CGNGetValue);
|
||||||
}
|
}
|
||||||
static inline ChildIteratorType child_end(NodeType *N) {
|
static inline ChildIteratorType child_end(NodeType *N) {
|
||||||
return map_iterator(N->end(), CGNDerefFun(CGNDeref));
|
return ChildIteratorType(N->end(), &CGNGetValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CallGraphNode *CGNDeref(CGNPairTy P) { return P.second; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct GraphTraits<const CallGraphNode *> {
|
template <> struct GraphTraits<const CallGraphNode *> {
|
||||||
typedef const CallGraphNode NodeType;
|
typedef const CallGraphNode NodeType;
|
||||||
|
|
||||||
typedef CallGraphNode::CallRecord CGNPairTy;
|
typedef CallGraphNode::CallRecord CGNPairTy;
|
||||||
typedef std::pointer_to_unary_function<CGNPairTy, const CallGraphNode *>
|
|
||||||
CGNDerefFun;
|
|
||||||
|
|
||||||
static NodeType *getEntryNode(const CallGraphNode *CGN) { return CGN; }
|
static NodeType *getEntryNode(const CallGraphNode *CGN) { return CGN; }
|
||||||
|
|
||||||
typedef mapped_iterator<NodeType::const_iterator, CGNDerefFun>
|
static const CallGraphNode *CGNGetValue(CGNPairTy P) { return P.second; }
|
||||||
|
|
||||||
|
typedef mapped_iterator<NodeType::const_iterator, decltype(&CGNGetValue)>
|
||||||
ChildIteratorType;
|
ChildIteratorType;
|
||||||
|
|
||||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||||
return map_iterator(N->begin(), CGNDerefFun(CGNDeref));
|
return ChildIteratorType(N->begin(), &CGNGetValue);
|
||||||
}
|
}
|
||||||
static inline ChildIteratorType child_end(NodeType *N) {
|
static inline ChildIteratorType child_end(NodeType *N) {
|
||||||
return map_iterator(N->end(), CGNDerefFun(CGNDeref));
|
return ChildIteratorType(N->end(), &CGNGetValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const CallGraphNode *CGNDeref(CGNPairTy P) { return P.second; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -445,19 +442,21 @@ struct GraphTraits<CallGraph *> : public GraphTraits<CallGraphNode *> {
|
||||||
static NodeType *getEntryNode(CallGraph *CGN) {
|
static NodeType *getEntryNode(CallGraph *CGN) {
|
||||||
return CGN->getExternalCallingNode(); // Start at the external node!
|
return CGN->getExternalCallingNode(); // Start at the external node!
|
||||||
}
|
}
|
||||||
typedef std::pair<const Function *, CallGraphNode *> PairTy;
|
typedef std::pair<const Function *const, std::unique_ptr<CallGraphNode>>
|
||||||
typedef std::pointer_to_unary_function<PairTy, CallGraphNode &> DerefFun;
|
PairTy;
|
||||||
|
|
||||||
|
static CallGraphNode *CGGetValuePtr(const PairTy &P) {
|
||||||
|
return P.second.get();
|
||||||
|
}
|
||||||
|
|
||||||
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
|
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
|
||||||
typedef mapped_iterator<CallGraph::iterator, DerefFun> nodes_iterator;
|
typedef mapped_iterator<CallGraph::iterator, decltype(&CGGetValuePtr)> nodes_iterator;
|
||||||
static nodes_iterator nodes_begin(CallGraph *CG) {
|
static nodes_iterator nodes_begin(CallGraph *CG) {
|
||||||
return map_iterator(CG->begin(), DerefFun(CGdereference));
|
return nodes_iterator(CG->begin(), &CGGetValuePtr);
|
||||||
}
|
}
|
||||||
static nodes_iterator nodes_end(CallGraph *CG) {
|
static nodes_iterator nodes_end(CallGraph *CG) {
|
||||||
return map_iterator(CG->end(), DerefFun(CGdereference));
|
return nodes_iterator(CG->end(), &CGGetValuePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CallGraphNode &CGdereference(PairTy P) { return *P.second; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -466,20 +465,22 @@ struct GraphTraits<const CallGraph *> : public GraphTraits<
|
||||||
static NodeType *getEntryNode(const CallGraph *CGN) {
|
static NodeType *getEntryNode(const CallGraph *CGN) {
|
||||||
return CGN->getExternalCallingNode(); // Start at the external node!
|
return CGN->getExternalCallingNode(); // Start at the external node!
|
||||||
}
|
}
|
||||||
typedef std::pair<const Function *, const CallGraphNode *> PairTy;
|
typedef std::pair<const Function *const, std::unique_ptr<CallGraphNode>>
|
||||||
typedef std::pointer_to_unary_function<PairTy, const CallGraphNode &>
|
PairTy;
|
||||||
DerefFun;
|
|
||||||
|
static const CallGraphNode *CGGetValuePtr(const PairTy &P) {
|
||||||
|
return P.second.get();
|
||||||
|
}
|
||||||
|
|
||||||
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
|
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
|
||||||
typedef mapped_iterator<CallGraph::const_iterator, DerefFun> nodes_iterator;
|
typedef mapped_iterator<CallGraph::const_iterator, decltype(&CGGetValuePtr)>
|
||||||
|
nodes_iterator;
|
||||||
static nodes_iterator nodes_begin(const CallGraph *CG) {
|
static nodes_iterator nodes_begin(const CallGraph *CG) {
|
||||||
return map_iterator(CG->begin(), DerefFun(CGdereference));
|
return nodes_iterator(CG->begin(), &CGGetValuePtr);
|
||||||
}
|
}
|
||||||
static nodes_iterator nodes_end(const CallGraph *CG) {
|
static nodes_iterator nodes_end(const CallGraph *CG) {
|
||||||
return map_iterator(CG->end(), DerefFun(CGdereference));
|
return nodes_iterator(CG->end(), &CGGetValuePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const CallGraphNode &CGdereference(PairTy P) { return *P.second; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
|
@ -714,8 +714,7 @@ private:
|
||||||
raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
|
raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
|
||||||
|
|
||||||
// This is useful when building IndexedMaps keyed on basic block pointers.
|
// This is useful when building IndexedMaps keyed on basic block pointers.
|
||||||
struct MBB2NumberFunctor :
|
struct MBB2NumberFunctor {
|
||||||
public std::unary_function<const MachineBasicBlock*, unsigned> {
|
|
||||||
unsigned operator()(const MachineBasicBlock *MBB) const {
|
unsigned operator()(const MachineBasicBlock *MBB) const {
|
||||||
return MBB->getNumber();
|
return MBB->getNumber();
|
||||||
}
|
}
|
||||||
|
|
|
@ -930,7 +930,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is useful when building IndexedMaps keyed on virtual registers
|
// This is useful when building IndexedMaps keyed on virtual registers
|
||||||
struct VirtReg2IndexFunctor : public std::unary_function<unsigned, unsigned> {
|
struct VirtReg2IndexFunctor {
|
||||||
unsigned operator()(unsigned Reg) const {
|
unsigned operator()(unsigned Reg) const {
|
||||||
return TargetRegisterInfo::virtReg2Index(Reg);
|
return TargetRegisterInfo::virtReg2Index(Reg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,90 +22,62 @@ using namespace llvm;
|
||||||
//
|
//
|
||||||
|
|
||||||
CallGraph::CallGraph(Module &M)
|
CallGraph::CallGraph(Module &M)
|
||||||
: M(M), Root(nullptr), ExternalCallingNode(nullptr), // HLSL Change - no allocation here
|
: M(M), ExternalCallingNode(getOrInsertFunction(nullptr)),
|
||||||
CallsExternalNode(nullptr) {
|
CallsExternalNode(llvm::make_unique<CallGraphNode>(nullptr)) {
|
||||||
try { // HLSL change - guard and reset
|
// Add every function to the call graph.
|
||||||
ExternalCallingNode = getOrInsertFunction(nullptr);
|
for (Function &F : M)
|
||||||
CallsExternalNode = new CallGraphNode(nullptr);
|
addToCallGraph(&F);
|
||||||
// Add every function to the call graph.
|
|
||||||
for (Function &F : M)
|
|
||||||
addToCallGraph(&F);
|
|
||||||
|
|
||||||
// If we didn't find a main function, use the external call graph node
|
|
||||||
if (!Root)
|
|
||||||
Root = ExternalCallingNode;
|
|
||||||
} catch (...) {
|
|
||||||
reset();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HLSL Change Starts
|
|
||||||
CallGraph::~CallGraph() { reset(); }
|
|
||||||
void CallGraph::reset() {
|
CallGraph::CallGraph(CallGraph &&Arg)
|
||||||
// This function cleans up the CallGraph, called from the destructor or
|
: M(Arg.M), FunctionMap(std::move(Arg.FunctionMap)),
|
||||||
// an under-construction instance.
|
ExternalCallingNode(Arg.ExternalCallingNode),
|
||||||
// HLSL Change Ends
|
CallsExternalNode(std::move(Arg.CallsExternalNode)) {
|
||||||
|
Arg.FunctionMap.clear();
|
||||||
|
Arg.ExternalCallingNode = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CallGraph::~CallGraph() {
|
||||||
// CallsExternalNode is not in the function map, delete it explicitly.
|
// CallsExternalNode is not in the function map, delete it explicitly.
|
||||||
if (CallsExternalNode) // HLSL Change - guard
|
if (CallsExternalNode)
|
||||||
CallsExternalNode->allReferencesDropped();
|
CallsExternalNode->allReferencesDropped();
|
||||||
delete CallsExternalNode;
|
|
||||||
CallsExternalNode = nullptr;
|
|
||||||
|
|
||||||
// Reset all node's use counts to zero before deleting them to prevent an
|
// Reset all node's use counts to zero before deleting them to prevent an
|
||||||
// assertion from firing.
|
// assertion from firing.
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
for (auto &I : FunctionMap)
|
for (auto &I : FunctionMap)
|
||||||
if (I.second) // HLSL Change - this guard needed when slot is alloc'ed but not populated
|
I.second->allReferencesDropped();
|
||||||
I.second->allReferencesDropped();
|
|
||||||
#endif
|
#endif
|
||||||
for (auto &I : FunctionMap)
|
|
||||||
delete I.second;
|
|
||||||
FunctionMap.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CallGraph::addToCallGraph(Function *F) {
|
void CallGraph::addToCallGraph(Function *F) {
|
||||||
CallGraphNode *Node = getOrInsertFunction(F);
|
CallGraphNode *Node = getOrInsertFunction(F);
|
||||||
|
|
||||||
// If this function has external linkage, anything could call it.
|
// If this function has external linkage or has its address taken, anything
|
||||||
if (!F->hasLocalLinkage()) {
|
// could call it.
|
||||||
ExternalCallingNode->addCalledFunction(CallSite(), Node);
|
if (!F->hasLocalLinkage() || F->hasAddressTaken())
|
||||||
// HLSL Change Begins.
|
|
||||||
if (M.HasHLModule()) {
|
|
||||||
if (M.GetHLModule().GetEntryFunction() == F)
|
|
||||||
Root = Node;
|
|
||||||
} else // Make sure Root not overwrite by main.
|
|
||||||
// HLSL Change Ends.
|
|
||||||
// Found the entry point?
|
|
||||||
if (F->getName() == "main") {
|
|
||||||
if (Root) // Found multiple external mains? Don't pick one.
|
|
||||||
Root = ExternalCallingNode;
|
|
||||||
else
|
|
||||||
Root = Node; // Found a main, keep track of it!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this function has its address taken, anything could call it.
|
|
||||||
if (F->hasAddressTaken())
|
|
||||||
ExternalCallingNode->addCalledFunction(CallSite(), Node);
|
ExternalCallingNode->addCalledFunction(CallSite(), Node);
|
||||||
|
|
||||||
// If this function is not defined in this translation unit, it could call
|
// If this function is not defined in this translation unit, it could call
|
||||||
// anything.
|
// anything.
|
||||||
if (F->isDeclaration() && !F->isIntrinsic())
|
if (F->isDeclaration() && !F->isIntrinsic())
|
||||||
Node->addCalledFunction(CallSite(), CallsExternalNode);
|
Node->addCalledFunction(CallSite(), CallsExternalNode.get());
|
||||||
|
|
||||||
// Look for calls by this function.
|
// Look for calls by this function.
|
||||||
for (Function::iterator BB = F->begin(), BBE = F->end(); BB != BBE; ++BB)
|
for (BasicBlock &BB : *F)
|
||||||
for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE;
|
for (Instruction &I : BB) {
|
||||||
++II) {
|
if (auto CS = CallSite(&I)) {
|
||||||
CallSite CS(cast<Value>(II));
|
|
||||||
if (CS) {
|
|
||||||
const Function *Callee = CS.getCalledFunction();
|
const Function *Callee = CS.getCalledFunction();
|
||||||
if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
|
if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
|
||||||
// Indirect calls of intrinsics are not allowed so no need to check.
|
// Indirect calls of intrinsics are not allowed so no need to check.
|
||||||
// We can be more precise here by using TargetArg returned by
|
// We can be more precise here by using TargetArg returned by
|
||||||
// Intrinsic::isLeaf.
|
// Intrinsic::isLeaf.
|
||||||
Node->addCalledFunction(CS, CallsExternalNode);
|
Node->addCalledFunction(CS, CallsExternalNode.get());
|
||||||
else if (!Callee->isIntrinsic())
|
else if (!Callee->isIntrinsic())
|
||||||
Node->addCalledFunction(CS, getOrInsertFunction(Callee));
|
Node->addCalledFunction(CS, getOrInsertFunction(Callee));
|
||||||
}
|
}
|
||||||
|
@ -113,24 +85,17 @@ void CallGraph::addToCallGraph(Function *F) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallGraph::print(raw_ostream &OS) const {
|
void CallGraph::print(raw_ostream &OS) const {
|
||||||
OS << "CallGraph Root is: ";
|
|
||||||
if (Function *F = Root->getFunction())
|
|
||||||
OS << F->getName() << "\n";
|
|
||||||
else {
|
|
||||||
OS << "<<null function: 0x" << Root << ">>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print in a deterministic order by sorting CallGraphNodes by name. We do
|
// Print in a deterministic order by sorting CallGraphNodes by name. We do
|
||||||
// this here to avoid slowing down the non-printing fast path.
|
// this here to avoid slowing down the non-printing fast path.
|
||||||
|
|
||||||
SmallVector<CallGraphNode *, 16> Nodes;
|
SmallVector<CallGraphNode *, 16> Nodes;
|
||||||
Nodes.reserve(FunctionMap.size());
|
Nodes.reserve(FunctionMap.size());
|
||||||
|
|
||||||
for (auto I = begin(), E = end(); I != E; ++I)
|
for (const auto &I : *this)
|
||||||
Nodes.push_back(I->second);
|
Nodes.push_back(I.second.get());
|
||||||
|
|
||||||
std::sort(Nodes.begin(), Nodes.end(),
|
std::sort(Nodes.begin(), Nodes.end(),
|
||||||
[](CallGraphNode *LHS, CallGraphNode *RHS) {
|
[](CallGraphNode *LHS, CallGraphNode *RHS) {
|
||||||
if (Function *LF = LHS->getFunction())
|
if (Function *LF = LHS->getFunction())
|
||||||
if (Function *RF = RHS->getFunction())
|
if (Function *RF = RHS->getFunction())
|
||||||
return LF->getName() < RF->getName();
|
return LF->getName() < RF->getName();
|
||||||
|
@ -156,7 +121,6 @@ Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN) {
|
||||||
assert(CGN->empty() && "Cannot remove function from call "
|
assert(CGN->empty() && "Cannot remove function from call "
|
||||||
"graph if it references other functions!");
|
"graph if it references other functions!");
|
||||||
Function *F = CGN->getFunction(); // Get the function for the call graph node
|
Function *F = CGN->getFunction(); // Get the function for the call graph node
|
||||||
delete CGN; // Delete the call graph node for this func
|
|
||||||
FunctionMap.erase(F); // Remove the call graph node from the map
|
FunctionMap.erase(F); // Remove the call graph node from the map
|
||||||
|
|
||||||
M.CallRemoveGlobalHook(F); // HLSL Change
|
M.CallRemoveGlobalHook(F); // HLSL Change
|
||||||
|
@ -176,7 +140,7 @@ void CallGraph::spliceFunction(const Function *From, const Function *To) {
|
||||||
"Pointing CallGraphNode at a function that already exists");
|
"Pointing CallGraphNode at a function that already exists");
|
||||||
FunctionMapTy::iterator I = FunctionMap.find(From);
|
FunctionMapTy::iterator I = FunctionMap.find(From);
|
||||||
I->second->F = const_cast<Function*>(To);
|
I->second->F = const_cast<Function*>(To);
|
||||||
FunctionMap[To] = I->second;
|
FunctionMap[To] = std::move(I->second);
|
||||||
FunctionMap.erase(I);
|
FunctionMap.erase(I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,12 +148,13 @@ void CallGraph::spliceFunction(const Function *From, const Function *To) {
|
||||||
// it will insert a new CallGraphNode for the specified function if one does
|
// it will insert a new CallGraphNode for the specified function if one does
|
||||||
// not already exist.
|
// not already exist.
|
||||||
CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) {
|
CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) {
|
||||||
CallGraphNode *&CGN = FunctionMap[F];
|
auto &CGN = FunctionMap[F];
|
||||||
if (CGN)
|
if (CGN)
|
||||||
return CGN;
|
return CGN.get();
|
||||||
|
|
||||||
assert((!F || F->getParent() == &M) && "Function not in current module!");
|
assert((!F || F->getParent() == &M) && "Function not in current module!");
|
||||||
return CGN = new CallGraphNode(const_cast<Function*>(F));
|
CGN = llvm::make_unique<CallGraphNode>(const_cast<Function *>(F));
|
||||||
|
return CGN.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -239,7 +239,7 @@ MSFileSystemForIface::MSFileSystemForIface(IDxcSystemAccess* systemAccess)
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
HRESULT MSFileSystemForIface::AddMappingHandle(IUnknown* mapping, HANDLE* pResult)
|
HRESULT MSFileSystemForIface::AddMappingHandle(IUnknown* mapping, HANDLE* pResult) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(mapping != nullptr);
|
DXASSERT_NOMSG(mapping != nullptr);
|
||||||
DXASSERT_NOMSG(pResult != nullptr);
|
DXASSERT_NOMSG(pResult != nullptr);
|
||||||
|
@ -256,7 +256,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
HRESULT MSFileSystemForIface::AddMappingView(ID3D10Blob* blob)
|
HRESULT MSFileSystemForIface::AddMappingView(ID3D10Blob* blob) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(blob != nullptr);
|
DXASSERT_NOMSG(blob != nullptr);
|
||||||
LPVOID address = blob->GetBufferPointer();
|
LPVOID address = blob->GetBufferPointer();
|
||||||
|
@ -273,7 +273,7 @@ HRESULT MSFileSystemForIface::AddMappingView(ID3D10Blob* blob)
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
HRESULT MSFileSystemForIface::AddFindHandle(IEnumSTATSTG* enumStatStg, HANDLE* pResult)
|
HRESULT MSFileSystemForIface::AddFindHandle(IEnumSTATSTG* enumStatStg, HANDLE* pResult) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(enumStatStg != nullptr);
|
DXASSERT_NOMSG(enumStatStg != nullptr);
|
||||||
DXASSERT_NOMSG(pResult != nullptr);
|
DXASSERT_NOMSG(pResult != nullptr);
|
||||||
|
@ -290,7 +290,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
HRESULT MSFileSystemForIface::AddFileHandle(IUnknown* storage, IStream* stream, HANDLE* pResult)
|
HRESULT MSFileSystemForIface::AddFileHandle(IUnknown* storage, IStream* stream, HANDLE* pResult) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(storage != nullptr);
|
DXASSERT_NOMSG(storage != nullptr);
|
||||||
DXASSERT_NOMSG(pResult != nullptr);
|
DXASSERT_NOMSG(pResult != nullptr);
|
||||||
|
@ -306,7 +306,7 @@ Cleanup:
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSFileSystemForIface::CloseInternalHandle(HANDLE handle)
|
void MSFileSystemForIface::CloseInternalHandle(HANDLE handle) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(handle != nullptr);
|
DXASSERT_NOMSG(handle != nullptr);
|
||||||
DXASSERT_NOMSG(handle != INVALID_HANDLE_VALUE);
|
DXASSERT_NOMSG(handle != INVALID_HANDLE_VALUE);
|
||||||
|
@ -323,7 +323,7 @@ void MSFileSystemForIface::CloseInternalHandle(HANDLE handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
void MSFileSystemForIface::RemoveMappingView(LPCVOID address)
|
void MSFileSystemForIface::RemoveMappingView(LPCVOID address) throw()
|
||||||
{
|
{
|
||||||
TViewMap::iterator i = m_mappingViews.find(address);
|
TViewMap::iterator i = m_mappingViews.find(address);
|
||||||
DXASSERT(i != m_mappingViews.end(), "otherwise pointer to view isn't in map");
|
DXASSERT(i != m_mappingViews.end(), "otherwise pointer to view isn't in map");
|
||||||
|
@ -333,7 +333,7 @@ void MSFileSystemForIface::RemoveMappingView(LPCVOID address)
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
void MSFileSystemForIface::GetFindHandle(HANDLE findHandle, IEnumSTATSTG** enumStatStg)
|
void MSFileSystemForIface::GetFindHandle(HANDLE findHandle, IEnumSTATSTG** enumStatStg) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(findHandle != nullptr);
|
DXASSERT_NOMSG(findHandle != nullptr);
|
||||||
DXASSERT_NOMSG(enumStatStg != nullptr);
|
DXASSERT_NOMSG(enumStatStg != nullptr);
|
||||||
|
@ -347,7 +347,7 @@ void MSFileSystemForIface::GetFindHandle(HANDLE findHandle, IEnumSTATSTG** enumS
|
||||||
(*enumStatStg)->AddRef();
|
(*enumStatStg)->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
int MSFileSystemForIface::GetHandleFD(HANDLE fileHandle)
|
int MSFileSystemForIface::GetHandleFD(HANDLE fileHandle) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(fileHandle != nullptr);
|
DXASSERT_NOMSG(fileHandle != nullptr);
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ int MSFileSystemForIface::GetHandleFD(HANDLE fileHandle)
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
void MSFileSystemForIface::GetHandleMapping(HANDLE mapping, _Outptr_ IUnknown** pResult)
|
void MSFileSystemForIface::GetHandleMapping(HANDLE mapping, _Outptr_ IUnknown** pResult) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(mapping != nullptr);
|
DXASSERT_NOMSG(mapping != nullptr);
|
||||||
DXASSERT_NOMSG(pResult != nullptr);
|
DXASSERT_NOMSG(pResult != nullptr);
|
||||||
|
@ -373,7 +373,7 @@ void MSFileSystemForIface::GetHandleMapping(HANDLE mapping, _Outptr_ IUnknown**
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
void MSFileSystemForIface::GetHandleStorage(HANDLE fileHandle, _Outptr_ IUnknown** pResult)
|
void MSFileSystemForIface::GetHandleStorage(HANDLE fileHandle, _Outptr_ IUnknown** pResult) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(fileHandle != nullptr);
|
DXASSERT_NOMSG(fileHandle != nullptr);
|
||||||
DXASSERT_NOMSG(pResult != nullptr);
|
DXASSERT_NOMSG(pResult != nullptr);
|
||||||
|
@ -388,7 +388,7 @@ void MSFileSystemForIface::GetHandleStorage(HANDLE fileHandle, _Outptr_ IUnknown
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
void MSFileSystemForIface::GetHandleStream(HANDLE fileHandle, _Outptr_ IStream** pResult)
|
void MSFileSystemForIface::GetHandleStream(HANDLE fileHandle, _Outptr_ IStream** pResult) throw()
|
||||||
{
|
{
|
||||||
DXASSERT_NOMSG(fileHandle != nullptr);
|
DXASSERT_NOMSG(fileHandle != nullptr);
|
||||||
DXASSERT_NOMSG(pResult != nullptr);
|
DXASSERT_NOMSG(pResult != nullptr);
|
||||||
|
@ -404,7 +404,7 @@ void MSFileSystemForIface::GetHandleStream(HANDLE fileHandle, _Outptr_ IStream**
|
||||||
|
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
HANDLE MSFileSystemForIface::FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData)
|
HANDLE MSFileSystemForIface::FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IEnumSTATSTG> enumStatStg;
|
CComPtr<IEnumSTATSTG> enumStatStg;
|
||||||
|
@ -441,7 +441,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData)
|
BOOL MSFileSystemForIface::FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IEnumSTATSTG> enumStatStg;
|
CComPtr<IEnumSTATSTG> enumStatStg;
|
||||||
|
@ -475,13 +475,13 @@ Cleanup:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSFileSystemForIface::FindClose(HANDLE findHandle)
|
void MSFileSystemForIface::FindClose(HANDLE findHandle) throw()
|
||||||
{
|
{
|
||||||
CloseInternalHandle(findHandle);
|
CloseInternalHandle(findHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
HANDLE MSFileSystemForIface::CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes)
|
HANDLE MSFileSystemForIface::CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IUnknown> storage;
|
CComPtr<IUnknown> storage;
|
||||||
|
@ -503,7 +503,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::SetFileTime(HANDLE hFile, _In_opt_ const FILETIME *lpCreationTime, _In_opt_ const FILETIME *lpLastAccessTime, _In_opt_ const FILETIME *lpLastWriteTime)
|
BOOL MSFileSystemForIface::SetFileTime(HANDLE hFile, _In_opt_ const FILETIME *lpCreationTime, _In_opt_ const FILETIME *lpLastAccessTime, _In_opt_ const FILETIME *lpLastWriteTime) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IUnknown> storage;
|
CComPtr<IUnknown> storage;
|
||||||
|
@ -522,7 +522,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
|
BOOL MSFileSystemForIface::GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IUnknown> storage;
|
CComPtr<IUnknown> storage;
|
||||||
|
@ -541,7 +541,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
DWORD MSFileSystemForIface::GetFileType(HANDLE hFile)
|
DWORD MSFileSystemForIface::GetFileType(HANDLE hFile) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IUnknown> storage;
|
CComPtr<IUnknown> storage;
|
||||||
|
@ -565,21 +565,21 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::CreateHardLinkW(LPCWSTR lpFileName, LPCWSTR lpExistingFileName)
|
BOOL MSFileSystemForIface::CreateHardLinkW(LPCWSTR lpFileName, LPCWSTR lpExistingFileName) throw()
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::MoveFileExW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags)
|
BOOL MSFileSystemForIface::MoveFileExW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags) throw()
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
DWORD MSFileSystemForIface::GetFileAttributesW(LPCWSTR lpFileName)
|
DWORD MSFileSystemForIface::GetFileAttributesW(LPCWSTR lpFileName) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
DWORD attributes;
|
DWORD attributes;
|
||||||
|
@ -597,35 +597,35 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::CloseHandle(HANDLE hObject)
|
BOOL MSFileSystemForIface::CloseHandle(HANDLE hObject) throw()
|
||||||
{
|
{
|
||||||
this->CloseInternalHandle(hObject);
|
this->CloseInternalHandle(hObject);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::DeleteFileW(LPCWSTR lpFileName)
|
BOOL MSFileSystemForIface::DeleteFileW(LPCWSTR lpFileName) throw()
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::RemoveDirectoryW(LPCWSTR lpFileName)
|
BOOL MSFileSystemForIface::RemoveDirectoryW(LPCWSTR lpFileName) throw()
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::CreateDirectoryW(LPCWSTR lpPathName)
|
BOOL MSFileSystemForIface::CreateDirectoryW(LPCWSTR lpPathName) throw()
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
DWORD MSFileSystemForIface::GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer)
|
DWORD MSFileSystemForIface::GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer) throw()
|
||||||
{
|
{
|
||||||
DWORD written = 0;
|
DWORD written = 0;
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
@ -643,7 +643,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
DWORD MSFileSystemForIface::GetMainModuleFileNameW(LPWSTR lpFilename, DWORD nSize)
|
DWORD MSFileSystemForIface::GetMainModuleFileNameW(LPWSTR lpFilename, DWORD nSize) throw()
|
||||||
{
|
{
|
||||||
DWORD written = 0;
|
DWORD written = 0;
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
@ -661,7 +661,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
DWORD MSFileSystemForIface::GetTempPathW(DWORD nBufferLength, LPWSTR lpBuffer)
|
DWORD MSFileSystemForIface::GetTempPathW(DWORD nBufferLength, LPWSTR lpBuffer) throw()
|
||||||
{
|
{
|
||||||
DWORD written = 0;
|
DWORD written = 0;
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
@ -679,19 +679,19 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOLEAN MSFileSystemForIface::CreateSymbolicLinkW(LPCWSTR lpSymlinkFileName, LPCWSTR lpTargetFileName, DWORD dwFlags)
|
BOOLEAN MSFileSystemForIface::CreateSymbolicLinkW(LPCWSTR lpSymlinkFileName, LPCWSTR lpTargetFileName, DWORD dwFlags) throw()
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
SetLastError(ERROR_FUNCTION_NOT_CALLED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MSFileSystemForIface::SupportsCreateSymbolicLink()
|
bool MSFileSystemForIface::SupportsCreateSymbolicLink() throw()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
BOOL MSFileSystemForIface::ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, _Out_opt_ LPDWORD lpNumberOfBytesRead)
|
BOOL MSFileSystemForIface::ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, _Out_opt_ LPDWORD lpNumberOfBytesRead) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IStream> stream;
|
CComPtr<IStream> stream;
|
||||||
|
@ -714,7 +714,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
HANDLE MSFileSystemForIface::CreateFileMappingW(HANDLE hFile, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow)
|
HANDLE MSFileSystemForIface::CreateFileMappingW(HANDLE hFile, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
HANDLE result = INVALID_HANDLE_VALUE;
|
HANDLE result = INVALID_HANDLE_VALUE;
|
||||||
|
@ -736,7 +736,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
LPVOID MSFileSystemForIface::MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap)
|
LPVOID MSFileSystemForIface::MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IUnknown> mapping;
|
CComPtr<IUnknown> mapping;
|
||||||
|
@ -763,12 +763,12 @@ BOOL MSFileSystemForIface::UnmapViewOfFile(LPCVOID lpBaseAddress) throw()
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MSFileSystemForIface::FileDescriptorIsDisplayed(int fd)
|
bool MSFileSystemForIface::FileDescriptorIsDisplayed(int fd) throw()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned MSFileSystemForIface::GetColumnCount(DWORD nStdHandle)
|
unsigned MSFileSystemForIface::GetColumnCount(DWORD nStdHandle) throw()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -778,16 +778,16 @@ unsigned MSFileSystemForIface::GetConsoleOutputTextAttributes() throw()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSFileSystemForIface::SetConsoleOutputTextAttributes(unsigned attributes)
|
void MSFileSystemForIface::SetConsoleOutputTextAttributes(unsigned attributes) throw()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSFileSystemForIface::ResetConsoleOutputTextAttributes()
|
void MSFileSystemForIface::ResetConsoleOutputTextAttributes() throw()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int MSFileSystemForIface::open_osfhandle(intptr_t osfhandle, int flags)
|
int MSFileSystemForIface::open_osfhandle(intptr_t osfhandle, int flags) throw()
|
||||||
{
|
{
|
||||||
return GetHandleFD((HANDLE)osfhandle);
|
return GetHandleFD((HANDLE)osfhandle);
|
||||||
}
|
}
|
||||||
|
@ -824,7 +824,7 @@ Cleanup:
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE MSFileSystemForIface::GetHandleForFD(int fd)
|
HANDLE MSFileSystemForIface::GetHandleForFD(int fd) throw()
|
||||||
{
|
{
|
||||||
MSFileSystemHandle* ptr;
|
MSFileSystemHandle* ptr;
|
||||||
switch (fd)
|
switch (fd)
|
||||||
|
@ -837,7 +837,7 @@ HANDLE MSFileSystemForIface::GetHandleForFD(int fd)
|
||||||
return ptr->GetHandle();
|
return ptr->GetHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t MSFileSystemForIface::get_osfhandle(int fd) {
|
intptr_t MSFileSystemForIface::get_osfhandle(int fd) throw() {
|
||||||
if (FAILED(EnsureFDAvailable(fd))) {
|
if (FAILED(EnsureFDAvailable(fd))) {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -846,14 +846,14 @@ intptr_t MSFileSystemForIface::get_osfhandle(int fd) {
|
||||||
return (intptr_t)GetHandleForFD(fd);
|
return (intptr_t)GetHandleForFD(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MSFileSystemForIface::close(int fd)
|
int MSFileSystemForIface::close(int fd) throw()
|
||||||
{
|
{
|
||||||
HANDLE h = GetHandleForFD(fd);
|
HANDLE h = GetHandleForFD(fd);
|
||||||
this->CloseInternalHandle(h);
|
this->CloseInternalHandle(h);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long MSFileSystemForIface::lseek(int fd, long offset, int origin)
|
long MSFileSystemForIface::lseek(int fd, long offset, int origin) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IStream> stream;
|
CComPtr<IStream> stream;
|
||||||
|
@ -886,19 +886,19 @@ Cleanup:
|
||||||
return uli.LowPart;
|
return uli.LowPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MSFileSystemForIface::setmode(int fd, int mode)
|
int MSFileSystemForIface::setmode(int fd, int mode) throw()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
errno_t MSFileSystemForIface::resize_file(LPCWSTR path, uint64_t size)
|
errno_t MSFileSystemForIface::resize_file(LPCWSTR path, uint64_t size) throw()
|
||||||
{
|
{
|
||||||
return EBADF;
|
return EBADF;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
int MSFileSystemForIface::Read(int fd, void* buffer, unsigned int count)
|
int MSFileSystemForIface::Read(int fd, void* buffer, unsigned int count) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IStream> stream;
|
CComPtr<IStream> stream;
|
||||||
|
@ -923,7 +923,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
int MSFileSystemForIface::Write(int fd, const void* buffer, unsigned int count)
|
int MSFileSystemForIface::Write(int fd, const void* buffer, unsigned int count) throw()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
CComPtr<IStream> stream;
|
CComPtr<IStream> stream;
|
||||||
|
@ -1140,7 +1140,7 @@ MSFileSystemBlocked::MSFileSystemBlocked()
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
DWORD MSFileSystemBlocked::GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer)
|
DWORD MSFileSystemBlocked::GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer) throw()
|
||||||
{
|
{
|
||||||
if (nBufferLength > 1)
|
if (nBufferLength > 1)
|
||||||
{
|
{
|
||||||
|
@ -1151,14 +1151,14 @@ DWORD MSFileSystemBlocked::GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBu
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
DWORD MSFileSystemBlocked::GetMainModuleFileNameW(LPWSTR lpFilename, DWORD nSize)
|
DWORD MSFileSystemBlocked::GetMainModuleFileNameW(LPWSTR lpFilename, DWORD nSize) throw()
|
||||||
{
|
{
|
||||||
SetLastError(NO_ERROR);
|
SetLastError(NO_ERROR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Use_decl_annotations_
|
_Use_decl_annotations_
|
||||||
DWORD MSFileSystemBlocked::GetTempPathW(DWORD nBufferLength, LPWSTR lpBuffer)
|
DWORD MSFileSystemBlocked::GetTempPathW(DWORD nBufferLength, LPWSTR lpBuffer) throw()
|
||||||
{
|
{
|
||||||
if (nBufferLength > 1)
|
if (nBufferLength > 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -148,7 +148,7 @@ error_code SetCurrentThreadFileSystem(MSFileSystemRef value) throw()
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Support for CRT-like file stream functions.
|
// Support for CRT-like file stream functions.
|
||||||
|
|
||||||
int msf_read(int fd, void* buffer, unsigned int count)
|
int msf_read(int fd, void* buffer, unsigned int count) throw()
|
||||||
{
|
{
|
||||||
MSFileSystemRef fsr = GetCurrentThreadFileSystem();
|
MSFileSystemRef fsr = GetCurrentThreadFileSystem();
|
||||||
if (fsr == nullptr) {
|
if (fsr == nullptr) {
|
||||||
|
@ -158,7 +158,7 @@ int msf_read(int fd, void* buffer, unsigned int count)
|
||||||
return fsr->Read(fd, buffer, count);
|
return fsr->Read(fd, buffer, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
int msf_write(int fd, const void* buffer, unsigned int count)
|
int msf_write(int fd, const void* buffer, unsigned int count) throw()
|
||||||
{
|
{
|
||||||
MSFileSystemRef fsr = GetCurrentThreadFileSystem();
|
MSFileSystemRef fsr = GetCurrentThreadFileSystem();
|
||||||
if (fsr == nullptr) {
|
if (fsr == nullptr) {
|
||||||
|
@ -168,7 +168,7 @@ int msf_write(int fd, const void* buffer, unsigned int count)
|
||||||
return fsr->Write(fd, buffer, count);
|
return fsr->Write(fd, buffer, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
int msf_close(int fd)
|
int msf_close(int fd) throw()
|
||||||
{
|
{
|
||||||
MSFileSystemRef fsr = GetCurrentThreadFileSystem();
|
MSFileSystemRef fsr = GetCurrentThreadFileSystem();
|
||||||
if (fsr == nullptr) {
|
if (fsr == nullptr) {
|
||||||
|
@ -188,7 +188,7 @@ long msf_lseek(int fd, long offset, int origin)
|
||||||
return fsr->lseek(fd, offset, origin);
|
return fsr->lseek(fd, offset, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
int msf_setmode(int fd, int mode)
|
int msf_setmode(int fd, int mode) throw()
|
||||||
{
|
{
|
||||||
MSFileSystemRef fsr = GetCurrentThreadFileSystem();
|
MSFileSystemRef fsr = GetCurrentThreadFileSystem();
|
||||||
if (fsr == nullptr) {
|
if (fsr == nullptr) {
|
||||||
|
|
|
@ -668,8 +668,8 @@ bool Inliner::removeDeadFunctions(CallGraph &CG, bool AlwaysInlineOnly) {
|
||||||
|
|
||||||
// Scan for all of the functions, looking for ones that should now be removed
|
// Scan for all of the functions, looking for ones that should now be removed
|
||||||
// from the program. Insert the dead ones in the FunctionsToRemove set.
|
// from the program. Insert the dead ones in the FunctionsToRemove set.
|
||||||
for (auto I : CG) {
|
for (const auto &I : CG) {
|
||||||
CallGraphNode *CGN = I.second;
|
CallGraphNode *CGN = I.second.get();
|
||||||
Function *F = CGN->getFunction();
|
Function *F = CGN->getFunction();
|
||||||
if (!F || F->isDeclaration())
|
if (!F || F->isDeclaration())
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -619,7 +619,7 @@ static bool BreakUpArrayAllocas(bool AllowOOBIndex, IteratorT ItBegin, IteratorT
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ElementType->isArrayTy()) {
|
if (!ElementType->isArrayTy()) {
|
||||||
std::remove(ScalarAllocas.begin(), ScalarAllocas.end(), nullptr);
|
ScalarAllocas.erase(std::remove(ScalarAllocas.begin(), ScalarAllocas.end(), nullptr), ScalarAllocas.end());
|
||||||
PromoteMemToReg(ScalarAllocas, *DT, nullptr, AC);
|
PromoteMemToReg(ScalarAllocas, *DT, nullptr, AC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
} else {
|
} else {
|
||||||
DeclsTy &Vec = *getAsVector();
|
DeclsTy &Vec = *getAsVector();
|
||||||
Vec.erase(std::remove_if(Vec.begin(), Vec.end(),
|
Vec.erase(std::remove_if(Vec.begin(), Vec.end(),
|
||||||
std::mem_fun(&Decl::isFromASTFile)),
|
std::mem_fn(&Decl::isFromASTFile)),
|
||||||
Vec.end());
|
Vec.end());
|
||||||
// Don't have any external decls any more.
|
// Don't have any external decls any more.
|
||||||
Data = DeclsAndHasExternalTy(&Vec, false);
|
Data = DeclsAndHasExternalTy(&Vec, false);
|
||||||
|
|
|
@ -386,15 +386,17 @@ public:
|
||||||
ArrayRef<SourceLocation> SelLocs = llvm::None);
|
ArrayRef<SourceLocation> SelLocs = llvm::None);
|
||||||
|
|
||||||
// Iterator access to parameter types.
|
// Iterator access to parameter types.
|
||||||
typedef std::const_mem_fun_t<QualType, ParmVarDecl> deref_fun;
|
struct GetTypeFn {
|
||||||
typedef llvm::mapped_iterator<param_const_iterator, deref_fun>
|
QualType operator()(const ParmVarDecl *PD) const { return PD->getType(); }
|
||||||
param_type_iterator;
|
};
|
||||||
|
typedef llvm::mapped_iterator<param_const_iterator, GetTypeFn>
|
||||||
|
param_type_iterator;
|
||||||
|
|
||||||
param_type_iterator param_type_begin() const {
|
param_type_iterator param_type_begin() const {
|
||||||
return llvm::map_iterator(param_begin(), deref_fun(&ParmVarDecl::getType));
|
return llvm::map_iterator(param_begin(), GetTypeFn());
|
||||||
}
|
}
|
||||||
param_type_iterator param_type_end() const {
|
param_type_iterator param_type_end() const {
|
||||||
return llvm::map_iterator(param_end(), deref_fun(&ParmVarDecl::getType));
|
return llvm::map_iterator(param_end(), GetTypeFn());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// createImplicitParams - Used to lazily create the self and cmd
|
/// createImplicitParams - Used to lazily create the self and cmd
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
namespace clang {
|
namespace clang {
|
||||||
|
|
||||||
/// \brief Function object that provides a total ordering on QualType values.
|
/// \brief Function object that provides a total ordering on QualType values.
|
||||||
struct QualTypeOrdering : std::binary_function<QualType, QualType, bool> {
|
struct QualTypeOrdering {
|
||||||
bool operator()(QualType T1, QualType T2) const {
|
bool operator()(QualType T1, QualType T2) const {
|
||||||
return std::less<void*>()(T1.getAsOpaquePtr(), T2.getAsOpaquePtr());
|
return std::less<void*>()(T1.getAsOpaquePtr(), T2.getAsOpaquePtr());
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,19 +173,17 @@ namespace llvm {
|
||||||
template <> struct GraphTraits<clang::CallGraphNode*> {
|
template <> struct GraphTraits<clang::CallGraphNode*> {
|
||||||
typedef clang::CallGraphNode NodeType;
|
typedef clang::CallGraphNode NodeType;
|
||||||
typedef clang::CallGraphNode::CallRecord CallRecordTy;
|
typedef clang::CallGraphNode::CallRecord CallRecordTy;
|
||||||
typedef std::pointer_to_unary_function<CallRecordTy,
|
|
||||||
clang::CallGraphNode*> CGNDerefFun;
|
|
||||||
static NodeType *getEntryNode(clang::CallGraphNode *CGN) { return CGN; }
|
|
||||||
typedef mapped_iterator<NodeType::iterator, CGNDerefFun> ChildIteratorType;
|
|
||||||
static inline ChildIteratorType child_begin(NodeType *N) {
|
|
||||||
return map_iterator(N->begin(), CGNDerefFun(CGNDeref));
|
|
||||||
}
|
|
||||||
static inline ChildIteratorType child_end (NodeType *N) {
|
|
||||||
return map_iterator(N->end(), CGNDerefFun(CGNDeref));
|
|
||||||
}
|
|
||||||
static clang::CallGraphNode *CGNDeref(CallRecordTy P) {
|
static clang::CallGraphNode *CGNDeref(CallRecordTy P) {
|
||||||
return P;
|
return P;
|
||||||
}
|
}
|
||||||
|
static NodeType *getEntryNode(clang::CallGraphNode *CGN) { return CGN; }
|
||||||
|
typedef mapped_iterator<NodeType::iterator, decltype(&CGNDeref)> ChildIteratorType;
|
||||||
|
static inline ChildIteratorType child_begin(NodeType *N) {
|
||||||
|
return ChildIteratorType(N->begin(), &CGNDeref);
|
||||||
|
}
|
||||||
|
static inline ChildIteratorType child_end (NodeType *N) {
|
||||||
|
return ChildIteratorType(N->end(), &CGNDeref);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct GraphTraits<const clang::CallGraphNode*> {
|
template <> struct GraphTraits<const clang::CallGraphNode*> {
|
||||||
|
@ -203,20 +201,21 @@ template <> struct GraphTraits<clang::CallGraph*>
|
||||||
return CGN->getRoot(); // Start at the external node!
|
return CGN->getRoot(); // Start at the external node!
|
||||||
}
|
}
|
||||||
typedef std::pair<const clang::Decl*, clang::CallGraphNode*> PairTy;
|
typedef std::pair<const clang::Decl*, clang::CallGraphNode*> PairTy;
|
||||||
typedef std::pointer_to_unary_function<PairTy, clang::CallGraphNode&> DerefFun;
|
|
||||||
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
|
|
||||||
typedef mapped_iterator<clang::CallGraph::iterator, DerefFun> nodes_iterator;
|
|
||||||
|
|
||||||
static nodes_iterator nodes_begin(clang::CallGraph *CG) {
|
|
||||||
return map_iterator(CG->begin(), DerefFun(CGdereference));
|
|
||||||
}
|
|
||||||
static nodes_iterator nodes_end (clang::CallGraph *CG) {
|
|
||||||
return map_iterator(CG->end(), DerefFun(CGdereference));
|
|
||||||
}
|
|
||||||
static clang::CallGraphNode &CGdereference(PairTy P) {
|
static clang::CallGraphNode &CGdereference(PairTy P) {
|
||||||
return *(P.second);
|
return *(P.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
|
||||||
|
typedef mapped_iterator<clang::CallGraph::iterator, decltype(&CGdereference)> nodes_iterator;
|
||||||
|
|
||||||
|
static nodes_iterator nodes_begin(clang::CallGraph *CG) {
|
||||||
|
return nodes_iterator(CG->begin(), &CGdereference);
|
||||||
|
}
|
||||||
|
static nodes_iterator nodes_end (clang::CallGraph *CG) {
|
||||||
|
return nodes_iterator(CG->end(), &CGdereference);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned size(clang::CallGraph *CG) {
|
static unsigned size(clang::CallGraph *CG) {
|
||||||
return CG->size();
|
return CG->size();
|
||||||
}
|
}
|
||||||
|
@ -228,21 +227,22 @@ template <> struct GraphTraits<const clang::CallGraph*> :
|
||||||
return CGN->getRoot();
|
return CGN->getRoot();
|
||||||
}
|
}
|
||||||
typedef std::pair<const clang::Decl*, clang::CallGraphNode*> PairTy;
|
typedef std::pair<const clang::Decl*, clang::CallGraphNode*> PairTy;
|
||||||
typedef std::pointer_to_unary_function<PairTy, clang::CallGraphNode&> DerefFun;
|
|
||||||
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
|
|
||||||
typedef mapped_iterator<clang::CallGraph::const_iterator,
|
|
||||||
DerefFun> nodes_iterator;
|
|
||||||
|
|
||||||
static nodes_iterator nodes_begin(const clang::CallGraph *CG) {
|
|
||||||
return map_iterator(CG->begin(), DerefFun(CGdereference));
|
|
||||||
}
|
|
||||||
static nodes_iterator nodes_end(const clang::CallGraph *CG) {
|
|
||||||
return map_iterator(CG->end(), DerefFun(CGdereference));
|
|
||||||
}
|
|
||||||
static clang::CallGraphNode &CGdereference(PairTy P) {
|
static clang::CallGraphNode &CGdereference(PairTy P) {
|
||||||
return *(P.second);
|
return *(P.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
|
||||||
|
typedef mapped_iterator<clang::CallGraph::const_iterator,
|
||||||
|
decltype(&CGdereference)> nodes_iterator;
|
||||||
|
|
||||||
|
static nodes_iterator nodes_begin(const clang::CallGraph *CG) {
|
||||||
|
return nodes_iterator(CG->begin(), &CGdereference);
|
||||||
|
}
|
||||||
|
static nodes_iterator nodes_end(const clang::CallGraph *CG) {
|
||||||
|
return nodes_iterator(CG->end(), &CGdereference);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned size(const clang::CallGraph *CG) {
|
static unsigned size(const clang::CallGraph *CG) {
|
||||||
return CG->size();
|
return CG->size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,8 +320,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Comparison function class, useful for sorting FullSourceLocs.
|
/// \brief Comparison function class, useful for sorting FullSourceLocs.
|
||||||
struct BeforeThanCompare : public std::binary_function<FullSourceLoc,
|
struct BeforeThanCompare {
|
||||||
FullSourceLoc, bool> {
|
|
||||||
bool operator()(const FullSourceLoc& lhs, const FullSourceLoc& rhs) const {
|
bool operator()(const FullSourceLoc& lhs, const FullSourceLoc& rhs) const {
|
||||||
return lhs.isBeforeInTranslationUnitThan(rhs);
|
return lhs.isBeforeInTranslationUnitThan(rhs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -702,7 +702,9 @@ void Sema::ActOnEndOfTranslationUnit() {
|
||||||
UnusedFileScopedDecls.erase(
|
UnusedFileScopedDecls.erase(
|
||||||
std::remove_if(UnusedFileScopedDecls.begin(nullptr, true),
|
std::remove_if(UnusedFileScopedDecls.begin(nullptr, true),
|
||||||
UnusedFileScopedDecls.end(),
|
UnusedFileScopedDecls.end(),
|
||||||
std::bind1st(std::ptr_fun(ShouldRemoveFromUnused), this)),
|
[this](const DeclaratorDecl *DD) {
|
||||||
|
return ShouldRemoveFromUnused(this, DD);
|
||||||
|
}),
|
||||||
UnusedFileScopedDecls.end());
|
UnusedFileScopedDecls.end());
|
||||||
|
|
||||||
if (TUKind == TU_Prefix) {
|
if (TUKind == TU_Prefix) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче