summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/DelayedDiagnostic.cpp8
-rw-r--r--clang/lib/Sema/IdentifierResolver.cpp37
2 files changed, 26 insertions, 19 deletions
diff --git a/clang/lib/Sema/DelayedDiagnostic.cpp b/clang/lib/Sema/DelayedDiagnostic.cpp
index 3d321d561e6..25552063400 100644
--- a/clang/lib/Sema/DelayedDiagnostic.cpp
+++ b/clang/lib/Sema/DelayedDiagnostic.cpp
@@ -1,4 +1,4 @@
-//===--- DelayedDiagnostic.cpp - Delayed declarator diagnostics -*- C++ -*-===//
+//===- DelayedDiagnostic.cpp - Delayed declarator diagnostics -------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,8 +14,10 @@
// This file also defines AccessedEntity.
//
//===----------------------------------------------------------------------===//
+
#include "clang/Sema/DelayedDiagnostic.h"
-#include <string.h>
+#include <cstring>
+
using namespace clang;
using namespace sema;
@@ -37,7 +39,7 @@ DelayedDiagnostic::makeAvailability(AvailabilityResult AR,
DD.AvailabilityData.UnknownObjCClass = UnknownObjCClass;
DD.AvailabilityData.ObjCProperty = ObjCProperty;
char *MessageData = nullptr;
- if (Msg.size()) {
+ if (!Msg.empty()) {
MessageData = new char [Msg.size()];
memcpy(MessageData, Msg.data(), Msg.size());
}
diff --git a/clang/lib/Sema/IdentifierResolver.cpp b/clang/lib/Sema/IdentifierResolver.cpp
index 0bdb19490bc..f31c5174bf1 100644
--- a/clang/lib/Sema/IdentifierResolver.cpp
+++ b/clang/lib/Sema/IdentifierResolver.cpp
@@ -1,4 +1,4 @@
-//===- IdentifierResolver.cpp - Lexical Scope Name lookup -------*- C++ -*-===//
+//===- IdentifierResolver.cpp - Lexical Scope Name lookup -----------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,10 +14,16 @@
#include "clang/Sema/IdentifierResolver.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclBase.h"
+#include "clang/AST/DeclarationName.h"
+#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Lex/ExternalPreprocessorSource.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Scope.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <cassert>
+#include <cstdint>
using namespace clang;
@@ -35,17 +41,17 @@ class IdentifierResolver::IdDeclInfoMap {
/// impossible to add something to a pre-C++0x STL container without
/// a completely unnecessary copy.
struct IdDeclInfoPool {
- IdDeclInfoPool(IdDeclInfoPool *Next) : Next(Next) {}
-
IdDeclInfoPool *Next;
IdDeclInfo Pool[POOL_SIZE];
+
+ IdDeclInfoPool(IdDeclInfoPool *Next) : Next(Next) {}
};
- IdDeclInfoPool *CurPool;
- unsigned int CurIndex;
+ IdDeclInfoPool *CurPool = nullptr;
+ unsigned int CurIndex = POOL_SIZE;
public:
- IdDeclInfoMap() : CurPool(nullptr), CurIndex(POOL_SIZE) {}
+ IdDeclInfoMap() = default;
~IdDeclInfoMap() {
IdDeclInfoPool *Cur = CurPool;
@@ -60,7 +66,6 @@ public:
IdDeclInfo &operator[](DeclarationName Name);
};
-
//===----------------------------------------------------------------------===//
// IdDeclInfo Implementation
//===----------------------------------------------------------------------===//
@@ -83,9 +88,7 @@ void IdentifierResolver::IdDeclInfo::RemoveDecl(NamedDecl *D) {
//===----------------------------------------------------------------------===//
IdentifierResolver::IdentifierResolver(Preprocessor &PP)
- : LangOpt(PP.getLangOpts()), PP(PP),
- IdDeclInfos(new IdDeclInfoMap) {
-}
+ : LangOpt(PP.getLangOpts()), PP(PP), IdDeclInfos(new IdDeclInfoMap) {}
IdentifierResolver::~IdentifierResolver() {
delete IdDeclInfos;
@@ -245,12 +248,14 @@ IdentifierResolver::begin(DeclarationName Name) {
}
namespace {
- enum DeclMatchKind {
- DMK_Different,
- DMK_Replace,
- DMK_Ignore
- };
-}
+
+enum DeclMatchKind {
+ DMK_Different,
+ DMK_Replace,
+ DMK_Ignore
+};
+
+} // namespace
/// \brief Compare two declarations to see whether they are different or,
/// if they are the same, whether the new declaration should replace the
OpenPOWER on IntegriCloud