Native VBS and CMake builds of the server and every registered suite: protocol and document sync, VBS/compdb providers, stock GCC diagnostics (including in-process default profile preparation), the stock occurrence observer and hover/definition, the bounded Scheduler, C++ module graph, scan and artifact cache with real CMI production, the context-aware symbol index with schema-2 snapshot migration, navigation and guarded rename, reflection provenance with splice-origin extraction, index-backed completion and signature help, live GCC worker control with a registered DAP suite, and the Neovim and VS Code clients. VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced from the versioned patches and verified stepping reflection/template code with projected values 17/34 and 41/82.
104 lines
3.5 KiB
Diff
104 lines
3.5 KiB
Diff
--- a/gcc/cp/reflect.cc
|
|
+++ b/gcc/cp/reflect.cc
|
|
@@ -31,6 +31,7 @@
|
|
#include "c-family/c-pragma.h" // for parse_in
|
|
#include "gimplify.h" // for unshare_expr
|
|
#include "metafns.h"
|
|
+#include "vls-eval.h"
|
|
|
|
static tree eval_is_function_type (tree);
|
|
static tree eval_is_object_type (location_t, const constexpr_ctx *, tree,
|
|
@@ -8770,6 +8771,7 @@
|
|
return error_mark_node;
|
|
|
|
refl = REFLECT_EXPR_HANDLE (refl);
|
|
+ vls_eval::splice (loc, refl);
|
|
/* Function templates are wrapped in OVERLOAD from name lookup
|
|
and a lot of places assume that. Furthermore, if reflection comes
|
|
from ^^fntmpl, it is wrapped with OVERLOAD already, only when
|
|
--- a/gcc/cp/vls-eval.cc
|
|
+++ b/gcc/cp/vls-eval.cc
|
|
@@ -294,7 +294,8 @@
|
|
r.append (",\"backend\":\"gcc-16.2.0/vls-eval-1\",\"pid\":%ld,"
|
|
"\"capabilities\":[\"integralReturn\",\"cooperativeStep\"],"
|
|
"\"kinds\":[\"hello\",\"enter\",\"body\",\"value\",\"cached\","
|
|
- "\"stopped\",\"resumed\",\"leave\",\"terminal\",\"frontendEnd\"]",
|
|
+ "\"stopped\",\"resumed\",\"leave\",\"terminal\",\"frontendEnd\","
|
|
+ "\"splice\"]",
|
|
(long) getpid ());
|
|
publish (r);
|
|
return true;
|
|
@@ -406,4 +407,59 @@
|
|
publish (r);
|
|
}
|
|
|
|
+// One splice record carries both ends of the first provenance link: the
|
|
+// editable splice site and the reflected entity it designates. Identity is
|
|
+// composed by the consumer from the target kind, name and location; the
|
|
+// compiler never invents a source spelling.
|
|
+void
|
|
+splice (location_t loc, tree entity)
|
|
+{
|
|
+ if (!observing || flag_vls_ide || RESERVED_LOCATION_P (loc)
|
|
+ || in_system_header_at (loc) || from_macro_expansion_at (loc))
|
|
+ return;
|
|
+ expanded_location x = expand_location (loc);
|
|
+ if (!x.file || x.line <= 0 || x.column <= 0)
|
|
+ return;
|
|
+ record r ("splice");
|
|
+ r.append (",\"source\":");
|
|
+ r.text (x.file);
|
|
+ r.append (",\"line\":%d,\"byteColumn\":%d", x.line, x.column);
|
|
+ const char *kind = "value";
|
|
+ tree name = NULL_TREE;
|
|
+ location_t target_loc = UNKNOWN_LOCATION;
|
|
+ if (entity && DECL_P (entity))
|
|
+ {
|
|
+ kind = "declaration";
|
|
+ name = DECL_NAME (entity);
|
|
+ target_loc = DECL_SOURCE_LOCATION (entity);
|
|
+ }
|
|
+ else if (entity && TYPE_P (entity))
|
|
+ {
|
|
+ kind = "type";
|
|
+ name = TYPE_IDENTIFIER (entity);
|
|
+ if (!name && TYPE_NAME (entity) && DECL_P (TYPE_NAME (entity)))
|
|
+ {
|
|
+ name = DECL_NAME (TYPE_NAME (entity));
|
|
+ target_loc = DECL_SOURCE_LOCATION (TYPE_NAME (entity));
|
|
+ }
|
|
+ }
|
|
+ r.append (",\"targetKind\":\"%s\",\"targetName\":", kind);
|
|
+ r.text (name ? IDENTIFIER_POINTER (name) : nullptr);
|
|
+ if (!RESERVED_LOCATION_P (target_loc))
|
|
+ {
|
|
+ expanded_location y = expand_location (target_loc);
|
|
+ if (y.file && y.line > 0 && y.column > 0)
|
|
+ {
|
|
+ r.append (",\"targetSource\":");
|
|
+ r.text (y.file);
|
|
+ r.append (",\"targetLine\":%d,\"targetByteColumn\":%d", y.line, y.column);
|
|
+ publish (r);
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ r.append (",\"targetSource\":null,\"targetLine\":null,"
|
|
+ "\"targetByteColumn\":null");
|
|
+ publish (r);
|
|
+}
|
|
+
|
|
} // namespace vls_eval
|
|
--- a/gcc/cp/vls-eval.h
|
|
+++ b/gcc/cp/vls-eval.h
|
|
@@ -7,6 +7,10 @@
|
|
bool start ();
|
|
void finish ();
|
|
|
|
+// Records one evaluated splice: the splice site and the entity it names.
|
|
+// Only the observe invocation and only non-system, non-macro locations.
|
|
+void splice (location_t, tree);
|
|
+
|
|
namespace ide {
|
|
void tentative ();
|
|
void witness (tree, location_t, bool);
|