[cfe-commits] r160355 - in /cfe/trunk: include/clang/Tooling/RefactoringCallbacks.h lib/Tooling/RefactoringCallbacks.cpp unittests/Tooling/RefactoringCallbacksTest.cpp

Alexander Potapenko glider at google.com
Tue Jul 17 01:45:29 PDT 2012


Hi Daniel,

this change broke ASan build on Linux x86_64:

llvm[4]: Linking Release+Asserts unit test Tooling (without symbols)
Undefined symbols for architecture x86_64:
  "clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()",
referenced from:
      clang::ast_matchers::RefactoringCallbacksTest_ReplacesStmtsWithString_Test::TestBody()
in RefactoringCallbacksTest.o
      clang::ast_matchers::RefactoringCallbacksTest_ReplacesStmtsInCalledMacros_Test::TestBody()
in RefactoringCallbacksTest.o
      clang::ast_matchers::RefactoringCallbacksTest_IgnoresStmtsInUncalledMacros_Test::TestBody()
in RefactoringCallbacksTest.o
      clang::ast_matchers::RefactoringCallbacksTest_ReplacesInteger_Test::TestBody()
in RefactoringCallbacksTest.o
      clang::ast_matchers::RefactoringCallbacksTest_ReplacesStmtWithStmt_Test::TestBody()
in RefactoringCallbacksTest.o
      clang::ast_matchers::RefactoringCallbacksTest_ReplacesIfStmt_Test::TestBody()
in RefactoringCallbacksTest.o
      clang::ast_matchers::RefactoringCallbacksTest_RemovesEntireIfOnEmptyElse_Test::TestBody()
in RefactoringCallbacksTest.o
      ...
  "clang::ast_matchers::MatchFinder::MatchFinder()", referenced from:
      void clang::ast_matchers::expectRewritten<clang::ast_matchers::internal::Matcher<clang::Stmt>
>(std::string const&, std::string const&,
clang::ast_matchers::internal::Matcher<clang::Stmt> const&,
clang::ast_matchers::RefactoringCallback&) in
RefactoringCallbacksTest.o
  "clang::ast_matchers::MatchFinder::addMatcher(clang::ast_matchers::internal::Matcher<clang::Stmt>
const&, clang::ast_matchers::MatchFinder::MatchCallback*)", referenced
from:
      void clang::ast_matchers::expectRewritten<clang::ast_matchers::internal::Matcher<clang::Stmt>
>(std::string const&, std::string const&,
clang::ast_matchers::internal::Matcher<clang::Stmt> const&,
clang::ast_matchers::RefactoringCallback&) in
RefactoringCallbacksTest.o
  "clang::ast_matchers::MatchFinder::~MatchFinder()", referenced from:
      void clang::ast_matchers::expectRewritten<clang::ast_matchers::internal::Matcher<clang::Stmt>
>(std::string const&, std::string const&,
clang::ast_matchers::internal::Matcher<clang::Stmt> const&,
clang::ast_matchers::RefactoringCallback&) in
RefactoringCallbacksTest.o
  "clang::ast_matchers::MatchFinder::newASTConsumer()", referenced from:
      clang::tooling::FrontendActionFactory*
clang::tooling::newFrontendActionFactory<clang::ast_matchers::MatchFinder>(clang::ast_matchers::MatchFinder*)::clang::tooling::newFrontendActionFactory<clang::ast_matchers::MatchFinder>::FrontendActionFactoryAdapter::ConsumerFactoryAdaptor::CreateASTConsumer(clang::CompilerInstance&,
llvm::StringRef) in RefactoringCallbacksTest.o
  "clang::ast_matchers::internal::BoundNodesTreeBuilder::setBinding(std::string
const&, clang::Stmt const*)", referenced from:
      clang::ast_matchers::internal::IdMatcher<clang::Stmt>::matches(clang::Stmt
const&, clang::ast_matchers::internal::ASTMatchFinder*,
clang::ast_matchers::internal::BoundNodesTreeBuilder*) const in
RefactoringCallbacksTest.o
ld: symbol(s) not found for architecture x86_64

On Tue, Jul 17, 2012 at 12:37 PM, Daniel Jasper <djasper at google.com> wrote:
> Author: djasper
> Date: Tue Jul 17 03:37:03 2012
> New Revision: 160355
>
> URL: http://llvm.org/viewvc/llvm-project?rev=160355&view=rev
> Log:
> Finishing the move of RefactoringCallbacks and fixing the corresponding
> buildbot failures.
>
> Modified:
>     cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
>     cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
>     cfe/trunk/unittests/Tooling/RefactoringCallbacksTest.cpp
>
> Modified: cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h?rev=160355&r1=160354&r2=160355&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h (original)
> +++ cfe/trunk/include/clang/Tooling/RefactoringCallbacks.h Tue Jul 17 03:37:03 2012
> @@ -33,18 +33,18 @@
>  #include "clang/Tooling/Refactoring.h"
>
>  namespace clang {
> -namespace ast_matchers {
> +namespace tooling {
>
>  /// \brief Base class for RefactoringCallbacks.
>  ///
>  /// Collects \c tooling::Replacements while running.
> -class RefactoringCallback : public MatchFinder::MatchCallback {
> +class RefactoringCallback : public ast_matchers::MatchFinder::MatchCallback {
>  public:
>    RefactoringCallback();
> -  tooling::Replacements &getReplacements();
> +  Replacements &getReplacements();
>
>  protected:
> -  tooling::Replacements Replace;
> +  Replacements Replace;
>  };
>
>  /// \brief Replace the text of the statement bound to \c FromId with the text in
> @@ -52,7 +52,7 @@
>  class ReplaceStmtWithText : public RefactoringCallback {
>  public:
>    ReplaceStmtWithText(StringRef FromId, StringRef ToText);
> -  virtual void run(const MatchFinder::MatchResult &Result);
> +  virtual void run(const ast_matchers::MatchFinder::MatchResult &Result);
>
>  private:
>    std::string FromId;
> @@ -64,7 +64,7 @@
>  class ReplaceStmtWithStmt : public RefactoringCallback {
>  public:
>    ReplaceStmtWithStmt(StringRef FromId, StringRef ToId);
> -  virtual void run(const MatchFinder::MatchResult &Result);
> +  virtual void run(const ast_matchers::MatchFinder::MatchResult &Result);
>
>  private:
>    std::string FromId;
> @@ -77,14 +77,14 @@
>  class ReplaceIfStmtWithItsBody : public RefactoringCallback {
>  public:
>    ReplaceIfStmtWithItsBody(StringRef Id, bool PickTrueBranch);
> -  virtual void run(const MatchFinder::MatchResult &Result);
> +  virtual void run(const ast_matchers::MatchFinder::MatchResult &Result);
>
>  private:
>    std::string Id;
>    const bool PickTrueBranch;
>  };
>
> -} // end namespace ast_matchers
> +} // end namespace tooling
>  } // end namespace clang
>
>  #endif // LLVM_CLANG_TOOLING_REFACTORING_CALLBACKS_H
>
> Modified: cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp?rev=160355&r1=160354&r2=160355&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp (original)
> +++ cfe/trunk/lib/Tooling/RefactoringCallbacks.cpp Tue Jul 17 03:37:03 2012
> @@ -13,22 +13,22 @@
>  #include "clang/Tooling/RefactoringCallbacks.h"
>
>  namespace clang {
> -namespace ast_matchers {
> +namespace tooling {
>
>  RefactoringCallback::RefactoringCallback() {}
>  tooling::Replacements &RefactoringCallback::getReplacements() {
>    return Replace;
>  }
>
> -static tooling::Replacement replaceStmtWithText(SourceManager &Sources,
> -                                                const Stmt &From,
> -                                                StringRef Text) {
> +static Replacement replaceStmtWithText(SourceManager &Sources,
> +                                       const Stmt &From,
> +                                       StringRef Text) {
>    return tooling::Replacement(Sources, CharSourceRange::getTokenRange(
>        From.getSourceRange()), Text);
>  }
> -static tooling::Replacement replaceStmtWithStmt(SourceManager &Sources,
> -                                                const Stmt &From,
> -                                                const Stmt &To) {
> +static Replacement replaceStmtWithStmt(SourceManager &Sources,
> +                                       const Stmt &From,
> +                                       const Stmt &To) {
>    return replaceStmtWithText(Sources, From, Lexer::getSourceText(
>        CharSourceRange::getTokenRange(To.getSourceRange()),
>        Sources, LangOptions()));
> @@ -37,7 +37,8 @@
>  ReplaceStmtWithText::ReplaceStmtWithText(StringRef FromId, StringRef ToText)
>      : FromId(FromId), ToText(ToText) {}
>
> -void ReplaceStmtWithText::run(const MatchFinder::MatchResult &Result) {
> +void ReplaceStmtWithText::run(
> +    const ast_matchers::MatchFinder::MatchResult &Result) {
>    if (const Stmt *FromMatch = Result.Nodes.getStmtAs<Stmt>(FromId)) {
>      Replace.insert(tooling::Replacement(
>          *Result.SourceManager,
> @@ -49,7 +50,8 @@
>  ReplaceStmtWithStmt::ReplaceStmtWithStmt(StringRef FromId, StringRef ToId)
>      : FromId(FromId), ToId(ToId) {}
>
> -void ReplaceStmtWithStmt::run(const MatchFinder::MatchResult &Result) {
> +void ReplaceStmtWithStmt::run(
> +    const ast_matchers::MatchFinder::MatchResult &Result) {
>    const Stmt *FromMatch = Result.Nodes.getStmtAs<Stmt>(FromId);
>    const Stmt *ToMatch = Result.Nodes.getStmtAs<Stmt>(ToId);
>    if (FromMatch && ToMatch)
> @@ -61,7 +63,8 @@
>                                                     bool PickTrueBranch)
>      : Id(Id), PickTrueBranch(PickTrueBranch) {}
>
> -void ReplaceIfStmtWithItsBody::run(const MatchFinder::MatchResult &Result) {
> +void ReplaceIfStmtWithItsBody::run(
> +    const ast_matchers::MatchFinder::MatchResult &Result) {
>    if (const IfStmt *Node = Result.Nodes.getStmtAs<IfStmt>(Id)) {
>      const Stmt *Body = PickTrueBranch ? Node->getThen() : Node->getElse();
>      if (Body) {
> @@ -74,5 +77,5 @@
>    }
>  }
>
> -} // end namespace ast_matchers
> +} // end namespace tooling
>  } // end namespace clang
>
> Modified: cfe/trunk/unittests/Tooling/RefactoringCallbacksTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RefactoringCallbacksTest.cpp?rev=160355&r1=160354&r2=160355&view=diff
> ==============================================================================
> --- cfe/trunk/unittests/Tooling/RefactoringCallbacksTest.cpp (original)
> +++ cfe/trunk/unittests/Tooling/RefactoringCallbacksTest.cpp Tue Jul 17 03:37:03 2012
> @@ -14,7 +14,9 @@
>  #include "RewriterTestContext.h"
>
>  namespace clang {
> -namespace ast_matchers {
> +namespace tooling {
> +
> +using namespace ast_matchers;
>
>  template <typename T>
>  void expectRewritten(const std::string &Code,
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



-- 
Alexander Potapenko
Software Engineer
Google Moscow




More information about the cfe-commits mailing list