summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/AnalysisBasedWarnings.cpp27
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp21
-rw-r--r--clang/lib/Sema/SemaLookup.cpp12
3 files changed, 29 insertions, 31 deletions
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index f2430262210..e2136ac27bd 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -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 =
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 7b9b9c148c1..0ce463be6a1 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -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) {
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 05a347ecdf3..55ca678a5fa 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -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;
}
OpenPOWER on IntegriCloud