lib/Sema/SemaDeclAttr.cpp
static bool threadSafetyCheckIsSmartPointer(Sema &S, const RecordType* RT) {
  auto IsOverloadedOperatorPresent = [&S](const RecordDecl *Record,
                                          OverloadedOperatorKind Op) {
    DeclContextLookupResult Result =
        Record->lookup(S.Context.DeclarationNames.getCXXOperatorName(Op));
    return !Result.empty();
  };

  const RecordDecl *Record = RT->getDecl();
  bool foundStarOperator = IsOverloadedOperatorPresent(Record, OO_Star);
  bool foundArrowOperator = IsOverloadedOperatorPresent(Record, OO_Arrow);
  if (foundStarOperator && foundArrowOperator)
    return true;

  const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(Record);
  if (!CXXRecord)
    return false;

  for (auto BaseSpecifier : CXXRecord->bases()) {
    if (!foundStarOperator)
      foundStarOperator = IsOverloadedOperatorPresent(
          BaseSpecifier.getType()->getAsRecordDecl(), OO_Star);
    if (!foundArrowOperator)
      foundArrowOperator = IsOverloadedOperatorPresent(
          BaseSpecifier.getType()->getAsRecordDecl(), OO_Arrow);
  }

  if (foundStarOperator && foundArrowOperator)
    return true;

  return false;
}
// Check to see if the type is a smart pointer of some kind.  We assume
// it's a smart pointer if it defines both operator-> and operator*.
Check to see if the type is a smart pointer of some kind.  We assume
it's a smart pointer if it defines both operator-> and operator*.
Check to see if the type is a smart pointer of some kind . We assume it ' s a smart pointer if it defines both operator - > and operator * .
static bool threadSafetyCheckIsSmartPointer(Sema &S, const RecordType* RT) {
  auto IsOverloadedOperatorPresent = [&S](const RecordDecl *Record,
                                          OverloadedOperatorKind Op) {
    DeclContextLookupResult Result =
        Record->lookup(S.Context.DeclarationNames.getCXXOperatorName(Op));
    return !Result.empty();
  };
  const RecordDecl *Record = RT->getDecl();
  bool foundStarOperator = IsOverloadedOperatorPresent(Record, OO_Star);
  bool foundArrowOperator = IsOverloadedOperatorPresent(Record, OO_Arrow);
  if (foundStarOperator && foundArrowOperator)
    return true;
  const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(Record);
  if (!CXXRecord)
    return false;
  for (auto BaseSpecifier : CXXRecord->bases()) {
    if (!foundStarOperator)
      foundStarOperator = IsOverloadedOperatorPresent(
          BaseSpecifier.getType()->getAsRecordDecl(), OO_Star);
    if (!foundArrowOperator)
      foundArrowOperator = IsOverloadedOperatorPresent(
          BaseSpecifier.getType()->getAsRecordDecl(), OO_Arrow);
  }
  if (foundStarOperator && foundArrowOperator)
    return true;
  return false;
}
static bool threadSafetyCheckIsSmartPointer ( Sema & S , const RecordType * RT ) { auto IsOverloadedOperatorPresent = [ & S ] ( const RecordDecl * Record , OverloadedOperatorKind Op ) { DeclContextLookupResult Result = Record -> lookup ( S . Context . DeclarationNames . getCXXOperatorName ( Op ) ) ; return ! Result . empty ( ) ; } ; const RecordDecl * Record = RT -> getDecl ( ) ; bool foundStarOperator = IsOverloadedOperatorPresent ( Record , OO_Star ) ; bool foundArrowOperator = IsOverloadedOperatorPresent ( Record , OO_Arrow ) ; if ( foundStarOperator && foundArrowOperator ) return true ; const CXXRecordDecl * CXXRecord = dyn_cast < CXXRecordDecl > ( Record ) ; if ( ! CXXRecord ) return false ; for ( auto BaseSpecifier : CXXRecord -> bases ( ) ) { if ( ! foundStarOperator ) foundStarOperator = IsOverloadedOperatorPresent ( BaseSpecifier . getType ( ) -> getAsRecordDecl ( ) , OO_Star ) ; if ( ! foundArrowOperator ) foundArrowOperator = IsOverloadedOperatorPresent ( BaseSpecifier . getType ( ) -> getAsRecordDecl ( ) , OO_Arrow ) ; } if ( foundStarOperator && foundArrowOperator ) return true ; return false ; }
Check to see if the type is a smart pointer of some kind.
Check to see if the type is a smart pointer of some kind .