summaryrefslogtreecommitdiffstats
path: root/tools/libclang/CIndexDiagnostic.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libclang/CIndexDiagnostic.h')
-rw-r--r--tools/libclang/CIndexDiagnostic.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/tools/libclang/CIndexDiagnostic.h b/tools/libclang/CIndexDiagnostic.h
index 31ae902..4347fb7 100644
--- a/tools/libclang/CIndexDiagnostic.h
+++ b/tools/libclang/CIndexDiagnostic.h
@@ -10,10 +10,11 @@
|* Implements the diagnostic functions of the Clang C interface. *|
|* *|
\*===----------------------------------------------------------------------===*/
-#ifndef LLVM_CLANG_CINDEX_DIAGNOSTIC_H
-#define LLVM_CLANG_CINDEX_DIAGNOSTIC_H
+#ifndef LLVM_CLANG_TOOLS_LIBCLANG_CINDEXDIAGNOSTIC_H
+#define LLVM_CLANG_TOOLS_LIBCLANG_CINDEXDIAGNOSTIC_H
#include "clang-c/Index.h"
+#include <memory>
#include <vector>
#include <assert.h>
@@ -24,27 +25,25 @@ class StoredDiagnostic;
class CXDiagnosticImpl;
class CXDiagnosticSetImpl {
- std::vector<CXDiagnosticImpl *> Diagnostics;
+ std::vector<std::unique_ptr<CXDiagnosticImpl>> Diagnostics;
const bool IsExternallyManaged;
public:
CXDiagnosticSetImpl(bool isManaged = false)
: IsExternallyManaged(isManaged) {}
virtual ~CXDiagnosticSetImpl();
-
+
size_t getNumDiagnostics() const {
return Diagnostics.size();
}
CXDiagnosticImpl *getDiagnostic(unsigned i) const {
assert(i < getNumDiagnostics());
- return Diagnostics[i];
+ return Diagnostics[i].get();
}
-
- void appendDiagnostic(CXDiagnosticImpl *D) {
- Diagnostics.push_back(D);
- }
-
+
+ void appendDiagnostic(std::unique_ptr<CXDiagnosticImpl> D);
+
bool empty() const {
return Diagnostics.empty();
}
@@ -99,9 +98,9 @@ public:
protected:
CXDiagnosticImpl(Kind k) : K(k) {}
CXDiagnosticSetImpl ChildDiags;
-
- void append(CXDiagnosticImpl *D) {
- ChildDiags.appendDiagnostic(D);
+
+ void append(std::unique_ptr<CXDiagnosticImpl> D) {
+ ChildDiags.appendDiagnostic(std::move(D));
}
private:
@@ -163,4 +162,4 @@ CXDiagnosticSetImpl *lazyCreateDiags(CXTranslationUnit TU,
} // end namespace clang
-#endif // LLVM_CLANG_CINDEX_DIAGNOSTIC_H
+#endif
OpenPOWER on IntegriCloud