[cfe-dev] A problem with forEachConstructorInitializer

Gabor Kozar kozargabor at gmail.com
Thu Sep 26 05:28:59 PDT 2013


Replying on cfe-dev.



Your issue is most confusing. You will need to show us the matcher code
you're trying to get working.



By the way, you do not need to place your own matchers in
ASTMatchers.h, you can create an own header file, like so:



#include "clang/ASTMatchers/ASTMatchersMacros.h"

#include "clang/ASTMatchers/ASTMatchersInternal.h"



namespace clang {

namespace ast_matchers {



// your matchers here



} // end namespace ast_matchers

} // end namespace clang



Do not forget the header guard of course and anything else you may
need.



As for your build issues: try doing a clean rebuild, i.e. reconfigure
(or run cmake again), and then make. I have never used ninja, so no
idea if the issue could be on that front. Also make sure that you've
not accidentally corrupted your LLVM/Clang checkout... But I hope you
already tried these.



--
Gábor Kozár -- ShdNx
kozargabor at gmail.com





On Thu, Sep 26, 2013, at 11:29, Pedro Delgado Perez wrote:

  Hi Gábor,

  Sorry to write you directly, but I don't know why I can't post
  messages in cfe-dev...

  I get through you because, some months ago, you told me what could I
  do when a matcher in
  [1]http://clang.llvm.org/docs/LibASTMatchersReference.html

was no present in my ASTMatchers.h.

  Now, I'm trying to integrate the matcher
  forEachConstructorInitializer in

[2]http://llvm.org/svn/llvm-project/cfe/trunk/include/clang/ASTMatchers
/ASTMatchers.h

  Firstly, I have included it in my ASTMatchers, but I don't know why
  the system is not recognizing this new matcher. So I have put it in
  my own source file. Now, the system gives me the next problem and I
  would like to know how could I solve this:

  CTD_operator.cpp:42:29: error: calling a private constructor of
  class 'clang::ast_matchers::internal::BoundNodesTreeBuilder'

             BoundNodesTreeBuilder InitBuilder(*Builder);

                                   ^

/usr/local/include/clang/ASTMatchers/ASTMatchersInternal.h:178:3: note:
declared private here

  BoundNodesTreeBuilder(const BoundNodesTreeBuilder &)
LLVM_DELETED_FUNCTION;

  ^

CTD_operator.cpp:45:25: error: no viable conversion from
'clang::ast_matchers::internal::BoundNodesTreeBuilder' to 'const
clang::ast_matchers::internal::BoundNodesTree'

               Result.addMatch(InitBuilder);

                               ^~~~~~~~~~~

/usr/local/include/clang/ASTMatchers/ASTMatchersInternal.h:113:7: note:
candidate constructor (the implicit copy constructor) not viable: no
known conversion from

      'clang::ast_matchers::internal::BoundNodesTreeBuilder' to 'const
clang::ast_matchers::internal::BoundNodesTree &' for 1st argument

class BoundNodesTree {

      ^

/usr/local/include/clang/ASTMatchers/ASTMatchersInternal.h:172:39:
note: passing argument to parameter 'Bindings' here

  void addMatch(const BoundNodesTree& Bindings);

                                      ^

CTD_operator.cpp:48:14: error: 'operator=' is a private member of
'clang::ast_matchers::internal::BoundNodesTreeBuilder'

           *Builder = Result;

           ~~~~~~~~ ^ ~~~~~~

/usr/local/include/clang/ASTMatchers/ASTMatchersInternal.h:179:8: note:
declared private here

  void operator=(const BoundNodesTreeBuilder &) LLVM_DELETED_FUNCTION;

       ^



  Should I also change ASTMatchersInternal.h?? Do you recommend me to
  replace these header files for the last version?

  How can I achieve that the system is aware of the changes I
  introduce in these files? I have a Makefile and only write "make"
  from the shell... Since two days ago, I was using ninja, but I don't
  know why, suddenly, start giving this fail:

  pedro at hal ~/clang-llvm/build $ ninja

  [6/745] Building CXX object
  lib/Target/Hexagon/CMakeFiles/LLVMHexagonCodeGen.dir/HexagonRemoveSZ
  ExtArgs.cpp.o

FAILED: /usr/local/bin/clang++   -D_DEBUG -D_GNU_SOURCE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter
-Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wnon-virtual-dtor -fcolor-diagnostics
-fno-rtti  -Ilib/Target/Hexagon
-I/home/pedro/clang-llvm/llvm/lib/Target/Hexagon -Iinclude
-I/home/pedro/clang-llvm/llvm/include    -fno-exceptions
-fno-exceptions -MMD -MT
lib/Target/Hexagon/CMakeFiles/LLVMHexagonCodeGen.dir/HexagonRemoveSZExt
Args.cpp.o -MF
"lib/Target/Hexagon/CMakeFiles/LLVMHexagonCodeGen.dir/HexagonRemoveSZEx
tArgs.cpp.o.d" -o
lib/Target/Hexagon/CMakeFiles/LLVMHexagonCodeGen.dir/HexagonRemoveSZExt
Args.cpp.o -c
/home/pedro/clang-llvm/llvm/lib/Target/Hexagon/HexagonRemoveSZExtArgs.c
pp

error: unable to open output file
'lib/Target/Hexagon/CMakeFiles/LLVMHexagonCodeGen.dir/HexagonRemoveSZEx
tArgs.cpp.o': 'Error opening output file
'lib/Target/Hexagon/CMakeFiles/LLVMHexagonCodeGen.dir/HexagonRemoveSZEx
tArgs.cpp.o''

1 error generated.

[6/745] Linking CXX static library lib/libLLVMInstrumentation.a

ninja: build stopped: subcommand failed.





I don't know what is "HexagonRemoveSZExtArgs.cpp.o" :S

  Thanks,

  Pedro.

References

1. http://clang.llvm.org/docs/LibASTMatchersReference.html
2. http://llvm.org/svn/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130926/feae29a3/attachment.html>


More information about the cfe-dev mailing list