3737#include < set>
3838#include < sstream>
3939
40- using namespace llvm ;
4140using namespace clang ;
4241
4342#ifndef NDEBUG
@@ -247,11 +246,11 @@ class MatchDescendantVisitor : public DynamicRecursiveASTVisitor {
247246
248247// Because we're dealing with raw pointers, let's define what we mean by that.
249248static bool hasPointerType (const Expr &E) {
250- return isa<clang:: PointerType>(E.getType ().getCanonicalType ());
249+ return isa<PointerType>(E.getType ().getCanonicalType ());
251250}
252251
253252static bool hasArrayType (const Expr &E) {
254- return isa<clang:: ArrayType>(E.getType ().getCanonicalType ());
253+ return isa<ArrayType>(E.getType ().getCanonicalType ());
255254}
256255
257256static void
@@ -474,7 +473,7 @@ static bool isSafeSpanTwoParamConstruct(const CXXConstructExpr &Node,
474473 auto HaveEqualConstantValues = [&Ctx](const Expr *E0 , const Expr *E1 ) {
475474 if (auto E0CV = E0 ->getIntegerConstantExpr (Ctx))
476475 if (auto E1CV = E1 ->getIntegerConstantExpr (Ctx)) {
477- return APSInt::compareValues (*E0CV, *E1CV) == 0 ;
476+ return llvm:: APSInt::compareValues (*E0CV, *E1CV) == 0 ;
478477 }
479478 return false ;
480479 };
@@ -485,7 +484,7 @@ static bool isSafeSpanTwoParamConstruct(const CXXConstructExpr &Node,
485484 }
486485 return false ;
487486 };
488- std::optional<APSInt> Arg1CV = Arg1->getIntegerConstantExpr (Ctx);
487+ std::optional<llvm:: APSInt> Arg1CV = Arg1->getIntegerConstantExpr (Ctx);
489488
490489 if (Arg1CV && Arg1CV->isZero ())
491490 // Check form 5:
@@ -528,10 +527,10 @@ static bool isSafeSpanTwoParamConstruct(const CXXConstructExpr &Node,
528527 QualType Arg0Ty = Arg0->IgnoreImplicit ()->getType ();
529528
530529 if (auto *ConstArrTy = Ctx.getAsConstantArrayType (Arg0Ty)) {
531- const APSInt ConstArrSize = APSInt (ConstArrTy->getSize ());
530+ const llvm:: APSInt ConstArrSize = llvm:: APSInt (ConstArrTy->getSize ());
532531
533532 // Check form 4:
534- return Arg1CV && APSInt::compareValues (ConstArrSize, *Arg1CV) == 0 ;
533+ return Arg1CV && llvm:: APSInt::compareValues (ConstArrSize, *Arg1CV) == 0 ;
535534 }
536535 // Check form 6:
537536 if (auto CCast = dyn_cast<CStyleCastExpr>(Arg0)) {
@@ -968,8 +967,7 @@ static bool hasUnsafePrintfStringArg(const CallExpr &Node, ASTContext &Ctx,
968967 if (!FirstParmTy->isPointerType ())
969968 return false ; // possibly some user-defined printf function
970969
971- QualType FirstPteTy =
972- FirstParmTy->castAs <clang::PointerType>()->getPointeeType ();
970+ QualType FirstPteTy = FirstParmTy->castAs <PointerType>()->getPointeeType ();
973971
974972 if (!Ctx.getFILEType ()
975973 .isNull () && // `FILE *` must be in the context if it is fprintf
@@ -1053,8 +1051,7 @@ static bool hasUnsafeSnprintfBuffer(const CallExpr &Node,
10531051 if (!FirstParmTy->isPointerType ())
10541052 return false ; // Not an snprint
10551053
1056- QualType FirstPteTy =
1057- FirstParmTy->castAs <clang::PointerType>()->getPointeeType ();
1054+ QualType FirstPteTy = FirstParmTy->castAs <PointerType>()->getPointeeType ();
10581055 const Expr *Buf = Node.getArg (0 ), *Size = Node.getArg (1 );
10591056
10601057 if (FirstPteTy.isConstQualified () || !Buf->getType ()->isPointerType () ||
@@ -1101,9 +1098,10 @@ static bool hasUnsafeSnprintfBuffer(const CallExpr &Node,
11011098 // explicit cast will be needed, which will make this check unreachable.
11021099 // Therefore, the array extent is same as its' bytewise size.
11031100 if (Size->EvaluateAsInt (ER, Ctx)) {
1104- APSInt EVal = ER.Val .getInt (); // Size must have integer type
1101+ llvm:: APSInt EVal = ER.Val .getInt (); // Size must have integer type
11051102
1106- return APSInt::compareValues (EVal, APSInt (CAT->getSize (), true )) != 0 ;
1103+ return llvm::APSInt::compareValues (
1104+ EVal, llvm::APSInt (CAT->getSize (), true )) != 0 ;
11071105 }
11081106 }
11091107 }
@@ -2150,8 +2148,8 @@ namespace {
21502148// declarations to its uses and make sure we've covered all uses with our
21512149// analysis before we try to fix the declaration.
21522150class DeclUseTracker {
2153- using UseSetTy = SmallSet<const DeclRefExpr *, 16 >;
2154- using DefMapTy = DenseMap<const VarDecl *, const DeclStmt *>;
2151+ using UseSetTy = llvm:: SmallSet<const DeclRefExpr *, 16 >;
2152+ using DefMapTy = llvm:: DenseMap<const VarDecl *, const DeclStmt *>;
21552153
21562154 // Allocate on the heap for easier move.
21572155 std::unique_ptr<UseSetTy> Uses{std::make_unique<UseSetTy>()};
@@ -3642,7 +3640,7 @@ static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx,
36423640 }
36433641
36443642 SmallString<32 > Replacement;
3645- raw_svector_ostream OS (Replacement);
3643+ llvm:: raw_svector_ostream OS (Replacement);
36463644 OS << " std::array<" << ElemTypeTxt << " , " << ArraySizeTxt << " > "
36473645 << IdentText->str ();
36483646
@@ -4066,7 +4064,8 @@ static void applyGadgets(const Decl *D, FixableGadgetList FixableGadgets,
40664064#endif
40674065
40684066 // Fixpoint iteration for pointer assignments
4069- using DepMapTy = DenseMap<const VarDecl *, llvm::SetVector<const VarDecl *>>;
4067+ using DepMapTy =
4068+ llvm::DenseMap<const VarDecl *, llvm::SetVector<const VarDecl *>>;
40704069 DepMapTy DependenciesMap{};
40714070 DepMapTy PtrAssignmentGraph{};
40724071
0 commit comments