[PATCH] D100516: [AST] Add TypeLoc support to node introspection

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 15 14:39:23 PDT 2021


njames93 added inline comments.


================
Comment at: clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp:158-159
         BN.getNodeAs<clang::CXXRecordDecl>("stmtOrDeclBase");
+    const auto *TypeLocBase = BN.getNodeAs<clang::CXXRecordDecl>("typeLocBase");
+    const auto *ExprBase = BN.getNodeAs<clang::CXXRecordDecl>("exprBase");
     if (const auto *Node = BN.getNodeAs<clang::NamedDecl>("classMethod")) {
----------------
nit: can't these be moved into the if stmt below, while were here StmtOrDeclBase can also be moved inside the if.


================
Comment at: clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp:172-176
+      if (TypeLocBase && Node->getName() == "getLocalSourceRange")
+        continue;
+      if ((ASTClass->getName() == "PointerLikeTypeLoc" ||
+           ASTClass->getName() == "TypeofLikeTypeLoc") &&
+          Node->getName() == "getLocalSourceRange")
----------------
Can we have a comment explaining why we are discarding these?


================
Comment at: clang/unittests/Introspection/IntrospectionTest.cpp:875
+
+TEST(Introspection, SourceLocations_Formatter) {
+  auto AST =
----------------
This test seems irrelevant to what this patch is trying to achieve.


================
Comment at: clang/unittests/Introspection/IntrospectionTest.cpp:1294
+
+#ifndef _WIN32
+TEST(Introspection, SourceLocations_TypeOfTypeLoc) {
----------------
Can you add a comment explaining the issues with this test on windows platforms.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100516/new/

https://reviews.llvm.org/D100516



More information about the cfe-commits mailing list