================
@@ -1013,6 +1013,14 @@ std::optional<HoverInfo> getHoverContents(const 
SelectionTree::Node *N,
 // Generates hover info for attributes.
 std::optional<HoverInfo> getHoverContents(const Attr *A, ParsedAST &AST) {
   HoverInfo HI;
+  if (const auto *SA = llvm::dyn_cast<HLSLUnparsedSemanticAttr>(A)) {
+    std::string Name = A->getAttrName()->getName().str();
+    if (SA->getExplicitIndex())
+      Name += std::to_string(SA->getIndex());
+    HI.Name = Name;
+    HI.Definition = "[" + Name + "]";
----------------
mafeguimaraes wrote:

I tested this directly, and `HI.Name` is not already correct without this patch 
for `HLSLUnparsedSemanticAttr`.

I temporarily removed the `HI.Name = Name;` line and reran the hover test on a 
user-defined semantic (`COLOR`):

```
With HI.Name = Name;      -> HI.Name = "COLOR"
Without HI.Name = Name;   -> HI.Name = "" (empty)
```

`HI.Definition` stayed `[COLOR]` either way, since that's set independently in 
the same branch. So for this attribute, the generic path doesn't populate 
`HI.Name` on its own.

https://github.com/llvm/llvm-project/pull/217725
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to