sopyb wrote:

Hey there, I've hit a bit of a wall. I'm trying to figure out if a location is 
inside a comment. The check generates faulty diagnostics, as it is now, if 
there are comments including '(', '{', '}', and ','. If I could check if the 
match is inside a comment this issue could be fixed in a few lines of code. I 
spent all day looking around [doxygen](https://clang.llvm.org/doxygen/) and 
trying out stuff but nothing seems to work. Here's an example of faulty code:

```cpp
std::min(
  std::min/*some comment containing (*/(
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // comment containing {
                          ~
    {
      4,
      5 
    // some comment containing }
                               ~
    },
    // some comment containing ,
                               ~
    CmpFunc
    ~~~~~~~ (as intended)
  ),
  ~
  1, 
CmpFunc);
```

so the output is
```cpp
std::min(
  */(
    // comment containing
    {
      4,
      5 
    // some comment containing 
    },
    // some comment containing 
  ,
  1, 
CmpFunc);
```

https://github.com/llvm/llvm-project/pull/85572
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to