admin管理员组文章数量:1335702
Is there an easy way to get entire definition of ValueTy. It it diffcult to complile the single file with -E option. llvm-projct part of Value.h code
/// Concrete subclass of this.
///
/// An enumeration for keeping track of the concrete subclass of Value that
/// is actually instantiated. Values of this enumeration are kept in the
/// Value classes SubclassID field. They are used for concrete type
/// identification.
enum ValueTy {
#define HANDLE_VALUE(Name) Name##Val,
#include "llvm/IR/Value.def"
// Markers:
#define HANDLE_CONSTANT_MARKER(Marker, Constant) Marker = Constant##Val,
#include "llvm/IR/Value.def"
};
the include lines are like this.
HANDLE_VALUE(Argument)
HANDLE_VALUE(BasicBlock)
It can be parsed by clangd, but I don't know how to get the entire.
Is there an easy way to get entire definition of ValueTy. It it diffcult to complile the single file with -E option. llvm-projct part of Value.h code
/// Concrete subclass of this.
///
/// An enumeration for keeping track of the concrete subclass of Value that
/// is actually instantiated. Values of this enumeration are kept in the
/// Value classes SubclassID field. They are used for concrete type
/// identification.
enum ValueTy {
#define HANDLE_VALUE(Name) Name##Val,
#include "llvm/IR/Value.def"
// Markers:
#define HANDLE_CONSTANT_MARKER(Marker, Constant) Marker = Constant##Val,
#include "llvm/IR/Value.def"
};
the include lines are like this.
HANDLE_VALUE(Argument)
HANDLE_VALUE(BasicBlock)
It can be parsed by clangd, but I don't know how to get the entire.
Share edited Jan 9 at 0:23 A. K. 38.3k17 gold badges56 silver badges102 bronze badges asked Nov 28, 2024 at 11:49 huiiiiihuiiiii 312 bronze badges 3 |1 Answer
Reset to default 0If you can compile a single file, try passing --save-temps
that will give you the .ii file with all the preprocessed macros. Two easy ways to get the compile commands
ninja -v
will print the commands on console. This is most straight forward as you can copy and run that command.- The build.ninja file also has the compilation commands in a specific format. It is easy to concatenate them together if you understand compiler flags. e.g., for the file llvm/lib/Transforms/Scalar/GVNHoist.cpp, the command is listed like:
build lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/GVNHoist.cpp.o: CXX_COMPILER__LLVMScalarOpts_unscanned_Release /home/g/llvm-project/llvm/lib/Transforms/Scalar/GVNHoist.cpp || cmake_object_order_depends_target_LLVMScalarOpts
DEFINES = -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
DEP_FILE = lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/GVNHoist.cpp.o.d
FLAGS = -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -fno-exceptions -funwind-tables -fno-rtti
INCLUDES = -I/home/g/llvm-project/build/lib/Transforms/Scalar -I/home/g/llvm-project/llvm/lib/Transforms/Scalar -I/home/g/llvm-project/build/include -I/home/g/llvm-project/llvm/include
OBJECT_DIR = lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir
OBJECT_FILE_DIR = lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir
本文标签: cHow to expand Macros of a huge projectStack Overflow
版权声明:本文标题:c++ - How to expand Macros of a huge project - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742265745a2443355.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
-E
. Or if it doesn't work, you could use verbose mode of your build system and grep to find correct command for the interesting file. If your build system doesn't allow compiling header files separately, add source file that only has single line with include and look up command for this file. – Yksisarvinen Commented Nov 28, 2024 at 13:03