r203277 - Replace OwningPtr::isValid() with conversion to bool.
Ahmed Charles
ahmedcharles at gmail.com
Fri Mar 7 11:51:07 PST 2014
Author: ace2001ac
Date: Fri Mar 7 13:51:06 2014
New Revision: 203277
URL: http://llvm.org/viewvc/llvm-project?rev=203277&view=rev
Log:
Replace OwningPtr::isValid() with conversion to bool.
This is a precursor to moving to std::unique_ptr.
Modified:
cfe/trunk/include/clang/Frontend/ASTUnit.h
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/include/clang/Frontend/FrontendAction.h
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/lib/Rewrite/Core/Rewriter.cpp
cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=203277&r1=203276&r2=203277&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Fri Mar 7 13:51:06 2014
@@ -500,7 +500,7 @@ public:
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;
Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=203277&r1=203276&r2=203277&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Fri Mar 7 13:51:06 2014
@@ -426,7 +426,7 @@ public:
/// @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,8 +444,8 @@ public:
/// }
/// @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!");
return *TheSema;
@@ -464,9 +464,7 @@ public:
/// @name Code Completion
/// {
- bool hasCodeCompletionConsumer() const {
- return CompletionConsumer.isValid();
- }
+ bool hasCodeCompletionConsumer() const { return (bool)CompletionConsumer; }
CodeCompleteConsumer &getCodeCompletionConsumer() const {
assert(CompletionConsumer &&
@@ -488,7 +486,7 @@ public:
/// @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!");
Modified: cfe/trunk/include/clang/Frontend/FrontendAction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendAction.h?rev=203277&r1=203276&r2=203277&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/FrontendAction.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendAction.h Fri Mar 7 13:51:06 2014
@@ -124,7 +124,7 @@ public:
bool isCurrentFileAST() const {
assert(!CurrentInput.isEmpty() && "No current file!");
- return CurrentASTUnit.isValid();
+ return (bool)CurrentASTUnit;
}
const FrontendInputFile &getCurrentInput() const {
Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=203277&r1=203276&r2=203277&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Fri Mar 7 13:51:06 2014
@@ -281,9 +281,7 @@ public:
}
/// \brief Checks whether the map exists or not.
- bool HasIncludeAliasMap() const {
- return IncludeAliases.isValid();
- }
+ bool HasIncludeAliasMap() const { return (bool)IncludeAliases; }
/// \brief Map the source include name to the dest include name.
///
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=203277&r1=203276&r2=203277&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Mar 7 13:51:06 2014
@@ -1333,7 +1333,7 @@ public:
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.
///
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=203277&r1=203276&r2=203277&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Fri Mar 7 13:51:06 2014
@@ -523,10 +523,8 @@ public:
bool isPrunable() const {
return IsPrunable.hasValue() ? IsPrunable.getValue() : false;
}
-
- bool hasCallStackHint() {
- return CallStackHint.isValid();
- }
+
+ bool hasCallStackHint() { return (bool)CallStackHint; }
/// Produce the hint for the given node. The node contains
/// information about the call for which the diagnostic can be generated.
Modified: cfe/trunk/lib/Rewrite/Core/Rewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Core/Rewriter.cpp?rev=203277&r1=203276&r2=203277&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/Core/Rewriter.cpp (original)
+++ cfe/trunk/lib/Rewrite/Core/Rewriter.cpp Fri Mar 7 13:51:06 2014
@@ -464,7 +464,7 @@ public:
}
}
- bool ok() { return FileStream.isValid(); }
+ bool ok() { return (bool)FileStream; }
raw_ostream &getStream() { return *FileStream; }
private:
Modified: cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp?rev=203277&r1=203276&r2=203277&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp Fri Mar 7 13:51:06 2014
@@ -455,7 +455,7 @@ TEST(ParseFixedCompilationDatabase, Retu
};
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 @@ TEST(ParseFixedCompilationDatabase, Retu
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 @@ TEST(ParseFixedCompilationDatabase, Hand
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 @@ TEST(ParseFixedCompilationDatabase, Hand
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());
More information about the cfe-commits
mailing list