diff options
author | bloodstalker <thabogre@gmail.com> | 2020-03-20 17:01:19 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2020-03-20 17:01:19 +0000 |
commit | 029933103f199a618ee94e080a4b8fe1243336bf (patch) | |
tree | af3d72d23382743aa22845bc944e676753b2adf0 | |
parent | update (diff) | |
download | cgrep-029933103f199a618ee94e080a4b8fe1243336bf.tar.gz cgrep-029933103f199a618ee94e080a4b8fe1243336bf.zip |
changed memvar switch to cdecl and added a new switch, cxxdecl.
-rw-r--r-- | cgrep.cpp | 57 | ||||
-rw-r--r-- | cgrep.roff | 8 | ||||
-rw-r--r-- | compile_commands.json | 6 | ||||
-rwxr-xr-x | covrun.sh | 2 | ||||
-rw-r--r-- | test/compile_commands.json | 4 | ||||
-rw-r--r-- | test/main.ast | 149 | ||||
-rw-r--r-- | test/main.cpp | 7 |
7 files changed, 147 insertions, 86 deletions
@@ -41,7 +41,7 @@ cl::opt<bool> CO_CALL("call", cl::desc("Match function calls."), cl::opt<bool> CO_CXXCALL("cxxcall", cl::desc("Match member function calls."), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done -cl::opt<bool> CO_MEMVAR("memvar", cl::desc("Match member variables."), +cl::opt<bool> CO_CFIELD("cfield", cl::desc("Match C field declarations."), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done cl::opt<bool> CO_CLASS("class", cl::desc("Match class declrations."), @@ -50,6 +50,9 @@ cl::opt<bool> CO_CLASS("class", cl::desc("Match class declrations."), cl::opt<bool> CO_STRUCT("struct", cl::desc("Match structures."), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done +cl::opt<bool> CO_CXXFIELD("cxxfield", cl::desc("Match CXX field member declarations."), + cl::init(false), cl::cat(CGrepCat), + cl::Optional); // done cl::opt<bool> CO_UNION("union", cl::desc("Match unions."), cl::init(false), cl::cat(CGrepCat), cl::Optional); // done cl::opt<bool> CO_MACRO("macro", cl::desc("Match macro definitions."), @@ -667,6 +670,37 @@ private: Rewriter &Rewrite [[maybe_unused]]; }; /***********************************************************************************************/ +class RecordFieldHandler : public MatchFinder::MatchCallback { + public: + explicit RecordFieldHandler(Rewriter &Rewrite) : Rewrite(Rewrite) {} + + virtual void run(const MatchFinder::MatchResult &MR) { + const FieldDecl *FD = MR.Nodes.getNodeAs<clang::FieldDecl>("recordfielddecl"); + if (FD) { + SourceRange SR = FD->getSourceRange(); + SourceLocation SL = SR.getBegin(); + CheckSLValidity(SL); + SL = Devi::SourceLocationHasMacro(SL, Rewrite, "start"); + if (Devi::IsTheMatchInSysHeader(CO_SYSHDR, MR, SL)) + return void(); + if (!Devi::IsTheMatchInMainFile(CO_MAINFILE, MR, SL)) + return void(); + std::string name = FD->getNameAsString(); + if (regex_handler(REGEX_PP(CO_REGEX), name)) { + ast_type_traits::DynTypedNode DNode = + ast_type_traits::DynTypedNode::create(*FD); + auto StartLocation = FD->getLocation(); + auto EndLocation = StartLocation.getLocWithOffset(name.size() - 1); + auto Range = SourceRange(StartLocation, EndLocation); + output_handler(MR, Range, *MR.SourceManager, true, DNode); + } + } + } + +private: + Rewriter &Rewrite [[maybe_unused]]; +}; +/***********************************************************************************************/ class PPInclusion : public PPCallbacks { public: explicit PPInclusion(SourceManager *SM, Rewriter *Rewrite) @@ -756,8 +790,8 @@ public: : HandlerForVar(R), HandlerForClass(R), HandlerForCalledFunc(R), HandlerForCXXMethod(R), HandlerForField(R), HandlerForStruct(R), HandlerForUnion(R), HandlerForNamedDecl(R), HandlerForDeclRefExpr(R), - HandlerForCallExpr(R), HandlerForCXXCallExpr(R) { -#if 1 + HandlerForCallExpr(R), HandlerForCXXCallExpr(R), + HandlerForRecordField(R) { if (CO_FUNCTION || CO_ALL) { Matcher.addMatcher(functionDecl().bind("funcdecl"), &HandlerForCalledFunc); @@ -782,7 +816,7 @@ public: Matcher.addMatcher(cxxMethodDecl().bind("cxxmethoddecl"), &HandlerForCXXMethod); } - if (CO_MEMVAR || CO_ALL) { + if (CO_CFIELD || CO_ALL) { Matcher.addMatcher(fieldDecl().bind("fielddecl"), &HandlerForField); } if (CO_STRUCT || CO_ALL) { @@ -808,7 +842,9 @@ public: Matcher.addMatcher(cxxMemberCallExpr().bind("cxxcallexpr"), &HandlerForCXXCallExpr); } -#endif + if (CO_CXXFIELD || CO_ALL) { + Matcher.addMatcher(fieldDecl(hasParent(cxxRecordDecl())).bind("recordfielddecl"), &HandlerForRecordField); + } } void HandleTranslationUnit(ASTContext &Context) override { @@ -827,13 +863,14 @@ private: DeclRefExprHandler HandlerForDeclRefExpr; CallExprHandler HandlerForCallExpr; CXXCallExprHandler HandlerForCXXCallExpr; + RecordFieldHandler HandlerForRecordField; MatchFinder Matcher; }; /***********************************************************************************************/ -class AppFrontendAction : public ASTFrontendAction { +class CgrepFrontendAction : public ASTFrontendAction { public: - AppFrontendAction() {} - ~AppFrontendAction() { delete BDCProto; } + CgrepFrontendAction() {} + ~CgrepFrontendAction() { delete BDCProto; } void EndSourceFileAction() override { std::error_code EC; @@ -872,8 +909,8 @@ int main(int argc, const char **argv) { const std::vector<std::string> &SourcePathList [[maybe_unused]] = op.getSourcePathList(); ClangTool Tool(op.getCompilations(), op.getSourcePathList()); - int ret = Tool.run(newFrontendActionFactory<AppFrontendAction>().get()); -#if 1 + int ret = Tool.run(newFrontendActionFactory<CgrepFrontendAction>().get()); +#if 0 listDirs(CO_RECURSIVE); #endif return ret; @@ -58,6 +58,10 @@ Match class declarations. Matches member function calls. .TP +\fB--cxxfield\fP +Match CXX field declarations. + +.TP \fB--declrefexpr\fP Matches declrefexpr. .br @@ -112,8 +116,8 @@ cgrep. Match member function declarations. .TP -\fB--memvar\fP -Match member variable declarations. +\fB--cfield\fP +Match C field declations. .TP \fB--nameddecl\fP diff --git a/compile_commands.json b/compile_commands.json index 2803ad9..9c2f5ec 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -1,7 +1,7 @@ [ { - "command": "c++ -c -include-pch pch.hpp.gch -fpic -I/home/bloodstalker/extra/llvm-clang-4/llvm/include -I/home/bloodstalker/extra/llvm-clang-4/build/include -std=c++14 -fno-exceptions -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-clang-4/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-clang-4/build/tools/clang/include -std=c++17 -fexceptions -o cgrep.o cgrep.cpp", - "directory": "/home/bloodstalker/extra/cgrep", - "file": "/home/bloodstalker/extra/cgrep/cgrep.cpp" + "command": "c++ -c -include-pch pch.hpp.gch -fpic -I/home/bloodstalker/extra/llvm-clang-4/llvm/include -I/home/bloodstalker/extra/llvm-clang-4/build/include -std=c++14 -fno-exceptions -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/bloodstalker/extra/llvm-clang-4/llvm/tools/clang/include -I/home/bloodstalker/extra/llvm-clang-4/build/tools/clang/include -std=c++17 -fexceptions -o cgrep.o cgrep.cpp", + "directory": "/home/bloodstalker/devi/hell2/cgrep", + "file": "/home/bloodstalker/devi/hell2/cgrep/cgrep.cpp" } ]
\ No newline at end of file @@ -9,7 +9,7 @@ LLVM_PROFILE_FILE="five.profraw" "./cgrep-cov" -A 1 -B 1 --class --regex and ./c LLVM_PROFILE_FILE="six.profraw" "./cgrep-cov" -A 1 -B 1 --struct --union --regex n[aA]m ./cgrep.cpp LLVM_PROFILE_FILE="seven.profraw" "./cgrep-cov" -A 1 -B 1 --nameddecl --regex n[aA]m ./cgrep.cpp LLVM_PROFILE_FILE="eight.profraw" "./cgrep-cov" -A 1 -B 1 --cxxcall --call --regex add ./cgrep.cpp -LLVM_PROFILE_FILE="nine.profraw" "./cgrep-cov" -A 1 -B 1 --memvar --regex ite ./cgrep.cpp +LLVM_PROFILE_FILE="nine.profraw" "./cgrep-cov" -A 1 -B 1 --cfield --regex ite ./cgrep.cpp LLVM_PROFILE_FILE="ten.profraw" "./cgrep-cov" --union --regex [Uu]nion ./test/main.cpp LLVM_PROFILE_FILE="eleven.profraw" "./cgrep-cov" --struct --regex [sS]truct ./test/main.cpp LLVM_PROFILE_FILE="twelve.profraw" "./cgrep-cov" --dir ./ --regex run --func ./cgrep.cpp diff --git a/test/compile_commands.json b/test/compile_commands.json index 4f584fd..9808839 100644 --- a/test/compile_commands.json +++ b/test/compile_commands.json @@ -1,7 +1,7 @@ [ { "command": "c++ -c -std=c++11 -fpic -o main.o main.cpp", - "directory": "/home/bloodstalker/extra/cgrep/test", - "file": "/home/bloodstalker/extra/cgrep/test/main.cpp" + "directory": "/home/bloodstalker/devi/hell2/cgrep/test", + "file": "/home/bloodstalker/devi/hell2/cgrep/test/main.cpp" } ]
\ No newline at end of file diff --git a/test/main.ast b/test/main.ast index 02edebb..d03244f 100644 --- a/test/main.ast +++ b/test/main.ast @@ -1,40 +1,42 @@ -[0;1;32mTranslationUnitDecl[0m[0;33m 0x6bd18f8[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m -[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6bd21d0[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __int128_t[0m [0;32m'__int128'[0m -[0;34m| `-[0m[0;32mBuiltinType[0m[0;33m 0x6bd1e90[0m [0;32m'__int128'[0m -[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6bd2238[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __uint128_t[0m [0;32m'unsigned __int128'[0m -[0;34m| `-[0m[0;32mBuiltinType[0m[0;33m 0x6bd1eb0[0m [0;32m'unsigned __int128'[0m -[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6bd2568[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __NSConstantString[0m [0;32m'__NSConstantString_tag'[0m -[0;34m| `-[0m[0;32mRecordType[0m[0;33m 0x6bd2310[0m [0;32m'__NSConstantString_tag'[0m -[0;34m| `-[0m[0;1;32mCXXRecord[0m[0;33m 0x6bd2288[0m[0;1;36m '__NSConstantString_tag'[0m -[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6c0c340[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __builtin_ms_va_list[0m [0;32m'char *'[0m -[0;34m| `-[0m[0;32mPointerType[0m[0;33m 0x6bd25c0[0m [0;32m'char *'[0m -[0;34m| `-[0m[0;32mBuiltinType[0m[0;33m 0x6bd1990[0m [0;32m'char'[0m -[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6c0c668[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __builtin_va_list[0m [0;32m'__va_list_tag [1]'[0m -[0;34m| `-[0m[0;32mConstantArrayType[0m[0;33m 0x6c0c610[0m [0;32m'__va_list_tag [1]'[0m 1 -[0;34m| `-[0m[0;32mRecordType[0m[0;33m 0x6c0c420[0m [0;32m'__va_list_tag'[0m -[0;34m| `-[0m[0;1;32mCXXRecord[0m[0;33m 0x6c0c390[0m[0;1;36m '__va_list_tag'[0m -[0;34m|-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x6c0c6b8[0m <[0;33mmain.cpp:2:1[0m, [0;33mline:12:1[0m> [0;33mline:2:7[0m referenced class[0;1;36m myClass[0m definition -[0;34m| |-[0m[0;1;32mDefinitionData[0m standard_layout has_user_declared_ctor can_const_default_init -[0;34m| | |-[0m[0;1;32mDefaultConstructor[0m exists non_trivial user_provided +[0;1;32mTranslationUnitDecl[0m[0;33m 0x7e63838[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x7e64110[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __int128_t[0m [0;32m'__int128'[0m +[0;34m| `-[0m[0;32mBuiltinType[0m[0;33m 0x7e63dd0[0m [0;32m'__int128'[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x7e64180[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __uint128_t[0m [0;32m'unsigned __int128'[0m +[0;34m| `-[0m[0;32mBuiltinType[0m[0;33m 0x7e63df0[0m [0;32m'unsigned __int128'[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x7e644f8[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __NSConstantString[0m [0;32m'__NSConstantString_tag'[0m +[0;34m| `-[0m[0;32mRecordType[0m[0;33m 0x7e64270[0m [0;32m'__NSConstantString_tag'[0m +[0;34m| `-[0m[0;1;32mCXXRecord[0m[0;33m 0x7e641d8[0m[0;1;36m '__NSConstantString_tag'[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x7e64590[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __builtin_ms_va_list[0m [0;32m'char *'[0m +[0;34m| `-[0m[0;32mPointerType[0m[0;33m 0x7e64550[0m [0;32m'char *'[0m +[0;34m| `-[0m[0;32mBuiltinType[0m[0;33m 0x7e638d0[0m [0;32m'char'[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x7ea1338[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __builtin_va_list[0m [0;32m'__va_list_tag [1]'[0m +[0;34m| `-[0m[0;32mConstantArrayType[0m[0;33m 0x7ea12e0[0m [0;32m'__va_list_tag [1]'[0m 1 +[0;34m| `-[0m[0;32mRecordType[0m[0;33m 0x7e64680[0m [0;32m'__va_list_tag'[0m +[0;34m| `-[0m[0;1;32mCXXRecord[0m[0;33m 0x7e645e8[0m[0;1;36m '__va_list_tag'[0m +[0;34m|-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x7ea1390[0m <[0;33mmain.cpp:2:1[0m, [0;33mline:12:1[0m> [0;33mline:2:7[0m referenced class[0;1;36m myClass[0m definition +[0;34m| |-[0m[0;1;32mDefinitionData[0m standard_layout has_user_declared_ctor +[0;34m| | |-[0m[0;1;32mDefaultConstructor[0m exists trivial [0;34m| | |-[0m[0;1;32mCopyConstructor[0m simple trivial has_const_param implicit_has_const_param [0;34m| | |-[0m[0;1;32mMoveConstructor[0m [0;34m| | |-[0m[0;1;32mCopyAssignment[0m trivial has_const_param needs_implicit implicit_has_const_param [0;34m| | |-[0m[0;1;32mMoveAssignment[0m [0;34m| | `-[0m[0;1;32mDestructor[0m non_trivial user_declared -[0;34m| |-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x6c0c7c8[0m <[0;33mcol:1[0m, [0;33mcol:7[0m> [0;33mcol:7[0m implicit referenced class[0;1;36m myClass[0m -[0;34m| |-[0m[0;1;32mAccessSpecDecl[0m[0;33m 0x6c0c850[0m <[0;33mline:3:3[0m, [0;33mcol:9[0m> [0;33mcol:3[0m public -[0;34m| |-[0m[0;1;32mCXXConstructorDecl[0m[0;33m 0x6c0c920[0m <[0;33mline:4:5[0m, [0;33mcol:13[0m> [0;33mcol:5[0m used[0;1;36m myClass[0m [0;32m'void ()'[0m -[0;34m| |-[0m[0;1;32mCXXDestructorDecl[0m[0;33m 0x6c0ca10[0m <[0;33mline:5:5[0m, [0;33mcol:14[0m> [0;33mcol:5[0m used[0;1;36m ~myClass[0m [0;32m'void () noexcept'[0m -[0;34m| |-[0m[0;1;32mCXXMethodDecl[0m[0;33m 0x6c0cb48[0m <[0;33mline:7:5[0m, [0;33mcol:27[0m> [0;33mcol:10[0m used[0;1;36m myMehtod1[0m [0;32m'void ()'[0m -[0;34m| | `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c0ce28[0m <[0;33mcol:26[0m, [0;33mcol:27[0m> -[0;34m| |-[0m[0;1;32mCXXMethodDecl[0m[0;33m 0x6c0cc70[0m <[0;33mline:8:5[0m, [0;33mcol:27[0m> [0;33mcol:10[0m used[0;1;36m myMehtod2[0m [0;32m'void ()'[0m -[0;34m| | `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c0ce38[0m <[0;33mcol:26[0m, [0;33mcol:27[0m> -[0;34m| |-[0m[0;1;32mAccessSpecDecl[0m[0;33m 0x6c0cd08[0m <[0;33mline:9:3[0m, [0;33mcol:10[0m> [0;33mcol:3[0m private -[0;34m| |-[0m[0;1;32mFieldDecl[0m[0;33m 0x6c0cd48[0m <[0;33mline:10:5[0m, [0;33mcol:9[0m> [0;33mcol:9[0m[0;1;36m a[0m [0;32m'int'[0m -[0;34m| |-[0m[0;1;32mFieldDecl[0m[0;33m 0x6c0cda8[0m <[0;33mline:11:5[0m, [0;33mcol:11[0m> [0;33mcol:11[0m[0;1;36m b[0m [0;32m'float'[0m -[0;34m| `-[0m[0;1;32mCXXConstructorDecl[0m[0;33m 0x6c3b9a8[0m <[0;33mline:2:7[0m> [0;33mcol:7[0m implicit constexpr[0;1;36m myClass[0m [0;32m'void (const myClass &)'[0m inline default trivial noexcept-unevaluated 0x6c3b9a8 -[0;34m| `-[0m[0;1;32mParmVarDecl[0m[0;33m 0x6c3bad0[0m <[0;33mcol:7[0m> [0;33mcol:7[0m [0;32m'const myClass &'[0m -[0;34m|-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x6c0ce48[0m <[0;33mline:14:1[0m, [0;33mline:17:1[0m> [0;33mline:14:8[0m struct[0;1;36m myStruct[0m definition +[0;34m| |-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x7ea14a8[0m <[0;33mcol:1[0m, [0;33mcol:7[0m> [0;33mcol:7[0m implicit referenced class[0;1;36m myClass[0m +[0;34m| |-[0m[0;1;32mAccessSpecDecl[0m[0;33m 0x7ea1538[0m <[0;33mline:3:3[0m, [0;33mcol:9[0m> [0;33mcol:3[0m public +[0;34m| |-[0m[0;1;32mCXXConstructorDecl[0m[0;33m 0x7ea15e8[0m <[0;33mline:4:5[0m, [0;33mcol:23[0m> [0;33mcol:5[0m used[0;1;36m myClass[0m [0;32m'void () noexcept'[0m default trivial +[0;34m| | `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x7ed1488[0m <[0;33mcol:23[0m> +[0;34m| |-[0m[0;1;32mCXXDestructorDecl[0m[0;33m 0x7ea16d8[0m <[0;33mline:5:5[0m, [0;33mcol:17[0m> [0;33mcol:5[0m used[0;1;36m ~myClass[0m [0;32m'void () noexcept'[0m +[0;34m| | `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x7ea1b88[0m <[0;33mcol:16[0m, [0;33mcol:17[0m> +[0;34m| |-[0m[0;1;32mCXXMethodDecl[0m[0;33m 0x7ea1858[0m <[0;33mline:7:5[0m, [0;33mcol:27[0m> [0;33mcol:10[0m used[0;1;36m myMehtod1[0m [0;32m'void ()'[0m +[0;34m| | `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x7ea1b98[0m <[0;33mcol:26[0m, [0;33mcol:27[0m> +[0;34m| |-[0m[0;1;32mCXXMethodDecl[0m[0;33m 0x7ea1990[0m <[0;33mline:8:5[0m, [0;33mcol:27[0m> [0;33mcol:10[0m used[0;1;36m myMehtod2[0m [0;32m'void ()'[0m +[0;34m| | `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x7ea1ba8[0m <[0;33mcol:26[0m, [0;33mcol:27[0m> +[0;34m| |-[0m[0;1;32mAccessSpecDecl[0m[0;33m 0x7ea1a30[0m <[0;33mline:9:3[0m, [0;33mcol:10[0m> [0;33mcol:3[0m private +[0;34m| |-[0m[0;1;32mFieldDecl[0m[0;33m 0x7ea1a70[0m <[0;33mline:10:5[0m, [0;33mcol:9[0m> [0;33mcol:9[0m[0;1;36m a[0m [0;32m'int'[0m +[0;34m| |-[0m[0;1;32mFieldDecl[0m[0;33m 0x7ea1ad8[0m <[0;33mline:11:5[0m, [0;33mcol:11[0m> [0;33mcol:11[0m[0;1;36m b[0m [0;32m'float'[0m +[0;34m| `-[0m[0;1;32mCXXConstructorDecl[0m[0;33m 0x7ed1308[0m <[0;33mline:2:7[0m> [0;33mcol:7[0m implicit constexpr[0;1;36m myClass[0m [0;32m'void (const myClass &)'[0m inline default trivial noexcept-unevaluated 0x7ed1308 +[0;34m| `-[0m[0;1;32mParmVarDecl[0m[0;33m 0x7ed1418[0m <[0;33mcol:7[0m> [0;33mcol:7[0m [0;32m'const myClass &'[0m +[0;34m|-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x7ea1bb8[0m <[0;33mline:14:1[0m, [0;33mline:17:1[0m> [0;33mline:14:8[0m struct[0;1;36m myStruct[0m definition [0;34m| |-[0m[0;1;32mDefinitionData[0m empty standard_layout has_user_declared_ctor can_const_default_init [0;34m| | |-[0m[0;1;32mDefaultConstructor[0m exists non_trivial user_provided defaulted_is_constexpr [0;34m| | |-[0m[0;1;32mCopyConstructor[0m simple trivial has_const_param needs_implicit implicit_has_const_param @@ -42,39 +44,50 @@ [0;34m| | |-[0m[0;1;32mCopyAssignment[0m trivial has_const_param needs_implicit implicit_has_const_param [0;34m| | |-[0m[0;1;32mMoveAssignment[0m [0;34m| | `-[0m[0;1;32mDestructor[0m non_trivial user_declared -[0;34m| |-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x6c0cf58[0m <[0;33mcol:1[0m, [0;33mcol:8[0m> [0;33mcol:8[0m implicit referenced struct[0;1;36m myStruct[0m -[0;34m| |-[0m[0;1;32mCXXConstructorDecl[0m[0;33m 0x6c0d048[0m <[0;33mline:15:3[0m, [0;33mcol:12[0m> [0;33mcol:3[0m[0;1;36m myStruct[0m [0;32m'void ()'[0m -[0;34m| `-[0m[0;1;32mCXXDestructorDecl[0m[0;33m 0x6c0d138[0m <[0;33mline:16:3[0m, [0;33mcol:13[0m> [0;33mcol:3[0m[0;1;36m ~myStruct[0m [0;32m'void ()'[0m noexcept-unevaluated 0x6c0d138 -[0;34m|-[0m[0;1;32mFunctionDecl[0m[0;33m 0x6c0d2a8[0m <[0;33mline:19:1[0m, [0;33mcol:21[0m> [0;33mcol:6[0m[0;1;36m myFunc1[0m [0;32m'void ()'[0m -[0;34m| `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c3b590[0m <[0;33mcol:20[0m, [0;33mcol:21[0m> -[0;34m|-[0m[0;1;32mFunctionDecl[0m[0;33m 0x6c3b630[0m <[0;33mline:20:1[0m, [0;33mcol:21[0m> [0;33mcol:6[0m[0;1;36m myFunc2[0m [0;32m'void ()'[0m -[0;34m| `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c3b6c8[0m <[0;33mcol:20[0m, [0;33mcol:21[0m> -[0;34m`-[0m[0;1;32mFunctionDecl[0m[0;33m 0x6c3b868[0m <[0;33mline:22:1[0m, [0;33mline:31:1[0m> [0;33mline:22:5[0m[0;1;36m main[0m [0;32m'int (int, char **)'[0m -[0;34m |-[0m[0;1;32mParmVarDecl[0m[0;33m 0x6c3b6f0[0m <[0;33mcol:11[0m, [0;33mcol:15[0m> [0;33mcol:15[0m[0;1;36m argc[0m [0;32m'int'[0m -[0;34m |-[0m[0;1;32mParmVarDecl[0m[0;33m 0x6c3b790[0m <[0;33mcol:21[0m, [0;33mcol:28[0m> [0;33mcol:28[0m[0;1;36m argv[0m [0;32m'char **'[0m -[0;34m `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c3c038[0m <[0;33mcol:34[0m, [0;33mline:31:1[0m> -[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x6c3bba0[0m <[0;33mline:23:3[0m, [0;33mcol:13[0m> -[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3b920[0m <[0;33mcol:3[0m, [0;33mcol:11[0m> [0;33mcol:11[0m used[0;1;36m mc[0m [0;32m'myClass'[0m callinit -[0;34m | `-[0m[0;1;35mCXXConstructExpr[0m[0;33m 0x6c3bb38[0m <[0;33mcol:11[0m> [0;32m'myClass'[0m[0;36m[0m[0;36m[0m [0;32m'void ()'[0m -[0;34m |-[0m[0;1;35mCXXMemberCallExpr[0m[0;33m 0x6c3bc18[0m <[0;33mline:24:3[0m, [0;33mcol:16[0m> [0;32m'void'[0m[0;36m[0m[0;36m[0m -[0;34m | `-[0m[0;1;35mMemberExpr[0m[0;33m 0x6c3bbe0[0m <[0;33mcol:3[0m, [0;33mcol:6[0m> [0;32m'<bound member function type>'[0m[0;36m[0m[0;36m[0m .myMehtod1[0;33m 0x6c0cb48[0m -[0;34m | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bbb8[0m <[0;33mcol:3[0m> [0;32m'myClass'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3b920[0m[0;1;36m 'mc'[0m [0;32m'myClass'[0m -[0;34m |-[0m[0;1;35mCXXMemberCallExpr[0m[0;33m 0x6c3bca0[0m <[0;33mline:25:3[0m, [0;33mcol:16[0m> [0;32m'void'[0m[0;36m[0m[0;36m[0m -[0;34m | `-[0m[0;1;35mMemberExpr[0m[0;33m 0x6c3bc68[0m <[0;33mcol:3[0m, [0;33mcol:6[0m> [0;32m'<bound member function type>'[0m[0;36m[0m[0;36m[0m .myMehtod2[0;33m 0x6c0cc70[0m -[0;34m | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bc40[0m <[0;33mcol:3[0m> [0;32m'myClass'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3b920[0m[0;1;36m 'mc'[0m [0;32m'myClass'[0m -[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x6c3bd40[0m <[0;33mline:26:3[0m, [0;33mcol:8[0m> -[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3bce0[0m <[0;33mcol:3[0m, [0;33mcol:7[0m> [0;33mcol:7[0m used[0;1;36m a[0m [0;32m'int'[0m -[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x6c3bdd0[0m <[0;33mline:27:3[0m, [0;33mcol:10[0m> -[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3bd70[0m <[0;33mcol:3[0m, [0;33mcol:9[0m> [0;33mcol:9[0m[0;1;36m b[0m [0;32m'float'[0m -[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x6c3bef0[0m <[0;33mline:28:3[0m, [0;33mcol:10[0m> -[0;34m | |-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3be00[0m <[0;33mcol:3[0m, [0;33mcol:7[0m> [0;33mcol:7[0m used[0;1;36m c[0m [0;32m'int'[0m -[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3be78[0m <[0;33mcol:3[0m, [0;33mcol:9[0m> [0;33mcol:9[0m used[0;1;36m d[0m [0;32m'int'[0m -[0;34m |-[0m[0;1;35mBinaryOperator[0m[0;33m 0x6c3bfd8[0m <[0;33mline:29:3[0m, [0;33mcol:9[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m '=' -[0;34m | |-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bf08[0m <[0;33mcol:3[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3bce0[0m[0;1;36m 'a'[0m [0;32m'int'[0m -[0;34m | `-[0m[0;1;35mBinaryOperator[0m[0;33m 0x6c3bfb0[0m <[0;33mcol:7[0m, [0;33mcol:9[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m '+' -[0;34m | |-[0m[0;1;35mImplicitCastExpr[0m[0;33m 0x6c3bf80[0m <[0;33mcol:7[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m <[0;31mLValueToRValue[0m> -[0;34m | | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bf30[0m <[0;33mcol:7[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3be00[0m[0;1;36m 'c'[0m [0;32m'int'[0m -[0;34m | `-[0m[0;1;35mImplicitCastExpr[0m[0;33m 0x6c3bf98[0m <[0;33mcol:9[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m <[0;31mLValueToRValue[0m> -[0;34m | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bf58[0m <[0;33mcol:9[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3be78[0m[0;1;36m 'd'[0m [0;32m'int'[0m -[0;34m `-[0m[0;1;35mReturnStmt[0m[0;33m 0x6c3c020[0m <[0;33mline:30:3[0m, [0;33mcol:10[0m> -[0;34m `-[0m[0;1;35mIntegerLiteral[0m[0;33m 0x6c3c000[0m <[0;33mcol:10[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m[0;1;36m 0[0m +[0;34m| |-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x7ea1cd8[0m <[0;33mcol:1[0m, [0;33mcol:8[0m> [0;33mcol:8[0m implicit referenced struct[0;1;36m myStruct[0m +[0;34m| |-[0m[0;1;32mCXXConstructorDecl[0m[0;33m 0x7ea1dd0[0m <[0;33mline:15:3[0m, [0;33mcol:12[0m> [0;33mcol:3[0m[0;1;36m myStruct[0m [0;32m'void ()'[0m +[0;34m| `-[0m[0;1;32mCXXDestructorDecl[0m[0;33m 0x7ea1ec0[0m <[0;33mline:16:3[0m, [0;33mcol:13[0m> [0;33mcol:3[0m[0;1;36m ~myStruct[0m [0;32m'void ()'[0m noexcept-unevaluated 0x7ea1ec0 +[0;34m|-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x7ea1fa0[0m <[0;33mline:19:1[0m, [0;33mline:22:1[0m> [0;33mline:19:7[0m union[0;1;36m myUnion[0m definition +[0;34m| |-[0m[0;1;32mDefinitionData[0m pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal has_variant_members +[0;34m| | |-[0m[0;1;32mDefaultConstructor[0m exists trivial needs_implicit +[0;34m| | |-[0m[0;1;32mCopyConstructor[0m simple trivial has_const_param needs_implicit implicit_has_const_param +[0;34m| | |-[0m[0;1;32mMoveConstructor[0m exists simple trivial needs_implicit +[0;34m| | |-[0m[0;1;32mCopyAssignment[0m trivial has_const_param needs_implicit implicit_has_const_param +[0;34m| | |-[0m[0;1;32mMoveAssignment[0m exists simple trivial needs_implicit +[0;34m| | `-[0m[0;1;32mDestructor[0m simple irrelevant trivial needs_implicit +[0;34m| |-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x7ea20b8[0m <[0;33mcol:1[0m, [0;33mcol:7[0m> [0;33mcol:7[0m implicit union[0;1;36m myUnion[0m +[0;34m| |-[0m[0;1;32mFieldDecl[0m[0;33m 0x7ea2160[0m <[0;33mline:20:3[0m, [0;33mcol:7[0m> [0;33mcol:7[0m[0;1;36m a[0m [0;32m'int'[0m +[0;34m| `-[0m[0;1;32mFieldDecl[0m[0;33m 0x7ea21c8[0m <[0;33mline:21:3[0m, [0;33mcol:10[0m> [0;33mcol:10[0m[0;1;36m b[0m [0;32m'double'[0m +[0;34m|-[0m[0;1;32mFunctionDecl[0m[0;33m 0x7ed0dc8[0m <[0;33mline:24:1[0m, [0;33mcol:21[0m> [0;33mcol:6[0m[0;1;36m myFunc1[0m [0;32m'void ()'[0m +[0;34m| `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x7ed0eb0[0m <[0;33mcol:20[0m, [0;33mcol:21[0m> +[0;34m|-[0m[0;1;32mFunctionDecl[0m[0;33m 0x7ed0f58[0m <[0;33mline:25:1[0m, [0;33mcol:21[0m> [0;33mcol:6[0m[0;1;36m myFunc2[0m [0;32m'void ()'[0m +[0;34m| `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x7ed0ff8[0m <[0;33mcol:20[0m, [0;33mcol:21[0m> +[0;34m`-[0m[0;1;32mFunctionDecl[0m[0;33m 0x7ed11b0[0m <[0;33mline:27:1[0m, [0;33mline:36:1[0m> [0;33mline:27:5[0m[0;1;36m main[0m [0;32m'int (int, char **)'[0m +[0;34m |-[0m[0;1;32mParmVarDecl[0m[0;33m 0x7ed1020[0m <[0;33mcol:11[0m, [0;33mcol:15[0m> [0;33mcol:15[0m[0;1;36m argc[0m [0;32m'int'[0m +[0;34m |-[0m[0;1;32mParmVarDecl[0m[0;33m 0x7ed10d0[0m <[0;33mcol:21[0m, [0;33mcol:28[0m> [0;33mcol:28[0m[0;1;36m argv[0m [0;32m'char **'[0m +[0;34m `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x7ed1918[0m <[0;33mcol:34[0m, [0;33mline:36:1[0m> +[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x7ed14c0[0m <[0;33mline:28:3[0m, [0;33mcol:13[0m> +[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x7ed1270[0m <[0;33mcol:3[0m, [0;33mcol:11[0m> [0;33mcol:11[0m used[0;1;36m mc[0m [0;32m'myClass'[0m callinit destroyed +[0;34m | `-[0m[0;1;35mCXXConstructExpr[0m[0;33m 0x7ed1498[0m <[0;33mcol:11[0m> [0;32m'myClass'[0m[0;36m[0m[0;36m[0m [0;32m'void () noexcept'[0m +[0;34m |-[0m[0;1;35mCXXMemberCallExpr[0m[0;33m 0x7ed1528[0m <[0;33mline:29:3[0m, [0;33mcol:16[0m> [0;32m'void'[0m[0;36m[0m[0;36m[0m +[0;34m | `-[0m[0;1;35mMemberExpr[0m[0;33m 0x7ed14f8[0m <[0;33mcol:3[0m, [0;33mcol:6[0m> [0;32m'<bound member function type>'[0m[0;36m[0m[0;36m[0m .myMehtod1[0;33m 0x7ea1858[0m +[0;34m | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x7ed14d8[0m <[0;33mcol:3[0m> [0;32m'myClass'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x7ed1270[0m[0;1;36m 'mc'[0m [0;32m'myClass'[0m +[0;34m |-[0m[0;1;35mCXXMemberCallExpr[0m[0;33m 0x7ed1598[0m <[0;33mline:30:3[0m, [0;33mcol:16[0m> [0;32m'void'[0m[0;36m[0m[0;36m[0m +[0;34m | `-[0m[0;1;35mMemberExpr[0m[0;33m 0x7ed1568[0m <[0;33mcol:3[0m, [0;33mcol:6[0m> [0;32m'<bound member function type>'[0m[0;36m[0m[0;36m[0m .myMehtod2[0;33m 0x7ea1990[0m +[0;34m | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x7ed1548[0m <[0;33mcol:3[0m> [0;32m'myClass'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x7ed1270[0m[0;1;36m 'mc'[0m [0;32m'myClass'[0m +[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x7ed1638[0m <[0;33mline:31:3[0m, [0;33mcol:8[0m> +[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x7ed15d0[0m <[0;33mcol:3[0m, [0;33mcol:7[0m> [0;33mcol:7[0m used[0;1;36m a[0m [0;32m'int'[0m +[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x7ed16d0[0m <[0;33mline:32:3[0m, [0;33mcol:10[0m> +[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x7ed1668[0m <[0;33mcol:3[0m, [0;33mcol:9[0m> [0;33mcol:9[0m[0;1;36m b[0m [0;32m'float'[0m +[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x7ed1800[0m <[0;33mline:33:3[0m, [0;33mcol:10[0m> +[0;34m | |-[0m[0;1;32mVarDecl[0m[0;33m 0x7ed1700[0m <[0;33mcol:3[0m, [0;33mcol:7[0m> [0;33mcol:7[0m used[0;1;36m c[0m [0;32m'int'[0m +[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x7ed1780[0m <[0;33mcol:3[0m, [0;33mcol:9[0m> [0;33mcol:9[0m used[0;1;36m d[0m [0;32m'int'[0m +[0;34m |-[0m[0;1;35mBinaryOperator[0m[0;33m 0x7ed18c8[0m <[0;33mline:34:3[0m, [0;33mcol:9[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m '=' +[0;34m | |-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x7ed1818[0m <[0;33mcol:3[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x7ed15d0[0m[0;1;36m 'a'[0m [0;32m'int'[0m +[0;34m | `-[0m[0;1;35mBinaryOperator[0m[0;33m 0x7ed18a8[0m <[0;33mcol:7[0m, [0;33mcol:9[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m '+' +[0;34m | |-[0m[0;1;35mImplicitCastExpr[0m[0;33m 0x7ed1878[0m <[0;33mcol:7[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m <[0;31mLValueToRValue[0m> +[0;34m | | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x7ed1838[0m <[0;33mcol:7[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x7ed1700[0m[0;1;36m 'c'[0m [0;32m'int'[0m +[0;34m | `-[0m[0;1;35mImplicitCastExpr[0m[0;33m 0x7ed1890[0m <[0;33mcol:9[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m <[0;31mLValueToRValue[0m> +[0;34m | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x7ed1858[0m <[0;33mcol:9[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x7ed1780[0m[0;1;36m 'd'[0m [0;32m'int'[0m +[0;34m `-[0m[0;1;35mReturnStmt[0m[0;33m 0x7ed1908[0m <[0;33mline:35:3[0m, [0;33mcol:10[0m> +[0;34m `-[0m[0;1;35mIntegerLiteral[0m[0;33m 0x7ed18e8[0m <[0;33mcol:10[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m[0;1;36m 0[0m diff --git a/test/main.cpp b/test/main.cpp index 5c2ceb8..87b7eae 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -19,6 +19,13 @@ struct myStruct { union myUnion { int a; double b; + int app; +}; + +struct verymuchStruct { + int myinteger; + int yourinteger; + int ourinteger; }; void myFunc1(void) {} |