forked from OSchip/llvm-project
Fix regression: initialize 'size' for PathDiagnostic to 0.
Add some assertions along the way... llvm-svn: 66265
This commit is contained in:
parent
e41a434f89
commit
55f46f6aab
|
@ -37,8 +37,12 @@ private:
|
|||
const DisplayHint Hint;
|
||||
std::vector<SourceRange> ranges;
|
||||
|
||||
public:
|
||||
// Do not implement:
|
||||
PathDiagnosticPiece();
|
||||
PathDiagnosticPiece(const PathDiagnosticPiece &P);
|
||||
PathDiagnosticPiece& operator=(const PathDiagnosticPiece &P);
|
||||
|
||||
public:
|
||||
PathDiagnosticPiece(FullSourceLoc pos, const std::string& s,
|
||||
Kind k = Event,
|
||||
DisplayHint hint = Above);
|
||||
|
@ -98,10 +102,10 @@ class PathDiagnostic {
|
|||
std::string Desc;
|
||||
std::string Category;
|
||||
std::vector<std::string> OtherDesc;
|
||||
|
||||
|
||||
public:
|
||||
PathDiagnostic() : Size(0) {}
|
||||
|
||||
PathDiagnostic();
|
||||
|
||||
PathDiagnostic(const char* bugtype, const char* desc, const char* category);
|
||||
|
||||
PathDiagnostic(const std::string& bugtype, const std::string& desc,
|
||||
|
|
|
@ -36,12 +36,20 @@ static inline size_t GetNumCharsToLastNonPeriod(const std::string &s) {
|
|||
PathDiagnosticPiece::PathDiagnosticPiece(FullSourceLoc pos,
|
||||
const std::string& s,
|
||||
Kind k, DisplayHint hint)
|
||||
: Pos(pos), str(s, 0, GetNumCharsToLastNonPeriod(s)), kind(k), Hint(hint) {}
|
||||
: Pos(pos), str(s, 0, GetNumCharsToLastNonPeriod(s)), kind(k), Hint(hint) {
|
||||
assert(Pos.isValid() &&
|
||||
"PathDiagnosticPiece's must have a valid location.");
|
||||
}
|
||||
|
||||
PathDiagnosticPiece::PathDiagnosticPiece(FullSourceLoc pos,
|
||||
const char* s, Kind k,
|
||||
DisplayHint hint)
|
||||
: Pos(pos), str(s, GetNumCharsToLastNonPeriod(s)), kind(k), Hint(hint) {}
|
||||
: Pos(pos), str(s, GetNumCharsToLastNonPeriod(s)), kind(k), Hint(hint) {
|
||||
assert(Pos.isValid() &&
|
||||
"PathDiagnosticPiece's must have a valid location.");
|
||||
}
|
||||
|
||||
PathDiagnostic::PathDiagnostic() : Size(0) {}
|
||||
|
||||
PathDiagnostic::~PathDiagnostic() {
|
||||
for (iterator I = begin(), E = end(); I != E; ++I) delete &*I;
|
||||
|
@ -50,14 +58,16 @@ PathDiagnostic::~PathDiagnostic() {
|
|||
|
||||
PathDiagnostic::PathDiagnostic(const char* bugtype, const char* desc,
|
||||
const char* category)
|
||||
: BugType(bugtype, GetNumCharsToLastNonPeriod(bugtype)),
|
||||
: Size(0),
|
||||
BugType(bugtype, GetNumCharsToLastNonPeriod(bugtype)),
|
||||
Desc(desc, GetNumCharsToLastNonPeriod(desc)),
|
||||
Category(category, GetNumCharsToLastNonPeriod(category)) {}
|
||||
|
||||
PathDiagnostic::PathDiagnostic(const std::string& bugtype,
|
||||
const std::string& desc,
|
||||
const std::string& category)
|
||||
: BugType(bugtype, 0, GetNumCharsToLastNonPeriod(bugtype)),
|
||||
: Size(0),
|
||||
BugType(bugtype, 0, GetNumCharsToLastNonPeriod(bugtype)),
|
||||
Desc(desc, 0, GetNumCharsToLastNonPeriod(desc)),
|
||||
Category(category, 0, GetNumCharsToLastNonPeriod(category)) {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue