r210423 - [C++11] Use 'nullptr'. Unittests edition.
Craig Topper
craig.topper at gmail.com
Sun Jun 8 01:38:12 PDT 2014
Author: ctopper
Date: Sun Jun 8 03:38:12 2014
New Revision: 210423
URL: http://llvm.org/viewvc/llvm-project?rev=210423&view=rev
Log:
[C++11] Use 'nullptr'. Unittests edition.
Modified:
cfe/trunk/unittests/AST/ASTVectorTest.cpp
cfe/trunk/unittests/AST/CommentParser.cpp
cfe/trunk/unittests/AST/StmtPrinterTest.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
cfe/trunk/unittests/Basic/FileManagerTest.cpp
cfe/trunk/unittests/Basic/SourceManagerTest.cpp
cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
cfe/trunk/unittests/Lex/LexerTest.cpp
cfe/trunk/unittests/Lex/PPCallbacksTest.cpp
cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
cfe/trunk/unittests/Sema/ExternalSemaSourceTest.cpp
cfe/trunk/unittests/Tooling/CommentHandlerTest.cpp
cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
cfe/trunk/unittests/Tooling/RefactoringTest.cpp
cfe/trunk/unittests/Tooling/RewriterTestContext.h
cfe/trunk/unittests/Tooling/ToolingTest.cpp
cfe/trunk/unittests/libclang/LibclangTest.cpp
Modified: cfe/trunk/unittests/AST/ASTVectorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTVectorTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/ASTVectorTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTVectorTest.cpp Sun Jun 8 03:38:12 2014
@@ -18,7 +18,7 @@
using namespace clang;
LLVM_ATTRIBUTE_UNUSED void CompileTest() {
- ASTContext *C = 0;
+ ASTContext *C = nullptr;
ASTVector<int> V;
V.insert(*C, V.begin(), 0);
}
Modified: cfe/trunk/unittests/AST/CommentParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/CommentParser.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/CommentParser.cpp (original)
+++ cfe/trunk/unittests/AST/CommentParser.cpp Sun Jun 8 03:38:12 2014
@@ -60,7 +60,7 @@ FullComment *CommentParserTest::parseStr
Lexer L(Allocator, Diags, Traits, Begin, Source, Source + strlen(Source));
- Sema S(Allocator, SourceMgr, Diags, Traits, /*PP=*/ NULL);
+ Sema S(Allocator, SourceMgr, Diags, Traits, /*PP=*/ nullptr);
Parser P(L, S, Allocator, SourceMgr, Diags, Traits);
FullComment *FC = P.parseFullComment();
@@ -74,7 +74,7 @@ FullComment *CommentParserTest::parseStr
if (Tok.is(tok::eof))
return FC;
else
- return NULL;
+ return nullptr;
}
::testing::AssertionResult HasChildCount(const Comment *C, size_t Count) {
Modified: cfe/trunk/unittests/AST/StmtPrinterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/StmtPrinterTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/StmtPrinterTest.cpp (original)
+++ cfe/trunk/unittests/AST/StmtPrinterTest.cpp Sun Jun 8 03:38:12 2014
@@ -33,7 +33,7 @@ namespace {
void PrintStmt(raw_ostream &Out, const ASTContext *Context, const Stmt *S) {
PrintingPolicy Policy = Context->getPrintingPolicy();
- S->printPretty(Out, /*Helper*/ 0, Policy);
+ S->printPretty(Out, /*Helper*/ nullptr, Policy);
}
class PrintMatch : public MatchFinder::MatchCallback {
Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Sun Jun 8 03:38:12 2014
@@ -44,14 +44,15 @@ TEST(IsDerivedFromDeathTest, DiesOnEmpty
TEST(Finder, DynamicOnlyAcceptsSomeMatchers) {
MatchFinder Finder;
- EXPECT_TRUE(Finder.addDynamicMatcher(decl(), NULL));
- EXPECT_TRUE(Finder.addDynamicMatcher(callExpr(), NULL));
- EXPECT_TRUE(Finder.addDynamicMatcher(constantArrayType(hasSize(42)), NULL));
+ EXPECT_TRUE(Finder.addDynamicMatcher(decl(), nullptr));
+ EXPECT_TRUE(Finder.addDynamicMatcher(callExpr(), nullptr));
+ EXPECT_TRUE(Finder.addDynamicMatcher(constantArrayType(hasSize(42)),
+ nullptr));
// Do not accept non-toplevel matchers.
- EXPECT_FALSE(Finder.addDynamicMatcher(isArrow(), NULL));
- EXPECT_FALSE(Finder.addDynamicMatcher(hasSize(2), NULL));
- EXPECT_FALSE(Finder.addDynamicMatcher(hasName("x"), NULL));
+ EXPECT_FALSE(Finder.addDynamicMatcher(isArrow(), nullptr));
+ EXPECT_FALSE(Finder.addDynamicMatcher(hasSize(2), nullptr));
+ EXPECT_FALSE(Finder.addDynamicMatcher(hasName("x"), nullptr));
}
TEST(Decl, MatchesDeclarations) {
@@ -697,7 +698,8 @@ public:
EXPECT_EQ(Nodes->getNodeAs<T>(Id), I->second.get<T>());
return true;
}
- EXPECT_TRUE(M.count(Id) == 0 || M.find(Id)->second.template get<T>() == 0);
+ EXPECT_TRUE(M.count(Id) == 0 ||
+ M.find(Id)->second.template get<T>() == nullptr);
return false;
}
@@ -4116,7 +4118,7 @@ public:
virtual bool run(const BoundNodes *Nodes, ASTContext *Context) {
const T *Node = Nodes->getNodeAs<T>(Id);
return selectFirst<const T>(InnerId,
- match(InnerMatcher, *Node, *Context)) != NULL;
+ match(InnerMatcher, *Node, *Context)) !=nullptr;
}
private:
std::string Id;
@@ -4176,7 +4178,7 @@ public:
return selectFirst<const T>(
"", match(stmt(hasParent(
stmt(has(stmt(equalsNode(TypedNode)))).bind(""))),
- *Node, Context)) != NULL;
+ *Node, Context)) != nullptr;
}
bool verify(const BoundNodes &Nodes, ASTContext &Context, const Decl *Node) {
// Use the original typed pointer to verify we can pass pointers to subtypes
@@ -4185,7 +4187,7 @@ public:
return selectFirst<const T>(
"", match(decl(hasParent(
decl(has(decl(equalsNode(TypedNode)))).bind(""))),
- *Node, Context)) != NULL;
+ *Node, Context)) != nullptr;
}
};
Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Sun Jun 8 03:38:12 2014
@@ -40,7 +40,7 @@ public:
: Verified(Verified), FindResultReviewer(FindResultVerifier) {}
virtual void run(const MatchFinder::MatchResult &Result) {
- if (FindResultReviewer != NULL) {
+ if (FindResultReviewer != nullptr) {
*Verified |= FindResultReviewer->run(&Result.Nodes, Result.Context);
} else {
*Verified = true;
@@ -64,9 +64,9 @@ testing::AssertionResult matchesConditio
llvm::StringRef CompileArg) {
bool Found = false, DynamicFound = false;
MatchFinder Finder;
- VerifyMatch VerifyFound(0, &Found);
+ VerifyMatch VerifyFound(nullptr, &Found);
Finder.addMatcher(AMatcher, &VerifyFound);
- VerifyMatch VerifyDynamicFound(0, &DynamicFound);
+ VerifyMatch VerifyDynamicFound(nullptr, &DynamicFound);
if (!Finder.addDynamicMatcher(AMatcher, &VerifyDynamicFound))
return testing::AssertionFailure() << "Could not add dynamic matcher";
std::unique_ptr<FrontendActionFactory> Factory(
Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/Dynamic/RegistryTest.cpp Sun Jun 8 03:38:12 2014
@@ -40,7 +40,7 @@ public:
}
VariantMatcher constructMatcher(StringRef MatcherName,
- Diagnostics *Error = NULL) {
+ Diagnostics *Error = nullptr) {
Diagnostics DummyError;
if (!Error) Error = &DummyError;
llvm::Optional<MatcherCtor> Ctor = lookupMatcherCtor(MatcherName);
@@ -53,7 +53,7 @@ public:
VariantMatcher constructMatcher(StringRef MatcherName,
const VariantValue &Arg1,
- Diagnostics *Error = NULL) {
+ Diagnostics *Error = nullptr) {
Diagnostics DummyError;
if (!Error) Error = &DummyError;
llvm::Optional<MatcherCtor> Ctor = lookupMatcherCtor(MatcherName);
@@ -67,7 +67,7 @@ public:
VariantMatcher constructMatcher(StringRef MatcherName,
const VariantValue &Arg1,
const VariantValue &Arg2,
- Diagnostics *Error = NULL) {
+ Diagnostics *Error = nullptr) {
Diagnostics DummyError;
if (!Error) Error = &DummyError;
llvm::Optional<MatcherCtor> Ctor = lookupMatcherCtor(MatcherName);
@@ -110,7 +110,8 @@ public:
}
bool hasCompletion(const CompVector &Comps, StringRef TypedText,
- StringRef MatcherDecl = StringRef(), unsigned *Index = 0) {
+ StringRef MatcherDecl = StringRef(),
+ unsigned *Index = nullptr) {
for (CompVector::const_iterator I = Comps.begin(), E = Comps.end(); I != E;
++I) {
if (I->TypedText == TypedText &&
Modified: cfe/trunk/unittests/Basic/FileManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/FileManagerTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/FileManagerTest.cpp (original)
+++ cfe/trunk/unittests/Basic/FileManagerTest.cpp Sun Jun 8 03:38:12 2014
@@ -76,17 +76,17 @@ class FileManagerTest : public ::testing
// (not NULL, correct name).
TEST_F(FileManagerTest, getVirtualFileSetsTheDirFieldCorrectly) {
const FileEntry *file = manager.getVirtualFile("foo.cpp", 42, 0);
- ASSERT_TRUE(file != NULL);
+ ASSERT_TRUE(file != nullptr);
const DirectoryEntry *dir = file->getDir();
- ASSERT_TRUE(dir != NULL);
+ ASSERT_TRUE(dir != nullptr);
EXPECT_STREQ(".", dir->getName());
file = manager.getVirtualFile("x/y/z.cpp", 42, 0);
- ASSERT_TRUE(file != NULL);
+ ASSERT_TRUE(file != nullptr);
dir = file->getDir();
- ASSERT_TRUE(dir != NULL);
+ ASSERT_TRUE(dir != nullptr);
EXPECT_STREQ("x/y", dir->getName());
}
@@ -98,9 +98,9 @@ TEST_F(FileManagerTest, NoVirtualDirecto
// by what's in the real file system.
manager.addStatCache(new FakeStatCache);
- EXPECT_EQ(NULL, manager.getDirectory("virtual/dir/foo"));
- EXPECT_EQ(NULL, manager.getDirectory("virtual/dir"));
- EXPECT_EQ(NULL, manager.getDirectory("virtual"));
+ EXPECT_EQ(nullptr, manager.getDirectory("virtual/dir/foo"));
+ EXPECT_EQ(nullptr, manager.getDirectory("virtual/dir"));
+ EXPECT_EQ(nullptr, manager.getDirectory("virtual"));
}
// When a virtual file is added, all of its ancestors should be created.
@@ -109,14 +109,14 @@ TEST_F(FileManagerTest, getVirtualFileCr
manager.addStatCache(new FakeStatCache);
manager.getVirtualFile("virtual/dir/bar.h", 100, 0);
- EXPECT_EQ(NULL, manager.getDirectory("virtual/dir/foo"));
+ EXPECT_EQ(nullptr, manager.getDirectory("virtual/dir/foo"));
const DirectoryEntry *dir = manager.getDirectory("virtual/dir");
- ASSERT_TRUE(dir != NULL);
+ ASSERT_TRUE(dir != nullptr);
EXPECT_STREQ("virtual/dir", dir->getName());
dir = manager.getDirectory("virtual");
- ASSERT_TRUE(dir != NULL);
+ ASSERT_TRUE(dir != nullptr);
EXPECT_STREQ("virtual", dir->getName());
}
@@ -137,11 +137,11 @@ TEST_F(FileManagerTest, getFileReturnsVa
manager.addStatCache(statCache);
const FileEntry *file = manager.getFile("/tmp/test");
- ASSERT_TRUE(file != NULL);
+ ASSERT_TRUE(file != nullptr);
EXPECT_STREQ("/tmp/test", file->getName());
const DirectoryEntry *dir = file->getDir();
- ASSERT_TRUE(dir != NULL);
+ ASSERT_TRUE(dir != nullptr);
EXPECT_STREQ("/tmp", dir->getName());
#ifdef LLVM_ON_WIN32
@@ -161,11 +161,11 @@ TEST_F(FileManagerTest, getFileReturnsVa
manager.getVirtualFile("virtual/dir/bar.h", 100, 0);
const FileEntry *file = manager.getFile("virtual/dir/bar.h");
- ASSERT_TRUE(file != NULL);
+ ASSERT_TRUE(file != nullptr);
EXPECT_STREQ("virtual/dir/bar.h", file->getName());
const DirectoryEntry *dir = file->getDir();
- ASSERT_TRUE(dir != NULL);
+ ASSERT_TRUE(dir != nullptr);
EXPECT_STREQ("virtual/dir", dir->getName());
}
@@ -182,8 +182,8 @@ TEST_F(FileManagerTest, getFileReturnsDi
const FileEntry *fileFoo = manager.getFile("foo.cpp");
const FileEntry *fileBar = manager.getFile("bar.cpp");
- ASSERT_TRUE(fileFoo != NULL);
- ASSERT_TRUE(fileBar != NULL);
+ ASSERT_TRUE(fileFoo != nullptr);
+ ASSERT_TRUE(fileBar != nullptr);
EXPECT_NE(fileFoo, fileBar);
}
@@ -200,7 +200,7 @@ TEST_F(FileManagerTest, getFileReturnsNU
manager.getVirtualFile("bar.cpp", 200, 0);
const FileEntry *file = manager.getFile("xyz.txt");
- EXPECT_EQ(NULL, file);
+ EXPECT_EQ(nullptr, file);
}
// The following tests apply to Unix-like system only.
Modified: cfe/trunk/unittests/Basic/SourceManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/SourceManagerTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/SourceManagerTest.cpp (original)
+++ cfe/trunk/unittests/Basic/SourceManagerTest.cpp Sun Jun 8 03:38:12 2014
@@ -65,7 +65,7 @@ class VoidModuleLoader : public ModuleLo
bool Complain) override { }
GlobalModuleIndex *loadGlobalModuleIndex(SourceLocation TriggerLoc) override
- { return 0; }
+ { return nullptr; }
bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc) override
{ return 0; };
};
@@ -83,7 +83,7 @@ TEST_F(SourceManagerTest, isBeforeInTran
&*Target);
Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, SourceMgr,
HeaderInfo, ModLoader,
- /*IILookup =*/0,
+ /*IILookup =*/nullptr,
/*OwnsHeaderSearch =*/false);
PP.Initialize(*Target);
PP.EnterMainSourceFile();
@@ -168,7 +168,7 @@ TEST_F(SourceManagerTest, getColumnNumbe
EXPECT_TRUE(Invalid);
// Test with no invalid flag.
- EXPECT_EQ(1U, SourceMgr.getColumnNumber(MainFileID, 0, NULL));
+ EXPECT_EQ(1U, SourceMgr.getColumnNumber(MainFileID, 0, nullptr));
}
#if defined(LLVM_ON_UNIX)
@@ -200,7 +200,7 @@ TEST_F(SourceManagerTest, getMacroArgExp
&*Target);
Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, SourceMgr,
HeaderInfo, ModLoader,
- /*IILookup =*/0,
+ /*IILookup =*/nullptr,
/*OwnsHeaderSearch =*/false);
PP.Initialize(*Target);
PP.EnterMainSourceFile();
@@ -298,7 +298,7 @@ TEST_F(SourceManagerTest, isBeforeInTran
&*Target);
Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, SourceMgr,
HeaderInfo, ModLoader,
- /*IILookup =*/0,
+ /*IILookup =*/nullptr,
/*OwnsHeaderSearch =*/false);
PP.Initialize(*Target);
Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original)
+++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Sun Jun 8 03:38:12 2014
@@ -253,11 +253,11 @@ public:
TEST_F(VFSFromYAMLTest, BasicVFSFromYAML) {
IntrusiveRefCntPtr<vfs::FileSystem> FS;
FS = getFromYAMLString("");
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString("[]");
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString("'string'");
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
EXPECT_EQ(3, NumDiagnostics);
}
@@ -284,7 +284,7 @@ TEST_F(VFSFromYAMLTest, MappedFiles) {
"]\n"
"}",
Lower);
- ASSERT_TRUE(FS.getPtr() != NULL);
+ ASSERT_TRUE(FS.getPtr() != nullptr);
IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(
new vfs::OverlayFileSystem(Lower));
@@ -327,7 +327,7 @@ TEST_F(VFSFromYAMLTest, CaseInsensitive)
" ]\n"
"}]}",
Lower);
- ASSERT_TRUE(FS.getPtr() != NULL);
+ ASSERT_TRUE(FS.getPtr() != nullptr);
IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(
new vfs::OverlayFileSystem(Lower));
@@ -363,7 +363,7 @@ TEST_F(VFSFromYAMLTest, CaseSensitive) {
" ]\n"
"}]}",
Lower);
- ASSERT_TRUE(FS.getPtr() != NULL);
+ ASSERT_TRUE(FS.getPtr() != nullptr);
IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(
new vfs::OverlayFileSystem(Lower));
@@ -383,89 +383,89 @@ TEST_F(VFSFromYAMLTest, IllegalVFSFile)
// invalid YAML at top-level
IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLString("{]", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
// invalid YAML in roots
FS = getFromYAMLString("{ 'roots':[}", Lower);
// invalid YAML in directory
FS = getFromYAMLString(
"{ 'roots':[ { 'name': 'foo', 'type': 'directory', 'contents': [}",
Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
// invalid configuration
FS = getFromYAMLString("{ 'knobular': 'true', 'roots':[] }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString("{ 'case-sensitive': 'maybe', 'roots':[] }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
// invalid roots
FS = getFromYAMLString("{ 'roots':'' }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString("{ 'roots':{} }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
// invalid entries
FS = getFromYAMLString(
"{ 'roots':[ { 'type': 'other', 'name': 'me', 'contents': '' }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString("{ 'roots':[ { 'type': 'file', 'name': [], "
"'external-contents': 'other' }",
Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString(
"{ 'roots':[ { 'type': 'file', 'name': 'me', 'external-contents': [] }",
Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString(
"{ 'roots':[ { 'type': 'file', 'name': 'me', 'external-contents': {} }",
Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString(
"{ 'roots':[ { 'type': 'directory', 'name': 'me', 'contents': {} }",
Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString(
"{ 'roots':[ { 'type': 'directory', 'name': 'me', 'contents': '' }",
Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString(
"{ 'roots':[ { 'thingy': 'directory', 'name': 'me', 'contents': [] }",
Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
// missing mandatory fields
FS = getFromYAMLString("{ 'roots':[ { 'type': 'file', 'name': 'me' }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString(
"{ 'roots':[ { 'type': 'file', 'external-contents': 'other' }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString("{ 'roots':[ { 'name': 'me', 'contents': [] }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
// duplicate keys
FS = getFromYAMLString("{ 'roots':[], 'roots':[] }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString(
"{ 'case-sensitive':'true', 'case-sensitive':'true', 'roots':[] }",
Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS =
getFromYAMLString("{ 'roots':[{'name':'me', 'name':'you', 'type':'file', "
"'external-contents':'blah' } ] }",
Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
// missing version
FS = getFromYAMLRawString("{ 'roots':[] }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
// bad version number
FS = getFromYAMLRawString("{ 'version':'foo', 'roots':[] }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLRawString("{ 'version':-1, 'roots':[] }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLRawString("{ 'version':100000, 'roots':[] }", Lower);
- EXPECT_EQ(NULL, FS.getPtr());
+ EXPECT_EQ(nullptr, FS.getPtr());
EXPECT_EQ(24, NumDiagnostics);
}
@@ -487,7 +487,7 @@ TEST_F(VFSFromYAMLTest, UseExternalName)
" 'external-contents': '//root/external/file'\n"
" }\n"
"] }", Lower);
- ASSERT_TRUE(NULL != FS.getPtr());
+ ASSERT_TRUE(nullptr != FS.getPtr());
// default true
EXPECT_EQ("//root/external/file", FS->status("//root/A")->getName());
@@ -511,7 +511,7 @@ TEST_F(VFSFromYAMLTest, UseExternalName)
" 'external-contents': '//root/external/file'\n"
" }\n"
"] }", Lower);
- ASSERT_TRUE(NULL != FS.getPtr());
+ ASSERT_TRUE(nullptr != FS.getPtr());
// default
EXPECT_EQ("//root/A", FS->status("//root/A")->getName());
@@ -530,7 +530,7 @@ TEST_F(VFSFromYAMLTest, MultiComponentPa
" { 'type': 'file', 'name': '//root/path/to/file',\n"
" 'external-contents': '//root/other' }]\n"
"}", Lower);
- ASSERT_TRUE(NULL != FS.getPtr());
+ ASSERT_TRUE(nullptr != FS.getPtr());
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
EXPECT_FALSE(FS->status("//root/path/to").getError());
EXPECT_FALSE(FS->status("//root/path").getError());
@@ -543,7 +543,7 @@ TEST_F(VFSFromYAMLTest, MultiComponentPa
" 'contents': [ { 'type': 'file', 'name': 'file',\n"
" 'external-contents': '//root/other' }]}]\n"
"}", Lower);
- ASSERT_TRUE(NULL != FS.getPtr());
+ ASSERT_TRUE(nullptr != FS.getPtr());
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
EXPECT_FALSE(FS->status("//root/path/to").getError());
EXPECT_FALSE(FS->status("//root/path").getError());
@@ -556,7 +556,7 @@ TEST_F(VFSFromYAMLTest, MultiComponentPa
" 'contents': [ { 'type': 'file', 'name': 'path/to/file',\n"
" 'external-contents': '//root/other' }]}]\n"
"}", Lower);
- ASSERT_TRUE(NULL != FS.getPtr());
+ ASSERT_TRUE(nullptr != FS.getPtr());
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
EXPECT_FALSE(FS->status("//root/path/to").getError());
EXPECT_FALSE(FS->status("//root/path").getError());
@@ -574,7 +574,7 @@ TEST_F(VFSFromYAMLTest, TrailingSlashes)
" 'contents': [ { 'type': 'file', 'name': 'file',\n"
" 'external-contents': '//root/other' }]}]\n"
"}", Lower);
- ASSERT_TRUE(NULL != FS.getPtr());
+ ASSERT_TRUE(nullptr != FS.getPtr());
EXPECT_FALSE(FS->status("//root/path/to/file").getError());
EXPECT_FALSE(FS->status("//root/path/to").getError());
EXPECT_FALSE(FS->status("//root/path").getError());
Modified: cfe/trunk/unittests/Lex/LexerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/LexerTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Lex/LexerTest.cpp (original)
+++ cfe/trunk/unittests/Lex/LexerTest.cpp Sun Jun 8 03:38:12 2014
@@ -41,7 +41,7 @@ class VoidModuleLoader : public ModuleLo
bool Complain) override { }
GlobalModuleIndex *loadGlobalModuleIndex(SourceLocation TriggerLoc) override
- { return 0; }
+ { return nullptr; }
bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc) override
{ return 0; };
};
@@ -69,7 +69,7 @@ protected:
HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts,
Target.getPtr());
Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, SourceMgr,
- HeaderInfo, ModLoader, /*IILookup =*/0,
+ HeaderInfo, ModLoader, /*IILookup =*/nullptr,
/*OwnsHeaderSearch =*/false);
PP.Initialize(*Target);
PP.EnterMainSourceFile();
Modified: cfe/trunk/unittests/Lex/PPCallbacksTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/PPCallbacksTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Lex/PPCallbacksTest.cpp (original)
+++ cfe/trunk/unittests/Lex/PPCallbacksTest.cpp Sun Jun 8 03:38:12 2014
@@ -48,7 +48,7 @@ class VoidModuleLoader : public ModuleLo
bool Complain) override { }
GlobalModuleIndex *loadGlobalModuleIndex(SourceLocation TriggerLoc) override
- { return 0; }
+ { return nullptr; }
bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc) override
{ return 0; };
};
@@ -174,7 +174,7 @@ protected:
IntrusiveRefCntPtr<PreprocessorOptions> PPOpts = new PreprocessorOptions();
Preprocessor PP(PPOpts, Diags, LangOpts, SourceMgr, HeaderInfo, ModLoader,
- /*IILookup =*/0,
+ /*IILookup =*/nullptr,
/*OwnsHeaderSearch =*/false);
PP.Initialize(*Target);
InclusionDirectiveCallbacks* Callbacks = new InclusionDirectiveCallbacks;
@@ -207,7 +207,7 @@ protected:
OpenCLLangOpts, Target.getPtr());
Preprocessor PP(new PreprocessorOptions(), Diags, OpenCLLangOpts, SourceMgr,
- HeaderInfo, ModLoader, /*IILookup =*/0,
+ HeaderInfo, ModLoader, /*IILookup =*/nullptr,
/*OwnsHeaderSearch =*/false);
PP.Initialize(*Target);
Modified: cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp (original)
+++ cfe/trunk/unittests/Lex/PPConditionalDirectiveRecordTest.cpp Sun Jun 8 03:38:12 2014
@@ -65,7 +65,7 @@ class VoidModuleLoader : public ModuleLo
bool Complain) override { }
GlobalModuleIndex *loadGlobalModuleIndex(SourceLocation TriggerLoc) override
- { return 0; }
+ { return nullptr; }
bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc) override
{ return 0; };
};
@@ -98,7 +98,7 @@ TEST_F(PPConditionalDirectiveRecordTest,
Target.getPtr());
Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, SourceMgr,
HeaderInfo, ModLoader,
- /*IILookup =*/0,
+ /*IILookup =*/nullptr,
/*OwnsHeaderSearch =*/false);
PP.Initialize(*Target);
PPConditionalDirectiveRecord *
Modified: cfe/trunk/unittests/Sema/ExternalSemaSourceTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Sema/ExternalSemaSourceTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Sema/ExternalSemaSourceTest.cpp (original)
+++ cfe/trunk/unittests/Sema/ExternalSemaSourceTest.cpp Sun Jun 8 03:38:12 2014
@@ -49,7 +49,7 @@ class NamespaceDiagnosticWatcher : publi
public:
NamespaceDiagnosticWatcher(StringRef From, StringRef To)
- : Chained(NULL), FromNS(From), ToNS("'"), SeenCount(0) {
+ : Chained(nullptr), FromNS(From), ToNS("'"), SeenCount(0) {
ToNS.append(To);
ToNS.append("'");
}
@@ -95,11 +95,11 @@ class NamespaceTypoProvider : public cla
public:
NamespaceTypoProvider(StringRef From, StringRef To)
- : CorrectFrom(From), CorrectTo(To), CurrentSema(NULL), CallCount(0) {}
+ : CorrectFrom(From), CorrectTo(To), CurrentSema(nullptr), CallCount(0) {}
virtual void InitializeSema(Sema &S) { CurrentSema = &S; }
- virtual void ForgetSema() { CurrentSema = NULL; }
+ virtual void ForgetSema() { CurrentSema = nullptr; }
virtual TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo,
int LookupKind, Scope *S, CXXScopeSpec *SS,
@@ -109,17 +109,17 @@ public:
const ObjCObjectPointerType *OPT) {
++CallCount;
if (CurrentSema && Typo.getName().getAsString() == CorrectFrom) {
- DeclContext *DestContext = NULL;
+ DeclContext *DestContext = nullptr;
ASTContext &Context = CurrentSema->getASTContext();
- if (SS != NULL)
+ if (SS)
DestContext = CurrentSema->computeDeclContext(*SS, EnteringContext);
- if (DestContext == NULL)
+ if (!DestContext)
DestContext = Context.getTranslationUnitDecl();
IdentifierInfo *ToIdent =
CurrentSema->getPreprocessor().getIdentifierInfo(CorrectTo);
NamespaceDecl *NewNamespace =
NamespaceDecl::Create(Context, DestContext, false, Typo.getBeginLoc(),
- Typo.getLoc(), ToIdent, NULL);
+ Typo.getLoc(), ToIdent, nullptr);
DestContext->addDecl(NewNamespace);
TypoCorrection Correction(ToIdent);
Correction.addCorrectionDecl(NewNamespace);
@@ -149,7 +149,7 @@ protected:
virtual void ExecuteAction() {
CompilerInstance &CI = getCompilerInstance();
ASSERT_FALSE(CI.hasSema());
- CI.createSema(getTranslationUnitKind(), NULL);
+ CI.createSema(getTranslationUnitKind(), nullptr);
ASSERT_TRUE(CI.hasDiagnostics());
DiagnosticsEngine &Diagnostics = CI.getDiagnostics();
DiagnosticConsumer *Client = Diagnostics.getClient();
Modified: cfe/trunk/unittests/Tooling/CommentHandlerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CommentHandlerTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/CommentHandlerTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/CommentHandlerTest.cpp Sun Jun 8 03:38:12 2014
@@ -28,7 +28,7 @@ class CommentHandlerVisitor : public Tes
typedef TestVisitor<CommentHandlerVisitor> base;
public:
- CommentHandlerVisitor() : base(), PP(0), Verified(false) { }
+ CommentHandlerVisitor() : base(), PP(nullptr), Verified(false) {}
~CommentHandlerVisitor() {
EXPECT_TRUE(Verified) << "CommentVerifier not accessed";
Modified: cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp Sun Jun 8 03:38:12 2014
@@ -22,8 +22,8 @@ namespace tooling {
static void expectFailure(StringRef JSONDatabase, StringRef Explanation) {
std::string ErrorMessage;
- EXPECT_EQ(NULL, JSONCompilationDatabase::loadFromBuffer(JSONDatabase,
- ErrorMessage))
+ EXPECT_EQ(nullptr, JSONCompilationDatabase::loadFromBuffer(JSONDatabase,
+ ErrorMessage))
<< "Expected an error because of: " << Explanation.str();
}
@@ -434,7 +434,7 @@ TEST(FixedCompilationDatabase, GetAllCom
TEST(ParseFixedCompilationDatabase, ReturnsNullOnEmptyArgumentList) {
int Argc = 0;
std::unique_ptr<FixedCompilationDatabase> Database(
- FixedCompilationDatabase::loadFromCommandLine(Argc, NULL));
+ FixedCompilationDatabase::loadFromCommandLine(Argc, nullptr));
EXPECT_FALSE(Database);
EXPECT_EQ(0, Argc);
}
Modified: cfe/trunk/unittests/Tooling/RefactoringTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RefactoringTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/RefactoringTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/RefactoringTest.cpp Sun Jun 8 03:38:12 2014
@@ -236,7 +236,7 @@ public:
OutStream << Content;
OutStream.close();
const FileEntry *File = Context.Files.getFile(Path);
- assert(File != NULL);
+ assert(File != nullptr);
StringRef Found = TemporaryFiles.GetOrCreateValue(Name, Path.str()).second;
assert(Found == Path);
@@ -253,7 +253,7 @@ public:
// FIXME: Figure out whether there is a way to get the SourceManger to
// reopen the file.
std::unique_ptr<const llvm::MemoryBuffer> FileBuffer(
- Context.Files.getBufferForFile(Path, NULL));
+ Context.Files.getBufferForFile(Path, nullptr));
return FileBuffer->getBuffer();
}
Modified: cfe/trunk/unittests/Tooling/RewriterTestContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RewriterTestContext.h?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/RewriterTestContext.h (original)
+++ cfe/trunk/unittests/Tooling/RewriterTestContext.h Sun Jun 8 03:38:12 2014
@@ -53,7 +53,7 @@ class RewriterTestContext {
const FileEntry *Entry =
Files.getVirtualFile(Name, Source->getBufferSize(), 0);
Sources.overrideFileContents(Entry, Source);
- assert(Entry != NULL);
+ assert(Entry != nullptr);
return Sources.createFileID(Entry, SourceLocation(), SrcMgr::C_User);
}
@@ -71,7 +71,7 @@ class RewriterTestContext {
OutStream << Content;
OutStream.close();
const FileEntry *File = Files.getFile(Path);
- assert(File != NULL);
+ assert(File != nullptr);
StringRef Found = TemporaryFiles.GetOrCreateValue(Name, Path.str()).second;
assert(Found == Path);
@@ -103,7 +103,7 @@ class RewriterTestContext {
// FIXME: Figure out whether there is a way to get the SourceManger to
// reopen the file.
std::unique_ptr<const llvm::MemoryBuffer> FileBuffer(
- Files.getBufferForFile(Path, NULL));
+ Files.getBufferForFile(Path, nullptr));
return FileBuffer->getBuffer();
}
Modified: cfe/trunk/unittests/Tooling/ToolingTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/ToolingTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/ToolingTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/ToolingTest.cpp Sun Jun 8 03:38:12 2014
@@ -121,12 +121,12 @@ TEST(newFrontendActionFactory, CreatesFr
std::unique_ptr<FrontendActionFactory> Factory(
newFrontendActionFactory<SyntaxOnlyAction>());
std::unique_ptr<FrontendAction> Action(Factory->create());
- EXPECT_TRUE(Action.get() != NULL);
+ EXPECT_TRUE(Action.get() != nullptr);
}
struct IndependentFrontendActionCreator {
ASTConsumer *newASTConsumer() {
- return new FindTopLevelDeclConsumer(NULL);
+ return new FindTopLevelDeclConsumer(nullptr);
}
};
@@ -135,7 +135,7 @@ TEST(newFrontendActionFactory, CreatesFr
std::unique_ptr<FrontendActionFactory> Factory(
newFrontendActionFactory(&Creator));
std::unique_ptr<FrontendAction> Action(Factory->create());
- EXPECT_TRUE(Action.get() != NULL);
+ EXPECT_TRUE(Action.get() != nullptr);
}
TEST(ToolInvocation, TestMapVirtualFile) {
Modified: cfe/trunk/unittests/libclang/LibclangTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/libclang/LibclangTest.cpp?rev=210423&r1=210422&r2=210423&view=diff
==============================================================================
--- cfe/trunk/unittests/libclang/LibclangTest.cpp (original)
+++ cfe/trunk/unittests/libclang/LibclangTest.cpp Sun Jun 8 03:38:12 2014
@@ -12,21 +12,22 @@
TEST(libclang, clang_parseTranslationUnit2_InvalidArgs) {
EXPECT_EQ(CXError_InvalidArguments,
- clang_parseTranslationUnit2(0, 0, 0, 0, 0, 0, 0, 0));
+ clang_parseTranslationUnit2(nullptr, nullptr, nullptr, 0, nullptr,
+ 0, 0, nullptr));
}
TEST(libclang, clang_createTranslationUnit_InvalidArgs) {
- EXPECT_EQ(0, clang_createTranslationUnit(0, 0));
+ EXPECT_EQ(nullptr, clang_createTranslationUnit(nullptr, nullptr));
}
TEST(libclang, clang_createTranslationUnit2_InvalidArgs) {
EXPECT_EQ(CXError_InvalidArguments,
- clang_createTranslationUnit2(0, 0, 0));
+ clang_createTranslationUnit2(nullptr, nullptr, nullptr));
CXTranslationUnit TU = reinterpret_cast<CXTranslationUnit>(1);
EXPECT_EQ(CXError_InvalidArguments,
- clang_createTranslationUnit2(0, 0, &TU));
- EXPECT_EQ(0, TU);
+ clang_createTranslationUnit2(nullptr, nullptr, &TU));
+ EXPECT_EQ(nullptr, TU);
}
namespace {
@@ -107,7 +108,7 @@ TEST(libclang, VirtualFileOverlay_Unicod
}
TEST(libclang, VirtualFileOverlay_InvalidArgs) {
- TestVFO T(NULL);
+ TestVFO T(nullptr);
T.mapError("/path/./virtual/../foo.h", "/real/foo.h",
CXError_InvalidArguments);
}
More information about the cfe-commits
mailing list