[PATCH] Replace OwningPtr::isValid() with conversion to bool.
Ahmed Charles
acharles at outlook.com
Fri Mar 7 03:25:22 PST 2014
ahmedcharles added you to the CC list for the revision "Replace OwningPtr::isValid() with conversion to bool.".
Hi dblaikie, chandlerc,
This is a precursor to moving to std::unique_ptr.
http://llvm-reviews.chandlerc.com/D3001
Files:
include/clang/Frontend/ASTUnit.h
include/clang/Frontend/CompilerInstance.h
include/clang/Frontend/FrontendAction.h
include/clang/Lex/HeaderSearch.h
include/clang/Serialization/ASTReader.h
include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
lib/Rewrite/Core/Rewriter.cpp
unittests/Tooling/CompilationDatabaseTest.cpp
Index: include/clang/Frontend/ASTUnit.h
===================================================================
--- include/clang/Frontend/ASTUnit.h
+++ include/clang/Frontend/ASTUnit.h
@@ -500,7 +500,7 @@
void setASTContext(ASTContext *ctx) { Ctx = ctx; }
void setPreprocessor(Preprocessor *pp);
- bool hasSema() const { return TheSema.isValid(); }
+ bool hasSema() const { return bool(TheSema); }
Sema &getSema() const {
assert(TheSema && "ASTUnit does not have a Sema object!");
return *TheSema;
Index: include/clang/Frontend/CompilerInstance.h
===================================================================
--- include/clang/Frontend/CompilerInstance.h
+++ include/clang/Frontend/CompilerInstance.h
@@ -426,7 +426,7 @@
/// @name ASTConsumer
/// {
- bool hasASTConsumer() const { return Consumer.isValid(); }
+ bool hasASTConsumer() const { return bool(Consumer); }
ASTConsumer &getASTConsumer() const {
assert(Consumer && "Compiler instance has no AST consumer!");
@@ -444,7 +444,7 @@
/// }
/// @name Semantic analysis
/// {
- bool hasSema() const { return TheSema.isValid(); }
+ bool hasSema() const { return bool(TheSema); }
Sema &getSema() const {
assert(TheSema && "Compiler instance has no Sema object!");
@@ -465,7 +465,7 @@
/// {
bool hasCodeCompletionConsumer() const {
- return CompletionConsumer.isValid();
+ return bool(CompletionConsumer);
}
CodeCompleteConsumer &getCodeCompletionConsumer() const {
@@ -488,7 +488,7 @@
/// @name Frontend timer
/// {
- bool hasFrontendTimer() const { return FrontendTimer.isValid(); }
+ bool hasFrontendTimer() const { return bool(FrontendTimer); }
llvm::Timer &getFrontendTimer() const {
assert(FrontendTimer && "Compiler instance has no frontend timer!");
Index: include/clang/Frontend/FrontendAction.h
===================================================================
--- include/clang/Frontend/FrontendAction.h
+++ include/clang/Frontend/FrontendAction.h
@@ -124,7 +124,7 @@
bool isCurrentFileAST() const {
assert(!CurrentInput.isEmpty() && "No current file!");
- return CurrentASTUnit.isValid();
+ return bool(CurrentASTUnit);
}
const FrontendInputFile &getCurrentInput() const {
Index: include/clang/Lex/HeaderSearch.h
===================================================================
--- include/clang/Lex/HeaderSearch.h
+++ include/clang/Lex/HeaderSearch.h
@@ -282,7 +282,7 @@
/// \brief Checks whether the map exists or not.
bool HasIncludeAliasMap() const {
- return IncludeAliases.isValid();
+ return bool(IncludeAliases);
}
/// \brief Map the source include name to the dest include name.
Index: include/clang/Serialization/ASTReader.h
===================================================================
--- include/clang/Serialization/ASTReader.h
+++ include/clang/Serialization/ASTReader.h
@@ -1333,7 +1333,7 @@
void setDeserializationListener(ASTDeserializationListener *Listener);
/// \brief Determine whether this AST reader has a global index.
- bool hasGlobalIndex() const { return GlobalIndex.isValid(); }
+ bool hasGlobalIndex() const { return bool(GlobalIndex); }
/// \brief Attempts to load the global index.
///
Index: include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
===================================================================
--- include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
+++ include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
@@ -525,7 +525,7 @@
}
bool hasCallStackHint() {
- return CallStackHint.isValid();
+ return bool(CallStackHint);
}
/// Produce the hint for the given node. The node contains
Index: lib/Rewrite/Core/Rewriter.cpp
===================================================================
--- lib/Rewrite/Core/Rewriter.cpp
+++ lib/Rewrite/Core/Rewriter.cpp
@@ -464,7 +464,7 @@
}
}
- bool ok() { return FileStream.isValid(); }
+ bool ok() { return bool(FileStream); }
raw_ostream &getStream() { return *FileStream; }
private:
Index: unittests/Tooling/CompilationDatabaseTest.cpp
===================================================================
--- unittests/Tooling/CompilationDatabaseTest.cpp
+++ unittests/Tooling/CompilationDatabaseTest.cpp
@@ -455,7 +455,7 @@
};
OwningPtr<FixedCompilationDatabase> Database(
FixedCompilationDatabase::loadFromCommandLine(Argc, Argv));
- ASSERT_TRUE(Database.isValid());
+ ASSERT_TRUE(bool(Database));
std::vector<CompileCommand> Result =
Database->getCompileCommands("source");
ASSERT_EQ(1ul, Result.size());
@@ -474,7 +474,7 @@
const char *Argv[] = { "1", "2", "--\0no-constant-folding" };
OwningPtr<FixedCompilationDatabase> Database(
FixedCompilationDatabase::loadFromCommandLine(Argc, Argv));
- ASSERT_TRUE(Database.isValid());
+ ASSERT_TRUE(bool(Database));
std::vector<CompileCommand> Result =
Database->getCompileCommands("source");
ASSERT_EQ(1ul, Result.size());
@@ -491,7 +491,7 @@
int Argc = sizeof(Argv) / sizeof(char*);
OwningPtr<FixedCompilationDatabase> Database(
FixedCompilationDatabase::loadFromCommandLine(Argc, Argv));
- ASSERT_TRUE(Database.isValid());
+ ASSERT_TRUE(bool(Database));
std::vector<CompileCommand> Result =
Database->getCompileCommands("source");
ASSERT_EQ(1ul, Result.size());
@@ -510,7 +510,7 @@
int Argc = sizeof(Argv) / sizeof(char*);
OwningPtr<FixedCompilationDatabase> Database(
FixedCompilationDatabase::loadFromCommandLine(Argc, Argv));
- ASSERT_TRUE(Database.isValid());
+ ASSERT_TRUE(bool(Database));
std::vector<CompileCommand> Result =
Database->getCompileCommands("source");
ASSERT_EQ(1ul, Result.size());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3001.1.patch
Type: text/x-patch
Size: 5767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140307/238a050f/attachment.bin>
More information about the cfe-commits
mailing list