diff options
author | Ahmed Charles <ahmedcharles@gmail.com> | 2014-03-07 19:51:06 +0000 |
---|---|---|
committer | Ahmed Charles <ahmedcharles@gmail.com> | 2014-03-07 19:51:06 +0000 |
commit | d72a5f103da45e5abe10497308fce5aeb992cdc2 (patch) | |
tree | 306cc66d0705d54685ef7cee0fa0000c898f3dcc | |
parent | 571e2fecf85b3d89a419e5f8416115400b2d8b5f (diff) | |
download | bcm5719-llvm-d72a5f103da45e5abe10497308fce5aeb992cdc2.tar.gz bcm5719-llvm-d72a5f103da45e5abe10497308fce5aeb992cdc2.zip |
Replace OwningPtr::isValid() with conversion to bool.
This is a precursor to moving to std::unique_ptr.
llvm-svn: 203277
-rw-r--r-- | clang/include/clang/Frontend/ASTUnit.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Frontend/CompilerInstance.h | 12 | ||||
-rw-r--r-- | clang/include/clang/Frontend/FrontendAction.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Lex/HeaderSearch.h | 4 | ||||
-rw-r--r-- | clang/include/clang/Serialization/ASTReader.h | 2 | ||||
-rw-r--r-- | clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h | 6 | ||||
-rw-r--r-- | clang/lib/Rewrite/Core/Rewriter.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 8 |
8 files changed, 16 insertions, 22 deletions
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h index 6ff6250e426..3cf6d18642f 100644 --- a/clang/include/clang/Frontend/ASTUnit.h +++ b/clang/include/clang/Frontend/ASTUnit.h @@ -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; diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index 7c4d754bf9c..62aeca103ca 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/include/clang/Frontend/CompilerInstance.h @@ -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!"); diff --git a/clang/include/clang/Frontend/FrontendAction.h b/clang/include/clang/Frontend/FrontendAction.h index 07b60c079d8..034d38c1d8b 100644 --- a/clang/include/clang/Frontend/FrontendAction.h +++ b/clang/include/clang/Frontend/FrontendAction.h @@ -124,7 +124,7 @@ public: bool isCurrentFileAST() const { assert(!CurrentInput.isEmpty() && "No current file!"); - return CurrentASTUnit.isValid(); + return (bool)CurrentASTUnit; } const FrontendInputFile &getCurrentInput() const { diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h index 0c6170abe79..93efa2d4a3c 100644 --- a/clang/include/clang/Lex/HeaderSearch.h +++ b/clang/include/clang/Lex/HeaderSearch.h @@ -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. /// diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index 2dc1d282757..1fb493084c7 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -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. /// diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h index bdffd70026d..0bbe1985e2e 100644 --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -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. diff --git a/clang/lib/Rewrite/Core/Rewriter.cpp b/clang/lib/Rewrite/Core/Rewriter.cpp index 9bcb264597c..e5f65c28cf9 100644 --- a/clang/lib/Rewrite/Core/Rewriter.cpp +++ b/clang/lib/Rewrite/Core/Rewriter.cpp @@ -464,7 +464,7 @@ public: } } - bool ok() { return FileStream.isValid(); } + bool ok() { return (bool)FileStream; } raw_ostream &getStream() { return *FileStream; } private: diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index 4920d6d66bb..9260e621b38 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -455,7 +455,7 @@ TEST(ParseFixedCompilationDatabase, ReturnsArgumentsAfterDoubleDash) { }; 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, ReturnsEmptyCommandLine) { 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, HandlesPositionalArgs) { 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, HandlesArgv0) { 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()); |