forked from OSchip/llvm-project
Fix Clang-tidy modernize-use-nullptr warnings in source directories; other minor cleanups
Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13406 llvm-svn: 249484
This commit is contained in:
parent
7735a6d07a
commit
dcfba33481
|
@ -1,4 +1,4 @@
|
|||
//===- ThreadSafetyCommon.cpp ----------------------------------*- C++ --*-===//
|
||||
//===- ThreadSafetyCommon.cpp -----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -31,6 +31,7 @@
|
|||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <vector>
|
||||
|
||||
using namespace clang;
|
||||
using namespace threadSafety;
|
||||
|
||||
|
@ -66,7 +67,6 @@ static bool isIncompletePhi(const til::SExpr *E) {
|
|||
|
||||
typedef SExprBuilder::CallingContext CallingContext;
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::lookupStmt(const Stmt *S) {
|
||||
auto It = SMap.find(S);
|
||||
if (It != SMap.end())
|
||||
|
@ -74,7 +74,6 @@ til::SExpr *SExprBuilder::lookupStmt(const Stmt *S) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
til::SCFG *SExprBuilder::buildCFG(CFGWalker &Walker) {
|
||||
Walker.walk(*this);
|
||||
return Scfg;
|
||||
|
@ -85,7 +84,6 @@ static bool isCalleeArrow(const Expr *E) {
|
|||
return ME ? ME->isArrow() : false;
|
||||
}
|
||||
|
||||
|
||||
/// \brief Translate a clang expression in an attribute to a til::SExpr.
|
||||
/// Constructs the context from D, DeclExp, and SelfDecl.
|
||||
///
|
||||
|
@ -148,7 +146,6 @@ CapabilityExpr SExprBuilder::translateAttrExpr(const Expr *AttrExp,
|
|||
return translateAttrExpr(AttrExp, &Ctx);
|
||||
}
|
||||
|
||||
|
||||
/// \brief Translate a clang expression in an attribute to a til::SExpr.
|
||||
// This assumes a CallingContext has already been created.
|
||||
CapabilityExpr SExprBuilder::translateAttrExpr(const Expr *AttrExp,
|
||||
|
@ -195,8 +192,6 @@ CapabilityExpr SExprBuilder::translateAttrExpr(const Expr *AttrExp,
|
|||
return CapabilityExpr(E, Neg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Translate a clang statement or expression to a TIL expression.
|
||||
// Also performs substitution of variables; Ctx provides the context.
|
||||
// Dispatches on the type of S.
|
||||
|
@ -268,8 +263,6 @@ til::SExpr *SExprBuilder::translate(const Stmt *S, CallingContext *Ctx) {
|
|||
return new (Arena) til::Undefined(S);
|
||||
}
|
||||
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateDeclRefExpr(const DeclRefExpr *DRE,
|
||||
CallingContext *Ctx) {
|
||||
const ValueDecl *VD = cast<ValueDecl>(DRE->getDecl()->getCanonicalDecl());
|
||||
|
@ -294,7 +287,6 @@ til::SExpr *SExprBuilder::translateDeclRefExpr(const DeclRefExpr *DRE,
|
|||
return new (Arena) til::LiteralPtr(VD);
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateCXXThisExpr(const CXXThisExpr *TE,
|
||||
CallingContext *Ctx) {
|
||||
// Substitute for 'this'
|
||||
|
@ -313,7 +305,7 @@ static const ValueDecl *getValueDeclFromSExpr(const til::SExpr *E) {
|
|||
return P->clangDecl();
|
||||
if (auto *L = dyn_cast<til::LiteralPtr>(E))
|
||||
return L->clangDecl();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool hasCppPointerType(const til::SExpr *E) {
|
||||
|
@ -355,7 +347,6 @@ til::SExpr *SExprBuilder::translateMemberExpr(const MemberExpr *ME,
|
|||
return P;
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateCallExpr(const CallExpr *CE,
|
||||
CallingContext *Ctx,
|
||||
const Expr *SelfE) {
|
||||
|
@ -381,7 +372,6 @@ til::SExpr *SExprBuilder::translateCallExpr(const CallExpr *CE,
|
|||
return new (Arena) til::Call(E, CE);
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateCXXMemberCallExpr(
|
||||
const CXXMemberCallExpr *ME, CallingContext *Ctx) {
|
||||
if (CapabilityExprMode) {
|
||||
|
@ -397,7 +387,6 @@ til::SExpr *SExprBuilder::translateCXXMemberCallExpr(
|
|||
ME->getImplicitObjectArgument());
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateCXXOperatorCallExpr(
|
||||
const CXXOperatorCallExpr *OCE, CallingContext *Ctx) {
|
||||
if (CapabilityExprMode) {
|
||||
|
@ -412,7 +401,6 @@ til::SExpr *SExprBuilder::translateCXXOperatorCallExpr(
|
|||
return translateCallExpr(cast<CallExpr>(OCE), Ctx);
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateUnaryOperator(const UnaryOperator *UO,
|
||||
CallingContext *Ctx) {
|
||||
switch (UO->getOpcode()) {
|
||||
|
@ -462,7 +450,6 @@ til::SExpr *SExprBuilder::translateUnaryOperator(const UnaryOperator *UO,
|
|||
return new (Arena) til::Undefined(UO);
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateBinOp(til::TIL_BinaryOpcode Op,
|
||||
const BinaryOperator *BO,
|
||||
CallingContext *Ctx, bool Reverse) {
|
||||
|
@ -474,7 +461,6 @@ til::SExpr *SExprBuilder::translateBinOp(til::TIL_BinaryOpcode Op,
|
|||
return new (Arena) til::BinaryOp(Op, E0, E1);
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateBinAssign(til::TIL_BinaryOpcode Op,
|
||||
const BinaryOperator *BO,
|
||||
CallingContext *Ctx,
|
||||
|
@ -501,7 +487,6 @@ til::SExpr *SExprBuilder::translateBinAssign(til::TIL_BinaryOpcode Op,
|
|||
return new (Arena) til::Store(E0, E1);
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateBinaryOperator(const BinaryOperator *BO,
|
||||
CallingContext *Ctx) {
|
||||
switch (BO->getOpcode()) {
|
||||
|
@ -547,7 +532,6 @@ til::SExpr *SExprBuilder::translateBinaryOperator(const BinaryOperator *BO,
|
|||
return new (Arena) til::Undefined(BO);
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *SExprBuilder::translateCastExpr(const CastExpr *CE,
|
||||
CallingContext *Ctx) {
|
||||
clang::CastKind K = CE->getCastKind();
|
||||
|
@ -581,7 +565,6 @@ til::SExpr *SExprBuilder::translateCastExpr(const CastExpr *CE,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *
|
||||
SExprBuilder::translateArraySubscriptExpr(const ArraySubscriptExpr *E,
|
||||
CallingContext *Ctx) {
|
||||
|
@ -590,7 +573,6 @@ SExprBuilder::translateArraySubscriptExpr(const ArraySubscriptExpr *E,
|
|||
return new (Arena) til::ArrayIndex(E0, E1);
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *
|
||||
SExprBuilder::translateAbstractConditionalOperator(
|
||||
const AbstractConditionalOperator *CO, CallingContext *Ctx) {
|
||||
|
@ -600,7 +582,6 @@ SExprBuilder::translateAbstractConditionalOperator(
|
|||
return new (Arena) til::IfThenElse(C, T, E);
|
||||
}
|
||||
|
||||
|
||||
til::SExpr *
|
||||
SExprBuilder::translateDeclStmt(const DeclStmt *S, CallingContext *Ctx) {
|
||||
DeclGroupRef DGrp = S->getDeclGroup();
|
||||
|
@ -622,8 +603,6 @@ SExprBuilder::translateDeclStmt(const DeclStmt *S, CallingContext *Ctx) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// If (E) is non-trivial, then add it to the current basic block, and
|
||||
// update the statement map so that S refers to E. Returns a new variable
|
||||
// that refers to E.
|
||||
|
@ -640,7 +619,6 @@ til::SExpr *SExprBuilder::addStatement(til::SExpr* E, const Stmt *S,
|
|||
return E;
|
||||
}
|
||||
|
||||
|
||||
// Returns the current value of VD, if known, and nullptr otherwise.
|
||||
til::SExpr *SExprBuilder::lookupVarDecl(const ValueDecl *VD) {
|
||||
auto It = LVarIdxMap.find(VD);
|
||||
|
@ -651,7 +629,6 @@ til::SExpr *SExprBuilder::lookupVarDecl(const ValueDecl *VD) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
// if E is a til::Variable, update its clangDecl.
|
||||
static void maybeUpdateVD(til::SExpr *E, const ValueDecl *VD) {
|
||||
if (!E)
|
||||
|
@ -671,7 +648,6 @@ til::SExpr *SExprBuilder::addVarDecl(const ValueDecl *VD, til::SExpr *E) {
|
|||
return E;
|
||||
}
|
||||
|
||||
|
||||
// Updates a current variable declaration. (E.g. by assignment)
|
||||
til::SExpr *SExprBuilder::updateVarDecl(const ValueDecl *VD, til::SExpr *E) {
|
||||
maybeUpdateVD(E, VD);
|
||||
|
@ -686,7 +662,6 @@ til::SExpr *SExprBuilder::updateVarDecl(const ValueDecl *VD, til::SExpr *E) {
|
|||
return E;
|
||||
}
|
||||
|
||||
|
||||
// Make a Phi node in the current block for the i^th variable in CurrentVarMap.
|
||||
// If E != null, sets Phi[CurrentBlockInfo->ArgIndex] = E.
|
||||
// If E == null, this is a backedge and will be set later.
|
||||
|
@ -729,7 +704,6 @@ void SExprBuilder::makePhiNodeVar(unsigned i, unsigned NPreds, til::SExpr *E) {
|
|||
CurrentLVarMap.elem(i).second = Ph;
|
||||
}
|
||||
|
||||
|
||||
// Merge values from Map into the current variable map.
|
||||
// This will construct Phi nodes in the current basic block as necessary.
|
||||
void SExprBuilder::mergeEntryMap(LVarDefinitionMap Map) {
|
||||
|
@ -764,7 +738,6 @@ void SExprBuilder::mergeEntryMap(LVarDefinitionMap Map) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Merge a back edge into the current variable map.
|
||||
// This will create phi nodes for all variables in the variable map.
|
||||
void SExprBuilder::mergeEntryMapBackEdge() {
|
||||
|
@ -791,7 +764,6 @@ void SExprBuilder::mergeEntryMapBackEdge() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Update the phi nodes that were initially created for a back edge
|
||||
// once the variable definitions have been computed.
|
||||
// I.e., merge the current variable map into the phi nodes for Blk.
|
||||
|
@ -844,7 +816,6 @@ void SExprBuilder::enterCFG(CFG *Cfg, const NamedDecl *D,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::enterCFGBlock(const CFGBlock *B) {
|
||||
// Intialize TIL basic block and add it to the CFG.
|
||||
CurrentBB = lookupBlock(B);
|
||||
|
@ -858,7 +829,6 @@ void SExprBuilder::enterCFGBlock(const CFGBlock *B) {
|
|||
// assert(!CurrentLVarMap.valid() && "CurrentLVarMap already initialized.");
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::handlePredecessor(const CFGBlock *Pred) {
|
||||
// Compute CurrentLVarMap on entry from ExitMaps of predecessors
|
||||
|
||||
|
@ -874,12 +844,10 @@ void SExprBuilder::handlePredecessor(const CFGBlock *Pred) {
|
|||
++CurrentBlockInfo->ProcessedPredecessors;
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::handlePredecessorBackEdge(const CFGBlock *Pred) {
|
||||
mergeEntryMapBackEdge();
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::enterCFGBlockBody(const CFGBlock *B) {
|
||||
// The merge*() methods have created arguments.
|
||||
// Push those arguments onto the basic block.
|
||||
|
@ -889,13 +857,11 @@ void SExprBuilder::enterCFGBlockBody(const CFGBlock *B) {
|
|||
CurrentBB->addArgument(A);
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::handleStatement(const Stmt *S) {
|
||||
til::SExpr *E = translate(S, nullptr);
|
||||
addStatement(E, S);
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::handleDestructorCall(const VarDecl *VD,
|
||||
const CXXDestructorDecl *DD) {
|
||||
til::SExpr *Sf = new (Arena) til::LiteralPtr(VD);
|
||||
|
@ -905,8 +871,6 @@ void SExprBuilder::handleDestructorCall(const VarDecl *VD,
|
|||
addStatement(E, nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SExprBuilder::exitCFGBlockBody(const CFGBlock *B) {
|
||||
CurrentBB->instructions().reserve(
|
||||
static_cast<unsigned>(CurrentInstructions.size()), Arena);
|
||||
|
@ -934,18 +898,15 @@ void SExprBuilder::exitCFGBlockBody(const CFGBlock *B) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::handleSuccessor(const CFGBlock *Succ) {
|
||||
++CurrentBlockInfo->UnprocessedSuccessors;
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::handleSuccessorBackEdge(const CFGBlock *Succ) {
|
||||
mergePhiNodesBackEdge(Succ);
|
||||
++BBInfo[Succ->getBlockID()].ProcessedPredecessors;
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::exitCFGBlock(const CFGBlock *B) {
|
||||
CurrentArguments.clear();
|
||||
CurrentInstructions.clear();
|
||||
|
@ -954,7 +915,6 @@ void SExprBuilder::exitCFGBlock(const CFGBlock *B) {
|
|||
CurrentBlockInfo = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void SExprBuilder::exitCFG(const CFGBlock *Last) {
|
||||
for (auto *Ph : IncompleteArgs) {
|
||||
if (Ph->status() == til::Phi::PH_Incomplete)
|
||||
|
@ -966,7 +926,6 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
|
|||
IncompleteArgs.clear();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void printSCFG(CFGWalker &Walker) {
|
||||
llvm::BumpPtrAllocator Bpa;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- CGBlocks.cpp - Emit LLVM Code for declarations -------------------===//
|
||||
//===--- CGBlocks.cpp - Emit LLVM Code for declarations ---------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -78,7 +78,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM,
|
|||
ASTContext &C = CGM.getContext();
|
||||
|
||||
llvm::Type *ulong = CGM.getTypes().ConvertType(C.UnsignedLongTy);
|
||||
llvm::Type *i8p = NULL;
|
||||
llvm::Type *i8p = nullptr;
|
||||
if (CGM.getLangOpts().OpenCL)
|
||||
i8p =
|
||||
llvm::Type::getInt8PtrTy(
|
||||
|
@ -232,7 +232,7 @@ namespace {
|
|||
|
||||
return getPrefOrder(left) < getPrefOrder(right);
|
||||
}
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
/// Determines if the given type is safe for constant capture in C++.
|
||||
static bool isSafeForCXXConstantCapture(QualType type) {
|
||||
|
@ -943,7 +943,6 @@ llvm::Type *CodeGenModule::getGenericBlockLiteralType() {
|
|||
return GenericBlockLiteralType;
|
||||
}
|
||||
|
||||
|
||||
RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr *E,
|
||||
ReturnValueSlot ReturnValue) {
|
||||
const BlockPointerType *BPT =
|
||||
|
@ -1305,7 +1304,6 @@ CodeGenFunction::GenerateBlockFunction(GlobalDecl GD,
|
|||
}
|
||||
*/
|
||||
|
||||
|
||||
/// Generate the copy-helper function for a block closure object:
|
||||
/// static void block_copy_helper(block_t *dst, block_t *src);
|
||||
/// The runtime will have previously initialized 'dst' by doing a
|
||||
|
@ -2252,7 +2250,7 @@ namespace {
|
|||
CGF.BuildBlockRelease(Addr, BLOCK_FIELD_IS_BYREF);
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
/// Enter a cleanup to destroy a __block variable. Note that this
|
||||
/// cleanup should be a no-op if the variable hasn't left the stack
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- CGClass.cpp - Emit LLVM Code for C++ classes ---------------------===//
|
||||
//===--- CGClass.cpp - Emit LLVM Code for C++ classes -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -508,7 +508,7 @@ namespace {
|
|||
// external code might potentially access the vtable.
|
||||
void VisitCXXThisExpr(const CXXThisExpr *E) { UsesThis = true; }
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
static bool BaseInitializerUsesThis(ASTContext &C, const Expr *Init) {
|
||||
DynamicThisUseChecker Checker(C);
|
||||
|
@ -930,7 +930,7 @@ void CodeGenFunction::EmitConstructorBody(FunctionArgList &Args) {
|
|||
return;
|
||||
}
|
||||
|
||||
const FunctionDecl *Definition = 0;
|
||||
const FunctionDecl *Definition = nullptr;
|
||||
Stmt *Body = Ctor->getBody(Definition);
|
||||
assert(Definition == Ctor && "emitting wrong constructor body");
|
||||
|
||||
|
@ -987,7 +987,7 @@ namespace {
|
|||
SanitizerSet OldSanOpts;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
class FieldMemcpyizer {
|
||||
public:
|
||||
|
@ -1342,8 +1342,7 @@ namespace {
|
|||
emitAggregatedStmts();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
static bool isInitializerOfDynamicClass(const CXXCtorInitializer *BaseInit) {
|
||||
const Type *BaseType = BaseInit->getBaseClass();
|
||||
|
@ -1802,7 +1801,7 @@ namespace {
|
|||
EmitSanitizerDtorCallback(CGF, VTablePtr, PoisonSize);
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
/// \brief Emit all code that comes at the end of class's
|
||||
/// destructor. This is to call destructors on members and base classes
|
||||
|
@ -1941,7 +1940,6 @@ void CodeGenFunction::EmitCXXAggrConstructorCall(const CXXConstructorDecl *ctor,
|
|||
Address arrayBase,
|
||||
const CXXConstructExpr *E,
|
||||
bool zeroInitialize) {
|
||||
|
||||
// It's legal for numElements to be zero. This can happen both
|
||||
// dynamically, because x can be zero in 'new A[x]', and statically,
|
||||
// because of GCC extensions that permit zero-length arrays. There
|
||||
|
@ -2240,7 +2238,7 @@ namespace {
|
|||
/*Delegating=*/true, Addr);
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
void
|
||||
CodeGenFunction::EmitDelegatingCXXConstructorCall(const CXXConstructorDecl *Ctor,
|
||||
|
@ -2520,7 +2518,7 @@ void CodeGenFunction::EmitVTablePtrCheckForCast(QualType T,
|
|||
if (!SanOpts.has(SanitizerKind::CFICastStrict))
|
||||
ClassDecl = LeastDerivedClassWithSameLayout(ClassDecl);
|
||||
|
||||
llvm::BasicBlock *ContBlock = 0;
|
||||
llvm::BasicBlock *ContBlock = nullptr;
|
||||
|
||||
if (MayBeNull) {
|
||||
llvm::Value *DerivedNotNull =
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- CGException.cpp - Emit LLVM Code for C++ exceptions --------------===//
|
||||
//===--- CGException.cpp - Emit LLVM Code for C++ exceptions ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -346,7 +346,7 @@ namespace {
|
|||
CGF.EmitNounwindRuntimeCall(getFreeExceptionFn(CGF.CGM), exn);
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
// Emits an exception expression into the given location. This
|
||||
// differs from EmitAnyExprToMem only in that, if a final copy-ctor
|
||||
|
@ -1191,7 +1191,7 @@ namespace {
|
|||
CGF.EnsureInsertPoint();
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
/// Enters a finally block for an implementation using zero-cost
|
||||
/// exceptions. This is mostly general, but hard-codes some
|
||||
|
@ -1313,7 +1313,7 @@ llvm::BasicBlock *CodeGenFunction::getTerminateLandingPad() {
|
|||
llvm::StructType::get(Int8PtrTy, Int32Ty, nullptr), 0);
|
||||
LPadInst->addClause(getCatchAllValue(*this));
|
||||
|
||||
llvm::Value *Exn = 0;
|
||||
llvm::Value *Exn = nullptr;
|
||||
if (getLangOpts().CPlusPlus)
|
||||
Exn = Builder.CreateExtractValue(LPadInst, 0);
|
||||
llvm::CallInst *terminateCall =
|
||||
|
@ -1341,7 +1341,7 @@ llvm::BasicBlock *CodeGenFunction::getTerminateHandler() {
|
|||
EHPersonality::get(*this).isMSVCPersonality()) {
|
||||
Builder.CreateTerminatePad(/*UnwindBB=*/nullptr, CGM.getTerminateFn());
|
||||
} else {
|
||||
llvm::Value *Exn = 0;
|
||||
llvm::Value *Exn = nullptr;
|
||||
if (getLangOpts().CPlusPlus)
|
||||
Exn = getExceptionFromSlot();
|
||||
llvm::CallInst *terminateCall =
|
||||
|
@ -1465,7 +1465,7 @@ struct PerformSEHFinally final : EHScopeStack::Cleanup {
|
|||
CleanupEndBB);
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
namespace {
|
||||
/// Find all local variable captures in the statement.
|
||||
|
@ -1524,7 +1524,7 @@ struct CaptureFinder : ConstStmtVisitor<CaptureFinder> {
|
|||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
Address CodeGenFunction::recoverAddrOfEscapedLocal(
|
||||
CodeGenFunction &ParentCGF, Address ParentVar, llvm::Value *ParentFP) {
|
||||
|
|
|
@ -970,7 +970,6 @@ protected:
|
|||
|
||||
llvm::Constant *getBitmapBlockLayout(bool ComputeByrefLayout);
|
||||
|
||||
|
||||
/// GetIvarLayoutName - Returns a unique constant for the given
|
||||
/// ivar layout bitmap.
|
||||
llvm::Constant *GetIvarLayoutName(IdentifierInfo *Ident,
|
||||
|
@ -6718,7 +6717,7 @@ llvm::Value *CGObjCNonFragileABIMac::EmitClassRef(CodeGenFunction &CGF,
|
|||
llvm::Value *CGObjCNonFragileABIMac::EmitNSAutoreleasePoolClassRef(
|
||||
CodeGenFunction &CGF) {
|
||||
IdentifierInfo *II = &CGM.getContext().Idents.get("NSAutoreleasePool");
|
||||
return EmitClassRefFromId(CGF, II, false, 0);
|
||||
return EmitClassRefFromId(CGF, II, false, nullptr);
|
||||
}
|
||||
|
||||
llvm::Value *
|
||||
|
|
|
@ -604,7 +604,7 @@ struct ComputeRegionCounts : public ConstStmtVisitor<ComputeRegionCounts> {
|
|||
RecordNextStmtCount = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
void PGOHash::combine(HashType Type) {
|
||||
// Check that we never combine 0 and only have six bits.
|
||||
|
@ -763,7 +763,7 @@ CodeGenPGO::applyFunctionAttributes(llvm::IndexedInstrProfReader *PGOReader,
|
|||
return;
|
||||
|
||||
uint64_t MaxFunctionCount = PGOReader->getMaximumFunctionCount();
|
||||
uint64_t FunctionCount = getRegionCount(0);
|
||||
uint64_t FunctionCount = getRegionCount(nullptr);
|
||||
if (FunctionCount >= (uint64_t)(0.3 * (double)MaxFunctionCount))
|
||||
// Turn on InlineHint attribute for hot functions.
|
||||
// FIXME: 30% is from preliminary tuning on SPEC, it may not be optimal.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- ToolChains.cpp - ToolChain Implementations -----------------------===//
|
||||
//===--- ToolChains.cpp - ToolChain Implementations -------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -142,7 +142,7 @@ StringRef MachO::getMachOArchName(const ArgList &Args) const {
|
|||
return "arm64";
|
||||
|
||||
case llvm::Triple::thumb:
|
||||
case llvm::Triple::arm: {
|
||||
case llvm::Triple::arm:
|
||||
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
|
||||
if (const char *Arch = ArmMachOArchName(A->getValue()))
|
||||
return Arch;
|
||||
|
@ -153,7 +153,6 @@ StringRef MachO::getMachOArchName(const ArgList &Args) const {
|
|||
|
||||
return "arm";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Darwin::~Darwin() {}
|
||||
|
@ -572,7 +571,7 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
|
|||
CmdArgs.push_back("-lc++");
|
||||
break;
|
||||
|
||||
case ToolChain::CST_Libstdcxx: {
|
||||
case ToolChain::CST_Libstdcxx:
|
||||
// Unfortunately, -lstdc++ doesn't always exist in the standard search path;
|
||||
// it was previously found in the gcc lib dir. However, for all the Darwin
|
||||
// platforms we care about it was -lstdc++.6, so we search for that
|
||||
|
@ -606,7 +605,6 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
|
|||
CmdArgs.push_back("-lstdc++");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DarwinClang::AddCCKextLibArgs(const ArgList &Args,
|
||||
|
@ -1464,7 +1462,6 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
|
|||
LibDirs.append(begin(SystemZLibDirs), end(SystemZLibDirs));
|
||||
TripleAliases.append(begin(SystemZTriples), end(SystemZTriples));
|
||||
break;
|
||||
|
||||
default:
|
||||
// By default, just rely on the standard lib directories and the original
|
||||
// triple.
|
||||
|
@ -2217,7 +2214,7 @@ const char *HexagonToolChain::GetSmallDataThreshold(const ArgList &Args) {
|
|||
if (A)
|
||||
return "0";
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool HexagonToolChain::UsesG0(const char *smallDataThreshold) {
|
||||
|
@ -2436,34 +2433,30 @@ NaClToolChain::NaClToolChain(const Driver &D, const llvm::Triple &Triple,
|
|||
std::string ToolPath(getDriver().ResourceDir + "/lib/");
|
||||
|
||||
switch (Triple.getArch()) {
|
||||
case llvm::Triple::x86: {
|
||||
case llvm::Triple::x86:
|
||||
file_paths.push_back(FilePath + "x86_64-nacl/lib32");
|
||||
file_paths.push_back(FilePath + "i686-nacl/usr/lib");
|
||||
prog_paths.push_back(ProgPath + "x86_64-nacl/bin");
|
||||
file_paths.push_back(ToolPath + "i686-nacl");
|
||||
break;
|
||||
}
|
||||
case llvm::Triple::x86_64: {
|
||||
case llvm::Triple::x86_64:
|
||||
file_paths.push_back(FilePath + "x86_64-nacl/lib");
|
||||
file_paths.push_back(FilePath + "x86_64-nacl/usr/lib");
|
||||
prog_paths.push_back(ProgPath + "x86_64-nacl/bin");
|
||||
file_paths.push_back(ToolPath + "x86_64-nacl");
|
||||
break;
|
||||
}
|
||||
case llvm::Triple::arm: {
|
||||
case llvm::Triple::arm:
|
||||
file_paths.push_back(FilePath + "arm-nacl/lib");
|
||||
file_paths.push_back(FilePath + "arm-nacl/usr/lib");
|
||||
prog_paths.push_back(ProgPath + "arm-nacl/bin");
|
||||
file_paths.push_back(ToolPath + "arm-nacl");
|
||||
break;
|
||||
}
|
||||
case llvm::Triple::mipsel: {
|
||||
case llvm::Triple::mipsel:
|
||||
file_paths.push_back(FilePath + "mipsel-nacl/lib");
|
||||
file_paths.push_back(FilePath + "mipsel-nacl/usr/lib");
|
||||
prog_paths.push_back(ProgPath + "bin");
|
||||
file_paths.push_back(ToolPath + "mipsel-nacl");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- ASTUnit.cpp - ASTUnit utility ------------------------------------===//
|
||||
//===--- ASTUnit.cpp - ASTUnit utility --------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -47,6 +47,7 @@
|
|||
#include <atomic>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace clang;
|
||||
|
||||
using llvm::TimeRecord;
|
||||
|
@ -973,7 +974,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
std::unique_ptr<ASTConsumer>
|
||||
PrecompilePreambleAction::CreateASTConsumer(CompilerInstance &CI,
|
||||
|
@ -2120,7 +2121,7 @@ namespace {
|
|||
return Next.getCodeCompletionTUInfo();
|
||||
}
|
||||
};
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
/// \brief Helper function that computes which global names are hidden by the
|
||||
/// local code-completion results.
|
||||
|
@ -2206,7 +2207,6 @@ static void CalculateHiddenNames(const CodeCompletionContext &Context,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S,
|
||||
CodeCompletionContext Context,
|
||||
CodeCompletionResult *Results,
|
||||
|
@ -2840,9 +2840,9 @@ void ASTUnit::ConcurrencyState::finish() {
|
|||
|
||||
#else // NDEBUG
|
||||
|
||||
ASTUnit::ConcurrencyState::ConcurrencyState() { Mutex = 0; }
|
||||
ASTUnit::ConcurrencyState::ConcurrencyState() { Mutex = nullptr; }
|
||||
ASTUnit::ConcurrencyState::~ConcurrencyState() {}
|
||||
void ASTUnit::ConcurrencyState::start() {}
|
||||
void ASTUnit::ConcurrencyState::finish() {}
|
||||
|
||||
#endif
|
||||
#endif // NDEBUG
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- ParseDecl.cpp - Declaration Parsing ------------------------------===//
|
||||
//===--- ParseDecl.cpp - Declaration Parsing --------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
|
||||
using namespace clang;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -67,7 +68,6 @@ TypeResult Parser::ParseTypeName(SourceRange *Range,
|
|||
return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
|
||||
}
|
||||
|
||||
|
||||
/// isAttributeLateParsed - Return true if the attribute has arguments that
|
||||
/// require late parsing.
|
||||
static bool isAttributeLateParsed(const IdentifierInfo &II) {
|
||||
|
@ -1153,7 +1153,6 @@ void Parser::ParseLexedAttributes(ParsingClass &Class) {
|
|||
Class.TagOrTemplate);
|
||||
}
|
||||
|
||||
|
||||
/// \brief Parse all attributes in LAs, and attach them to Decl D.
|
||||
void Parser::ParseLexedAttributeList(LateParsedAttrList &LAs, Decl *D,
|
||||
bool EnterScope, bool OnDefinition) {
|
||||
|
@ -1168,7 +1167,6 @@ void Parser::ParseLexedAttributeList(LateParsedAttrList &LAs, Decl *D,
|
|||
LAs.clear();
|
||||
}
|
||||
|
||||
|
||||
/// \brief Finish parsing an attribute for which parsing was delayed.
|
||||
/// This will be called at the end of parsing a class declaration
|
||||
/// for each LateParsedAttribute. We consume the saved tokens and
|
||||
|
@ -2201,7 +2199,6 @@ static bool isValidAfterIdentifierInDeclarator(const Token &T) {
|
|||
tok::colon);
|
||||
}
|
||||
|
||||
|
||||
/// ParseImplicitInt - This method is called when we have an non-typename
|
||||
/// identifier in a declspec (which normally terminates the decl spec) when
|
||||
/// the declspec has no type specifier. In this case, the declspec is either
|
||||
|
@ -2619,8 +2616,6 @@ Parser::DiagnoseMissingSemiAfterTagDefinition(DeclSpec &DS, AccessSpecifier AS,
|
|||
/// [OpenCL] '__kernel'
|
||||
/// 'friend': [C++ dcl.friend]
|
||||
/// 'constexpr': [C++0x dcl.constexpr]
|
||||
|
||||
///
|
||||
void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||
const ParsedTemplateInfo &TemplateInfo,
|
||||
AccessSpecifier AS,
|
||||
|
@ -4833,7 +4828,6 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, unsigned AttrReqs,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// ParseDeclarator - Parse and verify a newly-initialized declarator.
|
||||
///
|
||||
void Parser::ParseDeclarator(Declarator &D) {
|
||||
|
@ -5481,7 +5475,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D,
|
|||
SmallVector<ParsedType, 2> DynamicExceptions;
|
||||
SmallVector<SourceRange, 2> DynamicExceptionRanges;
|
||||
ExprResult NoexceptExpr;
|
||||
CachedTokens *ExceptionSpecTokens = 0;
|
||||
CachedTokens *ExceptionSpecTokens = nullptr;
|
||||
ParsedAttributes FnAttrs(AttrFactory);
|
||||
TypeResult TrailingReturnType;
|
||||
|
||||
|
@ -6238,7 +6232,6 @@ void Parser::ParseAtomicSpecifier(DeclSpec &DS) {
|
|||
Diag(StartLoc, DiagID) << PrevSpec;
|
||||
}
|
||||
|
||||
|
||||
/// TryAltiVecVectorTokenOutOfLine - Out of line body that should only be called
|
||||
/// from TryAltiVecVectorToken.
|
||||
bool Parser::TryAltiVecVectorTokenOutOfLine() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- ParseDeclCXX.cpp - C++ Declaration Parsing -----------------------===//
|
||||
//===--- ParseDeclCXX.cpp - C++ Declaration Parsing -------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -26,6 +26,7 @@
|
|||
#include "clang/Sema/Scope.h"
|
||||
#include "clang/Sema/SemaDiagnostic.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
|
||||
using namespace clang;
|
||||
|
||||
/// ParseNamespace - We know that the current token is a namespace keyword. This
|
||||
|
@ -118,7 +119,6 @@ Decl *Parser::ParseNamespace(unsigned Context,
|
|||
return ParseNamespaceAlias(NamespaceLoc, IdentLoc, Ident, DeclEnd);
|
||||
}
|
||||
|
||||
|
||||
BalancedDelimiterTracker T(*this, tok::l_brace);
|
||||
if (T.consumeOpen()) {
|
||||
if (Ident)
|
||||
|
@ -1968,7 +1968,7 @@ void Parser::HandleMemberFunctionDeclDelays(Declarator& DeclaratorInfo,
|
|||
|
||||
// Stash the exception-specification tokens in the late-pased method.
|
||||
LateMethod->ExceptionSpecTokens = FTI.ExceptionSpecTokens;
|
||||
FTI.ExceptionSpecTokens = 0;
|
||||
FTI.ExceptionSpecTokens = nullptr;
|
||||
|
||||
// Push tokens for each parameter. Those that do not have
|
||||
// defaults will be NULL.
|
||||
|
@ -3319,7 +3319,7 @@ Parser::tryParseExceptionSpecification(bool Delayed,
|
|||
ExprResult &NoexceptExpr,
|
||||
CachedTokens *&ExceptionSpecTokens) {
|
||||
ExceptionSpecificationType Result = EST_None;
|
||||
ExceptionSpecTokens = 0;
|
||||
ExceptionSpecTokens = nullptr;
|
||||
|
||||
// Handle delayed parsing of exception-specifications.
|
||||
if (Delayed) {
|
||||
|
@ -3336,7 +3336,7 @@ Parser::tryParseExceptionSpecification(bool Delayed,
|
|||
// If this is a bare 'noexcept', we're done.
|
||||
if (IsNoexcept) {
|
||||
Diag(Tok, diag::warn_cxx98_compat_noexcept_decl);
|
||||
NoexceptExpr = 0;
|
||||
NoexceptExpr = nullptr;
|
||||
return EST_BasicNoexcept;
|
||||
}
|
||||
|
||||
|
@ -3617,9 +3617,8 @@ static bool IsBuiltInOrStandardCXX11Attribute(IdentifierInfo *AttrName,
|
|||
case AttributeList::AT_CarriesDependency:
|
||||
case AttributeList::AT_Deprecated:
|
||||
case AttributeList::AT_FallThrough:
|
||||
case AttributeList::AT_CXX11NoReturn: {
|
||||
case AttributeList::AT_CXX11NoReturn:
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
/// CheckUnreachable - Check for unreachable code.
|
||||
static void CheckUnreachable(Sema &S, AnalysisDeclContext &AC) {
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
<< DiagRange << isAlwaysTrue;
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
} // anonymous namespace
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Check for infinite self-recursion in functions
|
||||
|
@ -506,7 +506,7 @@ struct CheckFallThroughDiagnostics {
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
/// CheckFallThroughForFunctionDef - Check that we don't fall off the end of a
|
||||
/// function that should return a value. Check that we don't fall off the end
|
||||
|
@ -614,7 +614,7 @@ public:
|
|||
|
||||
bool doesContainReference() const { return FoundReference; }
|
||||
};
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
static bool SuggestInitializationFixit(Sema &S, const VarDecl *VD) {
|
||||
QualType VariableTy = VD->getType().getCanonicalType();
|
||||
|
@ -850,7 +850,6 @@ static void DiagUninitUse(Sema &S, const VarDecl *VD, const UninitUse &Use,
|
|||
static bool DiagnoseUninitializedUse(Sema &S, const VarDecl *VD,
|
||||
const UninitUse &Use,
|
||||
bool alwaysReportSelfInit = false) {
|
||||
|
||||
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Use.getUser())) {
|
||||
// Inspect the initializer of the variable declaration which is
|
||||
// being referenced prior to its initialization. We emit
|
||||
|
@ -1072,7 +1071,7 @@ namespace {
|
|||
Sema &S;
|
||||
llvm::SmallPtrSet<const CFGBlock *, 16> ReachableBlocks;
|
||||
};
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
|
||||
bool PerFunction) {
|
||||
|
@ -1183,7 +1182,6 @@ static bool isInLoop(const ASTContext &Ctx, const ParentMap &PM,
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
static void diagnoseRepeatedUseOfWeak(Sema &S,
|
||||
const sema::FunctionScopeInfo *CurFn,
|
||||
const Decl *D,
|
||||
|
@ -1426,7 +1424,7 @@ private:
|
|||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
namespace clang {
|
||||
namespace {
|
||||
|
@ -1444,7 +1442,8 @@ struct SortDiagBySourceLocation {
|
|||
return SM.isBeforeInTranslationUnit(left.first.first, right.first.first);
|
||||
}
|
||||
};
|
||||
}}
|
||||
} // anonymous namespace
|
||||
} // namespace clang
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// -Wthread-safety
|
||||
|
@ -1683,7 +1682,6 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
|
|||
Warnings.emplace_back(std::move(Warning), getNotes());
|
||||
}
|
||||
|
||||
|
||||
void handleFunExcludesLock(StringRef Kind, Name FunName, Name LockName,
|
||||
SourceLocation Loc) override {
|
||||
PartialDiagnosticAt Warning(Loc, S.PDiag(diag::warn_fun_excludes_mutex)
|
||||
|
@ -1709,10 +1707,10 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
|
|||
}
|
||||
|
||||
void leaveFunction(const FunctionDecl* FD) override {
|
||||
CurrentFunction = 0;
|
||||
CurrentFunction = nullptr;
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
} // anonymous namespace
|
||||
} // namespace threadSafety
|
||||
} // namespace clang
|
||||
|
||||
|
@ -1805,7 +1803,9 @@ public:
|
|||
Warnings.emplace_back(std::move(Warning), OptionalNotes());
|
||||
}
|
||||
};
|
||||
}}}
|
||||
} // anonymous namespace
|
||||
} // namespace consumed
|
||||
} // namespace clang
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// AnalysisBasedWarnings - Worker object used by Sema to execute analysis-based
|
||||
|
@ -1971,7 +1971,6 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
|
|||
flushDiagnostics(S, fscope);
|
||||
}
|
||||
|
||||
|
||||
// Warning: check missing 'return'
|
||||
if (P.enableCheckFallThrough) {
|
||||
const CheckFallThroughDiagnostics &CD =
|
||||
|
|
|
@ -449,7 +449,7 @@ class ObjCInterfaceValidatorCCC : public CorrectionCandidateCallback {
|
|||
ObjCInterfaceDecl *CurrentIDecl;
|
||||
};
|
||||
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
static void diagnoseUseOfProtocols(Sema &TheSema,
|
||||
ObjCContainerDecl *CD,
|
||||
|
@ -484,7 +484,7 @@ ActOnSuperClassOfClassInterface(Scope *S,
|
|||
if (TypoCorrection Corrected = CorrectTypo(
|
||||
DeclarationNameInfo(SuperName, SuperLoc),
|
||||
LookupOrdinaryName, TUScope,
|
||||
NULL, llvm::make_unique<ObjCInterfaceValidatorCCC>(IDecl),
|
||||
nullptr, llvm::make_unique<ObjCInterfaceValidatorCCC>(IDecl),
|
||||
CTK_ErrorRecovery)) {
|
||||
diagnoseTypo(Corrected, PDiag(diag::err_undef_superclass_suggest)
|
||||
<< SuperName << ClassName);
|
||||
|
@ -507,7 +507,7 @@ ActOnSuperClassOfClassInterface(Scope *S,
|
|||
SuperClassType = Context.getObjCInterfaceType(SuperClassDecl);
|
||||
}
|
||||
|
||||
if (PrevDecl && SuperClassDecl == 0) {
|
||||
if (PrevDecl && !SuperClassDecl) {
|
||||
// The previous declaration was not a class decl. Check if we have a
|
||||
// typedef. If we do, get the underlying class type.
|
||||
if (const TypedefNameDecl *TDecl =
|
||||
|
@ -548,7 +548,7 @@ ActOnSuperClassOfClassInterface(Scope *S,
|
|||
SuperClassDecl->getDeclName(),
|
||||
ClassName,
|
||||
SourceRange(AtInterfaceLoc, ClassLoc))) {
|
||||
SuperClassDecl = 0;
|
||||
SuperClassDecl = nullptr;
|
||||
SuperClassType = QualType();
|
||||
}
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ namespace {
|
|||
Category,
|
||||
Extension
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
/// Check consistency between two Objective-C type parameter lists, e.g.,
|
||||
/// between a category/extension and an \@interface or between an \@class and an
|
||||
|
@ -1500,8 +1500,8 @@ void Sema::actOnObjCTypeArgsOrProtocolQualifiers(
|
|||
SourceLocation(),
|
||||
SourceLocation(),
|
||||
SourceLocation()),
|
||||
parsedAttrs,
|
||||
starLoc);
|
||||
parsedAttrs,
|
||||
starLoc);
|
||||
|
||||
// Diagnose the missing '*'.
|
||||
Diag(loc, diag::err_objc_type_arg_missing_star)
|
||||
|
@ -3724,7 +3724,6 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef<Decl *> allMethods,
|
|||
return ClassDecl;
|
||||
}
|
||||
|
||||
|
||||
/// CvtQTToAstBitMask - utility routine to produce an AST bitmask for
|
||||
/// objective-c's type qualifier from the parser version of the same info.
|
||||
static Decl::ObjCDeclQualifier
|
||||
|
@ -3891,7 +3890,6 @@ private:
|
|||
search(Interface);
|
||||
}
|
||||
|
||||
|
||||
void search(const ObjCProtocolList &protocols) {
|
||||
for (ObjCProtocolList::iterator i = protocols.begin(), e = protocols.end();
|
||||
i != e; ++i)
|
||||
|
@ -3919,7 +3917,7 @@ private:
|
|||
searchFromContainer(container);
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
void Sema::CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
|
||||
ObjCInterfaceDecl *CurrentClass,
|
||||
|
@ -4514,7 +4512,6 @@ void Sema::DiagnoseUseOfUnimplementedSelectors() {
|
|||
if (!LookupImplementedMethodInGlobalPool(Sel))
|
||||
Diag(Loc, diag::warn_unimplemented_selector) << Sel;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ObjCIvarDecl *
|
||||
|
@ -4577,7 +4574,7 @@ namespace {
|
|||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
void Sema::DiagnoseUnusedBackingIvarInAccessor(Scope *S,
|
||||
const ObjCImplementationDecl *ImplD) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--------------------- SemaLookup.cpp - Name Lookup ------------------===//
|
||||
//===--------------------- SemaLookup.cpp - Name Lookup --------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -11,6 +11,7 @@
|
|||
// Objective-C++.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Sema/Lookup.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/ASTMutationListener.h"
|
||||
|
@ -204,7 +205,7 @@ namespace {
|
|||
UnqualUsingEntry::Comparator()));
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
// Retrieve the set of identifier namespaces that correspond to a
|
||||
// specific kind of name lookup.
|
||||
|
@ -967,7 +968,7 @@ struct FindLocalExternScope {
|
|||
LookupResult &R;
|
||||
bool OldFindLocalExtern;
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
bool Sema::CppLookupName(LookupResult &R, Scope *S) {
|
||||
assert(getLangOpts().CPlusPlus && "Can perform only C++ lookup");
|
||||
|
@ -2234,7 +2235,7 @@ namespace {
|
|||
Sema::AssociatedClassSet &Classes;
|
||||
SourceLocation InstantiationLoc;
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
static void
|
||||
addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType T);
|
||||
|
@ -3920,7 +3921,8 @@ void TypoCorrectionConsumer::performQualifiedLookups() {
|
|||
// current correction candidate is the name of that class, then skip
|
||||
// it as it is unlikely a qualified version of the class' constructor
|
||||
// is an appropriate correction.
|
||||
if (CXXRecordDecl *NSDecl = NSType ? NSType->getAsCXXRecordDecl() : 0) {
|
||||
if (CXXRecordDecl *NSDecl = NSType ? NSType->getAsCXXRecordDecl() :
|
||||
nullptr) {
|
||||
if (NSDecl->getIdentifier() == QR.getCorrectionAsIdentifierInfo())
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "clang/Sema/Sema.h"
|
||||
#include "clang/Sema/SemaDiagnostic.h"
|
||||
#include "llvm/Support/SaveAndRestore.h"
|
||||
|
||||
using namespace clang;
|
||||
using namespace clang::serialization;
|
||||
|
||||
|
@ -160,7 +161,7 @@ namespace clang {
|
|||
public:
|
||||
FindExistingResult(ASTReader &Reader)
|
||||
: Reader(Reader), New(nullptr), Existing(nullptr), AddResult(false),
|
||||
AnonymousDeclNumber(0), TypedefNameForLinkage(0) {}
|
||||
AnonymousDeclNumber(0), TypedefNameForLinkage(nullptr) {}
|
||||
|
||||
FindExistingResult(ASTReader &Reader, NamedDecl *New, NamedDecl *Existing,
|
||||
unsigned AnonymousDeclNumber,
|
||||
|
@ -370,7 +371,7 @@ namespace clang {
|
|||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end namespace clang
|
||||
|
||||
namespace {
|
||||
/// Iterator over the redeclarations of a declaration that have already
|
||||
|
@ -406,7 +407,8 @@ public:
|
|||
return A.Current != B.Current;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
template<typename DeclT>
|
||||
llvm::iterator_range<MergedRedeclIterator<DeclT>> merged_redecls(DeclT *D) {
|
||||
return llvm::iterator_range<MergedRedeclIterator<DeclT>>(
|
||||
|
@ -1095,7 +1097,6 @@ void ASTDeclReader::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
|
|||
D->IvarInitializers = Reader.ReadCXXCtorInitializersRef(F, Record, Idx);
|
||||
}
|
||||
|
||||
|
||||
void ASTDeclReader::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
|
||||
VisitDecl(D);
|
||||
D->setAtLoc(ReadSourceLocation(Record, Idx));
|
||||
|
@ -1295,7 +1296,6 @@ void ASTDeclReader::VisitLabelDecl(LabelDecl *D) {
|
|||
D->setLocStart(ReadSourceLocation(Record, Idx));
|
||||
}
|
||||
|
||||
|
||||
void ASTDeclReader::VisitNamespaceDecl(NamespaceDecl *D) {
|
||||
RedeclarableResult Redecl = VisitRedeclarable(D);
|
||||
VisitNamedDecl(D);
|
||||
|
@ -2741,12 +2741,12 @@ static NamedDecl *getDeclForMerging(NamedDecl *Found,
|
|||
// declaration, then we want that inner declaration. Declarations from
|
||||
// AST files are handled via ImportedTypedefNamesForLinkage.
|
||||
if (Found->isFromASTFile())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if (auto *TND = dyn_cast<TypedefNameDecl>(Found))
|
||||
return TND->getAnonDeclWithTypedefName();
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NamedDecl *ASTDeclReader::getAnonymousDeclForMerging(ASTReader &Reader,
|
||||
|
@ -2916,6 +2916,7 @@ void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader,
|
|||
D->RedeclLink.setPrevious(cast<DeclT>(Previous));
|
||||
D->First = cast<DeclT>(Previous)->First;
|
||||
}
|
||||
|
||||
namespace clang {
|
||||
template<>
|
||||
void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader,
|
||||
|
@ -2961,7 +2962,8 @@ void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader,
|
|||
std::make_pair(Canon, IsUnresolved ? PrevFD : FD));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end namespace clang
|
||||
|
||||
void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader, ...) {
|
||||
llvm_unreachable("attachPreviousDecl on non-redeclarable declaration");
|
||||
}
|
||||
|
@ -3539,7 +3541,7 @@ namespace {
|
|||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
void ASTReader::loadObjCCategories(serialization::GlobalDeclID ID,
|
||||
ObjCInterfaceDecl *D,
|
||||
|
|
|
@ -234,6 +234,7 @@ public:
|
|||
return RefVal(getKind(), getObjKind(), getCount(), getAutoreleaseCount(),
|
||||
getType(), IvarAccessHistory::AccessedDirectly);
|
||||
}
|
||||
|
||||
RefVal releaseViaIvar() const {
|
||||
assert(getIvarAccessHistory() == IvarAccessHistory::AccessedDirectly);
|
||||
return RefVal(getKind(), getObjKind(), getCount(), getAutoreleaseCount(),
|
||||
|
@ -484,7 +485,7 @@ public:
|
|||
IdentifierInfo *getIdentifier() const { return II; }
|
||||
Selector getSelector() const { return S; }
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
namespace llvm {
|
||||
template <> struct DenseMapInfo<ObjCSummaryKey> {
|
||||
|
@ -985,7 +986,6 @@ void RetainSummaryManager::updateSummaryForCall(const RetainSummary *&S,
|
|||
ModifiableSummaryTemplate->setRetEffect(RetEffect::MakeNoRet());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2414,7 +2414,7 @@ CFRefLeakReport::CFRefLeakReport(CFRefBug &D, const LangOptions &LOpts,
|
|||
// FIXME: This will crash the analyzer if an allocation comes from an
|
||||
// implicit call (ex: a destructor call).
|
||||
// (Currently there are no such allocations in Cocoa, though.)
|
||||
const Stmt *AllocStmt = 0;
|
||||
const Stmt *AllocStmt = nullptr;
|
||||
ProgramPoint P = AllocNode->getLocation();
|
||||
if (Optional<CallExitEnd> Exit = P.getAs<CallExitEnd>())
|
||||
AllocStmt = Exit->getCalleeContext()->getCallSite();
|
||||
|
@ -3129,7 +3129,6 @@ void RetainCountChecker::checkSummary(const RetainSummary &Summ,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
ProgramStateRef
|
||||
RetainCountChecker::updateSymbol(ProgramStateRef state, SymbolRef sym,
|
||||
RefVal V, ArgEffect E, RefVal::Kind &hasErr,
|
||||
|
@ -3531,7 +3530,7 @@ void RetainCountChecker::checkReturnWithRetEffect(const ReturnStmt *S,
|
|||
ExplodedNode *Pred,
|
||||
RetEffect RE, RefVal X,
|
||||
SymbolRef Sym,
|
||||
ProgramStateRef state) const {
|
||||
ProgramStateRef state) const {
|
||||
// HACK: Ignore retain-count issues on values accessed through ivars,
|
||||
// because of cases like this:
|
||||
// [_contentView retain];
|
||||
|
@ -3669,7 +3668,6 @@ void RetainCountChecker::checkBind(SVal loc, SVal val, const Stmt *S,
|
|||
ProgramStateRef RetainCountChecker::evalAssume(ProgramStateRef state,
|
||||
SVal Cond,
|
||||
bool Assumption) const {
|
||||
|
||||
// FIXME: We may add to the interface of evalAssume the list of symbols
|
||||
// whose assumptions have changed. For now we just iterate through the
|
||||
// bindings and check if any of the tracked symbols are NULL. This isn't
|
||||
|
@ -3993,7 +3991,9 @@ void ento::registerRetainCountChecker(CheckerManager &Mgr) {
|
|||
// Implementation of the CallEffects API.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace clang { namespace ento { namespace objc_retain {
|
||||
namespace clang {
|
||||
namespace ento {
|
||||
namespace objc_retain {
|
||||
|
||||
// This is a bit gross, but it allows us to populate CallEffects without
|
||||
// creating a bunch of accessors. This kind is very localized, so the
|
||||
|
@ -4022,4 +4022,6 @@ CallEffects CallEffects::getEffect(const FunctionDecl *FD) {
|
|||
|
||||
#undef createCallEffect
|
||||
|
||||
}}}
|
||||
} // end namespace objc_retain
|
||||
} // end namespace ento
|
||||
} // end namespace clang
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "llvm/Bitcode/BitstreamReader.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
|
||||
using namespace clang;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -56,7 +57,7 @@ public:
|
|||
return mem;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Cleanup.
|
||||
|
@ -246,7 +247,7 @@ public:
|
|||
|
||||
CXDiagnosticSet load(const char *file);
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
CXDiagnosticSet DiagLoader::load(const char *file) {
|
||||
TopDiags = llvm::make_unique<CXLoadedDiagnosticSetImpl>();
|
||||
|
@ -264,7 +265,7 @@ CXDiagnosticSet DiagLoader::load(const char *file) {
|
|||
reportInvalidFile(EC.message());
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return (CXDiagnosticSet)TopDiags.release();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <map>
|
||||
|
||||
using namespace clang;
|
||||
using namespace llvm;
|
||||
using llvm::sys::fs::UniqueID;
|
||||
|
@ -285,7 +286,7 @@ struct ScopedDir {
|
|||
}
|
||||
operator StringRef() { return Path.str(); }
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
TEST(VirtualFileSystemTest, BasicRealFSIteration) {
|
||||
ScopedDir TestDirectory("virtual-file-system-test", /*Unique*/true);
|
||||
|
@ -1006,7 +1007,7 @@ TEST_F(VFSFromYAMLTest, DirectoryIteration) {
|
|||
"]\n"
|
||||
"}",
|
||||
Lower);
|
||||
ASSERT_TRUE(FS.get() != NULL);
|
||||
ASSERT_TRUE(FS.get() != nullptr);
|
||||
|
||||
IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(
|
||||
new vfs::OverlayFileSystem(Lower));
|
||||
|
|
|
@ -67,7 +67,7 @@ TEST(BufferSourceTest, EmitCXXGlobalInitFunc) {
|
|||
compiler.getCodeGenOpts(),
|
||||
llvm::getGlobalContext())));
|
||||
|
||||
compiler.createSema(clang::TU_Prefix,NULL);
|
||||
compiler.createSema(clang::TU_Prefix, nullptr);
|
||||
|
||||
clang::SourceManager &sm = compiler.getSourceManager();
|
||||
sm.setMainFileID(sm.createFileID(
|
||||
|
@ -76,4 +76,4 @@ TEST(BufferSourceTest, EmitCXXGlobalInitFunc) {
|
|||
clang::ParseAST(compiler.getSema(), false, false);
|
||||
}
|
||||
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
const std::string &nameSpace() const { return NS; }
|
||||
bool knownToGCC() const { return K; }
|
||||
};
|
||||
} // namespace
|
||||
} // end anonymous namespace
|
||||
|
||||
static std::vector<FlattenedSpelling>
|
||||
GetFlattenedSpellings(const Record &Attr) {
|
||||
|
@ -176,7 +176,7 @@ namespace {
|
|||
upperName[0] = std::toupper(upperName[0]);
|
||||
}
|
||||
}
|
||||
virtual ~Argument() {}
|
||||
virtual ~Argument() = default;
|
||||
|
||||
StringRef getLowerName() const { return lowerName; }
|
||||
StringRef getUpperName() const { return upperName; }
|
||||
|
@ -1018,7 +1018,7 @@ namespace {
|
|||
getType(), "SA->get" + std::string(getUpperName()) + "Loc()");
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
static std::unique_ptr<Argument>
|
||||
createArgument(const Record &Arg, StringRef Attr,
|
||||
|
@ -1950,7 +1950,7 @@ static void GenerateHasAttrSpellingStringSwitch(
|
|||
if (Attr->isSubClassOf("TargetSpecificAttr")) {
|
||||
const Record *R = Attr->getValueAsDef("Target");
|
||||
std::vector<std::string> Arches = R->getValueAsListOfStrings("Arches");
|
||||
GenerateTargetSpecificAttrChecks(R, Arches, Test, 0);
|
||||
GenerateTargetSpecificAttrChecks(R, Arches, Test, nullptr);
|
||||
|
||||
// If this is the C++11 variety, also add in the LangOpts test.
|
||||
if (Variety == "CXX11")
|
||||
|
@ -2363,6 +2363,7 @@ static std::string GetSubjectWithSuffix(const Record *R) {
|
|||
return "Decl";
|
||||
return B + "Decl";
|
||||
}
|
||||
|
||||
static std::string GenerateCustomAppertainsTo(const Record &Subject,
|
||||
raw_ostream &OS) {
|
||||
std::string FnName = "is" + Subject.getName();
|
||||
|
|
Loading…
Reference in New Issue