aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2019-08-09 19:01:23 +0000
committerGabor Horvath <xazax.hun@gmail.com>2019-08-09 19:01:23 +0000
commit67a7530b472763a3a56c100f3a0c12fe26b0fabb (patch)
treee259ddcaedf15cbf07b80e4c8bf25f91816a3181 /clang/lib/Sema/SemaInit.cpp
parentfd85c894eb6889f2a1d1a175fc7d89e91ae1c9e1 (diff)
downloadllvm-67a7530b472763a3a56c100f3a0c12fe26b0fabb.zip
llvm-67a7530b472763a3a56c100f3a0c12fe26b0fabb.tar.gz
llvm-67a7530b472763a3a56c100f3a0c12fe26b0fabb.tar.bz2
Revert Even more warnings utilizing gsl::Owner/gsl::Pointer annotations
This reverts r368454 (git commit 7c3c8ba8daf40534e09f6fe8701b723e25e4e2dc) llvm-svn: 368463
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp38
1 files changed, 9 insertions, 29 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index dfc12e9..4450497 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -6568,33 +6568,19 @@ static bool shouldTrackImplicitObjectArg(const CXXMethodDecl *Callee) {
if (auto *Conv = dyn_cast_or_null<CXXConversionDecl>(Callee))
if (isRecordWithAttr<PointerAttr>(Conv->getConversionType()))
return true;
- if (!Callee->getParent()->isInStdNamespace())
+ if (!Callee->getParent()->isInStdNamespace() || !Callee->getIdentifier())
return false;
if (!isRecordWithAttr<PointerAttr>(Callee->getThisObjectType()) &&
!isRecordWithAttr<OwnerAttr>(Callee->getThisObjectType()))
return false;
- if (Callee->getReturnType()->isPointerType() ||
- isRecordWithAttr<PointerAttr>(Callee->getReturnType())) {
- if (!Callee->getIdentifier())
- return false;
- return llvm::StringSwitch<bool>(Callee->getName())
- .Cases("begin", "rbegin", "cbegin", "crbegin", true)
- .Cases("end", "rend", "cend", "crend", true)
- .Cases("c_str", "data", "get", true)
- // Map and set types.
- .Cases("find", "equal_range", "lower_bound", "upper_bound", true)
- .Default(false);
- } else if (Callee->getReturnType()->isReferenceType()) {
- if (!Callee->getIdentifier()) {
- auto OO = Callee->getOverloadedOperator();
- return OO == OverloadedOperatorKind::OO_Subscript ||
- OO == OverloadedOperatorKind::OO_Star;
- }
- return llvm::StringSwitch<bool>(Callee->getName())
- .Cases("front", "back", "at", true)
- .Default(false);
- }
- return false;
+ if (!isRecordWithAttr<PointerAttr>(Callee->getReturnType()) &&
+ !Callee->getReturnType()->isPointerType())
+ return false;
+ return llvm::StringSwitch<bool>(Callee->getName())
+ .Cases("begin", "rbegin", "cbegin", "crbegin", true)
+ .Cases("end", "rend", "cend", "crend", true)
+ .Cases("c_str", "data", "get", true)
+ .Default(false);
}
static void handleGslAnnotatedTypes(IndirectLocalPath &Path, Expr *Call,
@@ -6614,12 +6600,6 @@ static void handleGslAnnotatedTypes(IndirectLocalPath &Path, Expr *Call,
if (MD && shouldTrackImplicitObjectArg(MD))
VisitPointerArg(MD, MCE->getImplicitObjectArgument());
return;
- } else if (auto *OCE = dyn_cast<CXXOperatorCallExpr>(Call)) {
- FunctionDecl *Callee = OCE->getDirectCallee();
- if (Callee->isCXXInstanceMember() &&
- shouldTrackImplicitObjectArg(cast<CXXMethodDecl>(Callee)))
- VisitPointerArg(Callee, OCE->getArg(0));
- return;
}
if (auto *CCE = dyn_cast<CXXConstructExpr>(Call)) {