[PATCH] D67788: StringLiteral: intellisense workaround
Lawrence D'Anna via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 21:11:17 PDT 2019
lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, jasonmolenda.
Herald added a subscriber: dexonsmith.
Herald added a project: LLVM.
lawrence_danna edited the summary of this revision.
The intellisense parser from Visual Studio Code will pretend to be
clang by defining `__clang__`, but it doesn't fully implement enable_if.
It does define `__INTELLISENSE__` however, so we can avoid spurious
errors by also checking for that.
https://github.com/microsoft/vscode-cpptools/issues/4246
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D67788
Files:
llvm/include/llvm/ADT/StringRef.h
Index: llvm/include/llvm/ADT/StringRef.h
===================================================================
--- llvm/include/llvm/ADT/StringRef.h
+++ llvm/include/llvm/ADT/StringRef.h
@@ -857,7 +857,7 @@
public:
template <size_t N>
constexpr StringLiteral(const char (&Str)[N])
-#if defined(__clang__) && __has_attribute(enable_if)
+#if !__INTELLISENSE__ && defined(__clang__) && __has_attribute(enable_if)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgcc-compat"
__attribute((enable_if(__builtin_strlen(Str) == N - 1,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67788.220938.patch
Type: text/x-patch
Size: 565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190920/1b538c01/attachment.bin>
More information about the llvm-commits
mailing list