arphaman added inline comments.

================
Comment at: clangd/ClangdServer.cpp:292
+
+  if (path.compare(path.length() - 4, 4, ".cpp") == 0) {
+    path = path.substr(0, (path.length() - 4));
----------------
malaperle wrote:
> this won't work for other extensions, we need to make this more generic. I 
> believe you had a list of typical source files extensions and header 
> extensions before?
LLVM has a wonderful `sys::path` library for path manipulations. You could 
rewrite these checks like this:

```
if (llvm::sys::path::extension(path) == ".cpp") {
 SmallString<128> NewPath = path;
 llvm::sys::path::replace_extension(NewPath, "h");
 return "\"" + NewPath.str() + "\"";
}
```


https://reviews.llvm.org/D36150



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to