r208280 - [C++11] Use 'nullptr'.
Craig Topper
craig.topper at gmail.com
Wed May 7 23:41:41 PDT 2014
Author: ctopper
Date: Thu May 8 01:41:40 2014
New Revision: 208280
URL: http://llvm.org/viewvc/llvm-project?rev=208280&view=rev
Log:
[C++11] Use 'nullptr'.
Modified:
cfe/trunk/lib/Basic/Builtins.cpp
cfe/trunk/lib/Basic/Diagnostic.cpp
cfe/trunk/lib/Basic/DiagnosticIDs.cpp
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/FileSystemStatCache.cpp
cfe/trunk/lib/Basic/IdentifierTable.cpp
cfe/trunk/lib/Basic/Module.cpp
cfe/trunk/lib/Basic/SourceManager.cpp
cfe/trunk/lib/Basic/TargetInfo.cpp
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Basic/TokenKinds.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
Modified: cfe/trunk/lib/Basic/Builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Builtins.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Builtins.cpp (original)
+++ cfe/trunk/lib/Basic/Builtins.cpp Thu May 8 01:41:40 2014
@@ -20,7 +20,7 @@
using namespace clang;
static const Builtin::Info BuiltinInfo[] = {
- { "not a builtin function", 0, 0, 0, ALL_LANGUAGES },
+ { "not a builtin function", nullptr, nullptr, nullptr, ALL_LANGUAGES},
#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES },
#define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) { #ID, TYPE, ATTRS, 0, BUILTIN_LANG },
#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) { #ID, TYPE, ATTRS, HEADER,\
@@ -37,7 +37,7 @@ const Builtin::Info &Builtin::Context::G
Builtin::Context::Context() {
// Get the target specific builtins from the target.
- TSRecords = 0;
+ TSRecords = nullptr;
NumTSRecords = 0;
}
@@ -116,7 +116,7 @@ bool Builtin::Context::isLike(unsigned I
++Like;
assert(::strchr(Like, ':') && "Format specifier must end with a ':'");
- FormatIdx = ::strtol(Like, 0, 10);
+ FormatIdx = ::strtol(Like, nullptr, 10);
return true;
}
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Thu May 8 01:41:40 2014
@@ -41,9 +41,9 @@ DiagnosticsEngine::DiagnosticsEngine(
DiagnosticOptions *DiagOpts,
DiagnosticConsumer *client, bool ShouldOwnClient)
: Diags(diags), DiagOpts(DiagOpts), Client(client),
- OwnsDiagClient(ShouldOwnClient), SourceMgr(0) {
+ OwnsDiagClient(ShouldOwnClient), SourceMgr(nullptr) {
ArgToStringFn = DummyArgToStringFn;
- ArgToStringCookie = 0;
+ ArgToStringCookie = nullptr;
AllExtensionsSilenced = 0;
IgnoreAllWarnings = false;
@@ -157,7 +157,7 @@ DiagnosticsEngine::GetDiagStatePointForL
if (LastStateChangePos.isValid() &&
Loc.isBeforeInTranslationUnitThan(LastStateChangePos))
Pos = std::upper_bound(DiagStatePoints.begin(), DiagStatePoints.end(),
- DiagStatePoint(0, Loc));
+ DiagStatePoint(nullptr, Loc));
--Pos;
return Pos;
}
@@ -612,7 +612,7 @@ static const char *getTokenDescForDiagno
case tok::identifier:
return "identifier";
default:
- return 0;
+ return nullptr;
}
}
@@ -672,7 +672,7 @@ FormatDiagnostic(const char *DiagStr, co
// The digit is a number from 0-9 indicating which argument this comes from.
// The modifier is a string of digits from the set [-a-z]+, arguments is a
// brace enclosed string.
- const char *Modifier = 0, *Argument = 0;
+ const char *Modifier = nullptr, *Argument = nullptr;
unsigned ModifierLen = 0, ArgumentLen = 0;
// Check to see if we have a modifier. If so eat it.
Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Thu May 8 01:41:40 2014
@@ -109,7 +109,7 @@ static const StaticDiagInfoRec *GetDiagI
// Out of bounds diag. Can't be in the table.
using namespace diag;
if (DiagID >= DIAG_UPPER_LIMIT || DiagID <= DIAG_START_COMMON)
- return 0;
+ return nullptr;
// Compute the index of the requested diagnostic in the static table.
// 1. Add the number of diagnostics in each category preceding the
@@ -139,7 +139,7 @@ CATEGORY(ANALYSIS, SEMA)
// Avoid out of bounds reads.
if (ID + Offset >= StaticDiagInfoSize)
- return 0;
+ return nullptr;
assert(ID < StaticDiagInfoSize && Offset < StaticDiagInfoSize);
@@ -148,7 +148,7 @@ CATEGORY(ANALYSIS, SEMA)
// happen when this function is called with an ID that points into a hole in
// the diagID space.
if (Found->DiagID != DiagID)
- return 0;
+ return nullptr;
return Found;
}
@@ -216,7 +216,7 @@ static const StaticDiagCategoryRec Categ
#define CATEGORY(X, ENUM) { X, STR_SIZE(X, uint8_t) },
#include "clang/Basic/DiagnosticGroups.inc"
#undef GET_CATEGORY_TABLE
- { 0, 0 }
+ { nullptr, 0 }
};
/// getNumberOfCategories - Return the number of categories
@@ -301,9 +301,7 @@ namespace clang {
// Common Diagnostic implementation
//===----------------------------------------------------------------------===//
-DiagnosticIDs::DiagnosticIDs() {
- CustomDiagInfo = 0;
-}
+DiagnosticIDs::DiagnosticIDs() { CustomDiagInfo = nullptr; }
DiagnosticIDs::~DiagnosticIDs() {
delete CustomDiagInfo;
@@ -316,7 +314,7 @@ DiagnosticIDs::~DiagnosticIDs() {
/// \param FormatString A fixed diagnostic format string that will be hashed and
/// mapped to a unique DiagID.
unsigned DiagnosticIDs::getCustomDiagID(Level L, StringRef FormatString) {
- if (CustomDiagInfo == 0)
+ if (!CustomDiagInfo)
CustomDiagInfo = new diag::CustomDiagInfo();
return CustomDiagInfo->getOrCreateDiagID(L, FormatString, *this);
}
Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Thu May 8 01:41:40 2014
@@ -70,7 +70,7 @@ FileManager::~FileManager() {
void FileManager::addStatCache(FileSystemStatCache *statCache,
bool AtBeginning) {
assert(statCache && "No stat cache provided?");
- if (AtBeginning || StatCache.get() == 0) {
+ if (AtBeginning || !StatCache.get()) {
statCache->setNextStatCache(StatCache.release());
StatCache.reset(statCache);
return;
@@ -103,7 +103,7 @@ void FileManager::removeStatCache(FileSy
}
void FileManager::clearStatCaches() {
- StatCache.reset(0);
+ StatCache.reset(nullptr);
}
/// \brief Retrieve the directory that the given file name resides in.
@@ -112,10 +112,10 @@ static const DirectoryEntry *getDirector
StringRef Filename,
bool CacheFailure) {
if (Filename.empty())
- return NULL;
+ return nullptr;
if (llvm::sys::path::is_separator(Filename[Filename.size() - 1]))
- return NULL; // If Filename is a directory.
+ return nullptr; // If Filename is a directory.
StringRef DirName = llvm::sys::path::parent_path(Filename);
// Use the current directory if file has no path component.
@@ -179,8 +179,8 @@ const DirectoryEntry *FileManager::getDi
// See if there was already an entry in the map. Note that the map
// contains both virtual and real directories.
if (NamedDirEnt.getValue())
- return NamedDirEnt.getValue() == NON_EXISTENT_DIR
- ? 0 : NamedDirEnt.getValue();
+ return NamedDirEnt.getValue() == NON_EXISTENT_DIR ? nullptr
+ : NamedDirEnt.getValue();
++NumDirCacheMisses;
@@ -193,11 +193,11 @@ const DirectoryEntry *FileManager::getDi
// Check to see if the directory exists.
FileData Data;
- if (getStatValue(InterndDirName, Data, false, 0 /*directory lookup*/)) {
+ if (getStatValue(InterndDirName, Data, false, nullptr /*directory lookup*/)) {
// There's no real directory at the given path.
if (!CacheFailure)
SeenDirEntries.erase(DirName);
- return 0;
+ return nullptr;
}
// It exists. See if we have already opened a directory with the
@@ -227,7 +227,7 @@ const FileEntry *FileManager::getFile(St
// See if there is already an entry in the map.
if (NamedFileEnt.getValue())
return NamedFileEnt.getValue() == NON_EXISTENT_FILE
- ? 0 : NamedFileEnt.getValue();
+ ? nullptr : NamedFileEnt.getValue();
++NumFileCacheMisses;
@@ -245,25 +245,25 @@ const FileEntry *FileManager::getFile(St
// without a 'sys' subdir will get a cached failure result.
const DirectoryEntry *DirInfo = getDirectoryFromFile(*this, Filename,
CacheFailure);
- if (DirInfo == 0) { // Directory doesn't exist, file can't exist.
+ if (DirInfo == nullptr) { // Directory doesn't exist, file can't exist.
if (!CacheFailure)
SeenFileEntries.erase(Filename);
-
- return 0;
+
+ return nullptr;
}
// FIXME: Use the directory info to prune this, before doing the stat syscall.
// FIXME: This will reduce the # syscalls.
// Nope, there isn't. Check to see if the file exists.
- vfs::File *F = 0;
+ vfs::File *F = nullptr;
FileData Data;
- if (getStatValue(InterndFileName, Data, true, openFile ? &F : 0)) {
+ if (getStatValue(InterndFileName, Data, true, openFile ? &F : nullptr)) {
// There's no real file at the given path.
if (!CacheFailure)
SeenFileEntries.erase(Filename);
-
- return 0;
+
+ return nullptr;
}
assert((openFile || !F) && "undesired open file");
@@ -314,7 +314,7 @@ FileManager::getVirtualFile(StringRef Fi
NamedFileEnt.setValue(NON_EXISTENT_FILE);
addAncestorsAsVirtualDirs(Filename);
- FileEntry *UFE = 0;
+ FileEntry *UFE = nullptr;
// Now that all ancestors of Filename are in the cache, the
// following call is guaranteed to find the DirectoryEntry from the
@@ -327,7 +327,7 @@ FileManager::getVirtualFile(StringRef Fi
// Check to see if the file exists. If so, drop the virtual file
FileData Data;
const char *InterndFileName = NamedFileEnt.getKeyData();
- if (getStatValue(InterndFileName, Data, true, 0) == 0) {
+ if (getStatValue(InterndFileName, Data, true, nullptr) == 0) {
Data.Size = Size;
Data.ModTime = ModificationTime;
UFE = &UniqueRealFiles[Data.UniqueID];
Modified: cfe/trunk/lib/Basic/FileSystemStatCache.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileSystemStatCache.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileSystemStatCache.cpp (original)
+++ cfe/trunk/lib/Basic/FileSystemStatCache.cpp Thu May 8 01:41:40 2014
@@ -96,7 +96,7 @@ bool FileSystemStatCache::get(const char
// fstat rarely fails. If it does, claim the initial open didn't
// succeed.
R = CacheMissing;
- *F = 0;
+ *F = nullptr;
}
}
}
@@ -110,7 +110,7 @@ bool FileSystemStatCache::get(const char
// If not, close the file if opened.
if (F && *F) {
(*F)->close();
- *F = 0;
+ *F = nullptr;
}
return true;
Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Thu May 8 01:41:40 2014
@@ -42,8 +42,8 @@ IdentifierInfo::IdentifierInfo() {
RevertedTokenID = false;
OutOfDate = false;
IsModulesImport = false;
- FETokenInfo = 0;
- Entry = 0;
+ FETokenInfo = nullptr;
+ Entry = nullptr;
}
//===----------------------------------------------------------------------===//
@@ -527,7 +527,7 @@ Selector SelectorTable::getSelector(unsi
llvm::FoldingSetNodeID ID;
MultiKeywordSelector::Profile(ID, IIV, nKeys);
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
if (MultiKeywordSelector *SI =
SelTabImpl.Table.FindNodeOrInsertPos(ID, InsertPos))
return Selector(SI);
@@ -555,7 +555,7 @@ const char *clang::getOperatorSpelling(O
switch (Operator) {
case OO_None:
case NUM_OVERLOADED_OPERATORS:
- return 0;
+ return nullptr;
#define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
case OO_##Name: return Spelling;
Modified: cfe/trunk/lib/Basic/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Thu May 8 01:41:40 2014
@@ -27,10 +27,10 @@ using namespace clang;
Module::Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent,
const FileEntry *File, bool IsFramework, bool IsExplicit)
: Name(Name), DefinitionLoc(DefinitionLoc), Parent(Parent), ModuleMap(File),
- Umbrella(), ASTFile(0), IsMissingRequirement(false), IsAvailable(true),
- IsFromModuleFile(false), IsFramework(IsFramework), IsExplicit(IsExplicit),
- IsSystem(false), IsExternC(false), IsInferred(false),
- InferSubmodules(false), InferExplicitSubmodules(false),
+ Umbrella(), ASTFile(nullptr), IsMissingRequirement(false),
+ IsAvailable(true), IsFromModuleFile(false), IsFramework(IsFramework),
+ IsExplicit(IsExplicit), IsSystem(false), IsExternC(false),
+ IsInferred(false), InferSubmodules(false), InferExplicitSubmodules(false),
InferExportWildcard(false), ConfigMacrosExhaustive(false),
NameVisibility(Hidden) {
if (Parent) {
@@ -192,8 +192,8 @@ void Module::markUnavailable(bool Missin
Module *Module::findSubmodule(StringRef Name) const {
llvm::StringMap<unsigned>::const_iterator Pos = SubModuleIndex.find(Name);
if (Pos == SubModuleIndex.end())
- return 0;
-
+ return nullptr;
+
return SubModules[Pos->getValue()];
}
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Thu May 8 01:41:40 2014
@@ -89,7 +89,7 @@ const llvm::MemoryBuffer *ContentCache::
bool *Invalid) const {
// Lazily create the Buffer for ContentCaches that wrap files. If we already
// computed it, just return what we have.
- if (Buffer.getPointer() || ContentsEntry == 0) {
+ if (Buffer.getPointer() || !ContentsEntry) {
if (Invalid)
*Invalid = isBufferInvalid();
@@ -163,7 +163,7 @@ const llvm::MemoryBuffer *ContentCache::
.StartsWith("\x0E\xFE\xFF", "SDSU")
.StartsWith("\xFB\xEE\x28", "BOCU-1")
.StartsWith("\x84\x31\x95\x33", "GB-18030")
- .Default(0);
+ .Default(nullptr);
if (InvalidBOM) {
Diag.Report(Loc, diag::err_unsupported_bom)
@@ -272,7 +272,7 @@ const LineEntry *LineTableInfo::FindNear
// Do a binary search to find the maximal element that is still before Offset.
std::vector<LineEntry>::const_iterator I =
std::upper_bound(Entries.begin(), Entries.end(), Offset);
- if (I == Entries.begin()) return 0;
+ if (I == Entries.begin()) return nullptr;
return &*--I;
}
@@ -286,7 +286,7 @@ void LineTableInfo::AddEntry(FileID FID,
/// getLineTableFilenameID - Return the uniqued ID for the specified filename.
///
unsigned SourceManager::getLineTableFilenameID(StringRef Name) {
- if (LineTable == 0)
+ if (!LineTable)
LineTable = new LineTableInfo();
return LineTable->getLineTableFilenameID(Name);
}
@@ -309,7 +309,7 @@ void SourceManager::AddLineNote(SourceLo
// Remember that this file has #line directives now if it doesn't already.
const_cast<SrcMgr::FileInfo&>(FileInfo).setHasLineDirectives();
- if (LineTable == 0)
+ if (!LineTable)
LineTable = new LineTableInfo();
LineTable->AddLineNote(LocInfo.first, LocInfo.second, LineNo, FilenameID);
}
@@ -339,7 +339,7 @@ void SourceManager::AddLineNote(SourceLo
// Remember that this file has #line directives now if it doesn't already.
const_cast<SrcMgr::FileInfo&>(FileInfo).setHasLineDirectives();
- if (LineTable == 0)
+ if (!LineTable)
LineTable = new LineTableInfo();
SrcMgr::CharacteristicKind FileKind;
@@ -361,7 +361,7 @@ void SourceManager::AddLineNote(SourceLo
}
LineTableInfo &SourceManager::getLineTable() {
- if (LineTable == 0)
+ if (!LineTable)
LineTable = new LineTableInfo();
return *LineTable;
}
@@ -374,9 +374,9 @@ SourceManager::SourceManager(Diagnostics
bool UserFilesAreVolatile)
: Diag(Diag), FileMgr(FileMgr), OverridenFilesKeepOriginalName(true),
UserFilesAreVolatile(UserFilesAreVolatile),
- ExternalSLocEntries(0), LineTable(0), NumLinearScans(0),
- NumBinaryProbes(0), FakeBufferForRecovery(0),
- FakeContentCacheForRecovery(0) {
+ ExternalSLocEntries(nullptr), LineTable(nullptr), NumLinearScans(0),
+ NumBinaryProbes(0), FakeBufferForRecovery(nullptr),
+ FakeContentCacheForRecovery(nullptr) {
clearIDTables();
Diag.setSourceManager(this);
}
@@ -413,7 +413,7 @@ void SourceManager::clearIDTables() {
LoadedSLocEntryTable.clear();
SLocEntryLoaded.clear();
LastLineNoFileIDQuery = FileID();
- LastLineNoContentCache = 0;
+ LastLineNoContentCache = nullptr;
LastFileIDLookup = FileID();
if (LineTable)
@@ -680,7 +680,7 @@ void SourceManager::disableFileContentsO
return;
const SrcMgr::ContentCache *IR = getOrCreateContentCache(File);
- const_cast<SrcMgr::ContentCache *>(IR)->replaceBuffer(0);
+ const_cast<SrcMgr::ContentCache *>(IR)->replaceBuffer(nullptr);
const_cast<SrcMgr::ContentCache *>(IR)->ContentsEntry = IR->OrigEntry;
assert(OverriddenFilesInfo);
@@ -1148,7 +1148,7 @@ unsigned SourceManager::getColumnNumber(
// See if we just calculated the line number for this FilePos and can use
// that to lookup the start of the line instead of searching for it.
if (LastLineNoFileIDQuery == FID &&
- LastLineNoContentCache->SourceLineCache != 0 &&
+ LastLineNoContentCache->SourceLineCache != nullptr &&
LastLineNoResult < LastLineNoContentCache->NumLines) {
unsigned *SourceLineCache = LastLineNoContentCache->SourceLineCache;
unsigned LineStart = SourceLineCache[LastLineNoResult - 1];
@@ -1312,7 +1312,7 @@ unsigned SourceManager::getLineNumber(Fi
// If this is the first use of line information for this buffer, compute the
/// SourceLineCache for it on demand.
- if (Content->SourceLineCache == 0) {
+ if (!Content->SourceLineCache) {
bool MyInvalid = false;
ComputeLineNumbers(Diag, Content, ContentCacheAlloc, *this, MyInvalid);
if (Invalid)
@@ -1696,7 +1696,8 @@ FileID SourceManager::translateFile(cons
if (SLoc.isFile()) {
const ContentCache *FileContentCache
= SLoc.getFile().getContentCache();
- const FileEntry *Entry =FileContentCache? FileContentCache->OrigEntry : 0;
+ const FileEntry *Entry = FileContentCache ? FileContentCache->OrigEntry
+ : nullptr;
if (Entry &&
*SourceFileName == llvm::sys::path::filename(Entry->getName())) {
if (Optional<llvm::sys::fs::UniqueID> EntryUID =
@@ -1748,7 +1749,7 @@ SourceLocation SourceManager::translateL
// If this is the first use of line information for this buffer, compute the
// SourceLineCache for it on demand.
- if (Content->SourceLineCache == 0) {
+ if (!Content->SourceLineCache) {
bool MyInvalid = false;
ComputeLineNumbers(Diag, Content, ContentCacheAlloc, *this, MyInvalid);
if (MyInvalid)
@@ -2124,7 +2125,7 @@ void SourceManager::PrintStats() const {
unsigned NumLineNumsComputed = 0;
unsigned NumFileBytesMapped = 0;
for (fileinfo_iterator I = fileinfo_begin(), E = fileinfo_end(); I != E; ++I){
- NumLineNumsComputed += I->second->SourceLineCache != 0;
+ NumLineNumsComputed += I->second->SourceLineCache != nullptr;
NumFileBytesMapped += I->second->getSizeBytesMapped();
}
unsigned NumMacroArgsComputed = MacroArgsCacheMap.size();
Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Thu May 8 01:41:40 2014
@@ -69,7 +69,7 @@ TargetInfo::TargetInfo(const llvm::Tripl
FloatFormat = &llvm::APFloat::IEEEsingle;
DoubleFormat = &llvm::APFloat::IEEEdouble;
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
- DescriptionString = 0;
+ DescriptionString = nullptr;
UserLabelPrefix = "_";
MCountName = "mcount";
RegParmMax = 0;
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu May 8 01:41:40 2014
@@ -1345,7 +1345,7 @@ namespace {
void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const override {
// No aliases.
- Aliases = 0;
+ Aliases = nullptr;
NumAliases = 0;
}
bool validateAsmConstraint(const char *&Name,
@@ -1472,13 +1472,13 @@ public:
void getGCCRegNames(const char * const *&Names,
unsigned &numNames) const override {
- Names = NULL;
+ Names = nullptr;
numNames = 0;
}
void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const override {
- Aliases = NULL;
+ Aliases = nullptr;
NumAliases = 0;
}
@@ -1489,7 +1489,7 @@ public:
void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const override {
- Records = NULL;
+ Records = nullptr;
NumRecords = 0;
}
@@ -1818,7 +1818,7 @@ public:
}
void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const override {
- Aliases = 0;
+ Aliases = nullptr;
NumAliases = 0;
}
void getGCCAddlRegNames(const AddlRegName *&Names,
@@ -4092,7 +4092,7 @@ public:
.Cases("cortex-m3", "cortex-m4", "7M")
.Case("cortex-m0", "6M")
.Cases("cortex-a53", "cortex-a57", "8A")
- .Default(0);
+ .Default(nullptr);
}
static const char *getCPUProfile(StringRef Name) {
return llvm::StringSwitch<const char*>(Name)
@@ -4895,7 +4895,7 @@ public:
return llvm::StringSwitch<const char*>(Name)
.Case("hexagonv4", "4")
.Case("hexagonv5", "5")
- .Default(0);
+ .Default(nullptr);
}
bool setCPU(const std::string &Name) override {
@@ -5227,7 +5227,7 @@ public:
void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const override {
// FIXME: Implement.
- Records = 0;
+ Records = nullptr;
NumRecords = 0;
}
@@ -5236,7 +5236,7 @@ public:
void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const override {
// No aliases.
- Aliases = 0;
+ Aliases = nullptr;
NumAliases = 0;
}
bool validateAsmConstraint(const char *&Name,
@@ -5333,7 +5333,7 @@ namespace {
void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const override {
// FIXME: Implement.
- Records = 0;
+ Records = nullptr;
NumRecords = 0;
}
bool hasFeature(StringRef Feature) const override {
@@ -5344,7 +5344,7 @@ namespace {
void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const override {
// No aliases.
- Aliases = 0;
+ Aliases = nullptr;
NumAliases = 0;
}
bool validateAsmConstraint(const char *&Name,
@@ -6002,13 +6002,13 @@ public:
void PNaClTargetInfo::getGCCRegNames(const char * const *&Names,
unsigned &NumNames) const {
- Names = NULL;
+ Names = nullptr;
NumNames = 0;
}
void PNaClTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const {
- Aliases = NULL;
+ Aliases = nullptr;
NumAliases = 0;
}
} // end anonymous namespace.
@@ -6142,7 +6142,7 @@ public:
}
void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const override {
- Aliases = NULL;
+ Aliases = nullptr;
NumAliases = 0;
}
bool validateAsmConstraint(const char *&Name,
@@ -6173,7 +6173,7 @@ static TargetInfo *AllocateTarget(const
switch (Triple.getArch()) {
default:
- return NULL;
+ return nullptr;
case llvm::Triple::arm64:
if (Triple.isOSDarwin())
@@ -6351,7 +6351,7 @@ static TargetInfo *AllocateTarget(const
case llvm::Triple::NaCl:
return new NaClTargetInfo<PNaClTargetInfo>(Triple);
default:
- return NULL;
+ return nullptr;
}
case llvm::Triple::ppc:
@@ -6540,13 +6540,13 @@ static TargetInfo *AllocateTarget(const
case llvm::Triple::spir: {
if (Triple.getOS() != llvm::Triple::UnknownOS ||
Triple.getEnvironment() != llvm::Triple::UnknownEnvironment)
- return NULL;
+ return nullptr;
return new SPIR32TargetInfo(Triple);
}
case llvm::Triple::spir64: {
if (Triple.getOS() != llvm::Triple::UnknownOS ||
Triple.getEnvironment() != llvm::Triple::UnknownEnvironment)
- return NULL;
+ return nullptr;
return new SPIR64TargetInfo(Triple);
}
}
@@ -6562,26 +6562,26 @@ TargetInfo *TargetInfo::CreateTargetInfo
std::unique_ptr<TargetInfo> Target(AllocateTarget(Triple));
if (!Target) {
Diags.Report(diag::err_target_unknown_triple) << Triple.str();
- return 0;
+ return nullptr;
}
Target->setTargetOpts(Opts);
// Set the target CPU if specified.
if (!Opts->CPU.empty() && !Target->setCPU(Opts->CPU)) {
Diags.Report(diag::err_target_unknown_cpu) << Opts->CPU;
- return 0;
+ return nullptr;
}
// Set the target ABI if specified.
if (!Opts->ABI.empty() && !Target->setABI(Opts->ABI)) {
Diags.Report(diag::err_target_unknown_abi) << Opts->ABI;
- return 0;
+ return nullptr;
}
// Set the fp math unit.
if (!Opts->FPMath.empty() && !Target->setFPMath(Opts->FPMath)) {
Diags.Report(diag::err_target_unknown_fpmath) << Opts->FPMath;
- return 0;
+ return nullptr;
}
// Compute the default target features, we need the target to handle this
@@ -6607,7 +6607,7 @@ TargetInfo *TargetInfo::CreateTargetInfo
ie = Features.end(); it != ie; ++it)
Opts->Features.push_back((it->second ? "+" : "-") + it->first().str());
if (!Target->handleTargetFeatures(Opts->Features, Diags))
- return 0;
+ return nullptr;
return Target.release();
}
Modified: cfe/trunk/lib/Basic/TokenKinds.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TokenKinds.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TokenKinds.cpp (original)
+++ cfe/trunk/lib/Basic/TokenKinds.cpp Thu May 8 01:41:40 2014
@@ -19,14 +19,14 @@ static const char * const TokNames[] = {
#define TOK(X) #X,
#define KEYWORD(X,Y) #X,
#include "clang/Basic/TokenKinds.def"
- 0
+ nullptr
};
const char *tok::getTokenName(TokenKind Kind) {
if (Kind < tok::NUM_TOKENS)
return TokNames[Kind];
llvm_unreachable("unknown TokenKind");
- return 0;
+ return nullptr;
}
const char *tok::getPunctuatorSpelling(TokenKind Kind) {
@@ -35,7 +35,7 @@ const char *tok::getPunctuatorSpelling(T
#include "clang/Basic/TokenKinds.def"
default: break;
}
- return 0;
+ return nullptr;
}
const char *tok::getKeywordSpelling(TokenKind Kind) {
@@ -44,5 +44,5 @@ const char *tok::getKeywordSpelling(Toke
#include "clang/Basic/TokenKinds.def"
default: break;
}
- return 0;
+ return nullptr;
}
Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=208280&r1=208279&r2=208280&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Thu May 8 01:41:40 2014
@@ -473,7 +473,7 @@ class VFSFromYAMLParser {
yaml::MappingNode *M = dyn_cast<yaml::MappingNode>(N);
if (!M) {
error(N, "expected mapping node for file or directory entry");
- return NULL;
+ return nullptr;
}
KeyStatusPair Fields[] = {
@@ -501,32 +501,32 @@ class VFSFromYAMLParser {
// parsing value.
SmallString<256> Buffer;
if (!parseScalarString(I->getKey(), Key, Buffer))
- return NULL;
+ return nullptr;
if (!checkDuplicateOrUnknownKey(I->getKey(), Key, Keys))
- return NULL;
+ return nullptr;
StringRef Value;
if (Key == "name") {
if (!parseScalarString(I->getValue(), Value, Buffer))
- return NULL;
+ return nullptr;
Name = Value;
} else if (Key == "type") {
if (!parseScalarString(I->getValue(), Value, Buffer))
- return NULL;
+ return nullptr;
if (Value == "file")
Kind = EK_File;
else if (Value == "directory")
Kind = EK_Directory;
else {
error(I->getValue(), "unknown value for 'type'");
- return NULL;
+ return nullptr;
}
} else if (Key == "contents") {
if (HasContents) {
error(I->getKey(),
"entry already has 'contents' or 'external-contents'");
- return NULL;
+ return nullptr;
}
HasContents = true;
yaml::SequenceNode *Contents =
@@ -534,7 +534,7 @@ class VFSFromYAMLParser {
if (!Contents) {
// FIXME: this is only for directories, what about files?
error(I->getValue(), "expected array");
- return NULL;
+ return nullptr;
}
for (yaml::SequenceNode::iterator I = Contents->begin(),
@@ -543,22 +543,22 @@ class VFSFromYAMLParser {
if (Entry *E = parseEntry(&*I))
EntryArrayContents.push_back(E);
else
- return NULL;
+ return nullptr;
}
} else if (Key == "external-contents") {
if (HasContents) {
error(I->getKey(),
"entry already has 'contents' or 'external-contents'");
- return NULL;
+ return nullptr;
}
HasContents = true;
if (!parseScalarString(I->getValue(), Value, Buffer))
- return NULL;
+ return nullptr;
ExternalContentsPath = Value;
} else if (Key == "use-external-name") {
bool Val;
if (!parseScalarBool(I->getValue(), Val))
- return NULL;
+ return nullptr;
UseExternalName = Val ? FileEntry::NK_External : FileEntry::NK_Virtual;
} else {
llvm_unreachable("key missing from Keys");
@@ -566,20 +566,20 @@ class VFSFromYAMLParser {
}
if (Stream.failed())
- return NULL;
+ return nullptr;
// check for missing keys
if (!HasContents) {
error(N, "missing key 'contents' or 'external-contents'");
- return NULL;
+ return nullptr;
}
if (!checkMissingKeys(N, Keys))
- return NULL;
+ return nullptr;
// check invalid configuration
if (Kind == EK_Directory && UseExternalName != FileEntry::NK_NotSet) {
error(N, "'use-external-name' is not supported for directories");
- return NULL;
+ return nullptr;
}
// Remove trailing slash(es), being careful not to remove the root path
@@ -591,7 +591,7 @@ class VFSFromYAMLParser {
// Get the last component
StringRef LastComponent = sys::path::filename(Trimmed);
- Entry *Result = 0;
+ Entry *Result = nullptr;
switch (Kind) {
case EK_File:
Result = new FileEntry(LastComponent, std::move(ExternalContentsPath),
@@ -722,14 +722,14 @@ VFSFromYAML *VFSFromYAML::create(MemoryB
yaml::Node *Root = DI->getRoot();
if (DI == Stream.end() || !Root) {
SM.PrintMessage(SMLoc(), SourceMgr::DK_Error, "expected root node");
- return NULL;
+ return nullptr;
}
VFSFromYAMLParser P(Stream);
std::unique_ptr<VFSFromYAML> FS(new VFSFromYAML(ExternalFS));
if (!P.parse(Root, FS.get()))
- return NULL;
+ return nullptr;
return FS.release();
}
More information about the cfe-commits
mailing list