A StringRef-ication of the DiagnosticIDs API and internals.
Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static
diagnostic data structures, which resulted in a huge global-var-init function.
Depends on llvm commit r132046.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132047 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndexDiagnostic.cpp b/tools/libclang/CIndexDiagnostic.cpp
index fa3b1ce..0fcdab7 100644
--- a/tools/libclang/CIndexDiagnostic.cpp
+++ b/tools/libclang/CIndexDiagnostic.cpp
@@ -220,7 +220,8 @@
return createCXString("");
unsigned ID = StoredDiag->Diag.getID();
- if (const char *Option = DiagnosticIDs::getWarningOptionForDiag(ID)) {
+ llvm::StringRef Option = DiagnosticIDs::getWarningOptionForDiag(ID);
+ if (!Option.empty()) {
if (Disable)
*Disable = createCXString((llvm::Twine("-Wno-") + Option).str());
return createCXString((llvm::Twine("-W") + Option).str());