Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | //===--- DiagChecker.cpp - Diagnostic Checking Functions ------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 0bc735f | 2007-12-29 19:59:25 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // Process the input files and check that the diagnostic messages are expected. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Eli Friedman | b09f6e1 | 2009-05-19 04:14:29 +0000 | [diff] [blame] | 14 | #include "clang/Frontend/Utils.h" |
Daniel Dunbar | e1bd4e6 | 2009-03-02 06:16:29 +0000 | [diff] [blame] | 15 | #include "clang/Frontend/TextDiagnosticBuffer.h" |
Chris Lattner | e91c134 | 2008-02-06 00:23:21 +0000 | [diff] [blame] | 16 | #include "clang/Sema/ParseAST.h" |
Chris Lattner | 556beb7 | 2007-09-15 22:56:56 +0000 | [diff] [blame] | 17 | #include "clang/AST/ASTConsumer.h" |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 18 | #include "clang/Basic/SourceManager.h" |
| 19 | #include "clang/Lex/Preprocessor.h" |
| 20 | using namespace clang; |
| 21 | |
| 22 | typedef TextDiagnosticBuffer::DiagList DiagList; |
| 23 | typedef TextDiagnosticBuffer::const_iterator const_diag_iterator; |
| 24 | |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 25 | static void EmitError(Preprocessor &PP, SourceLocation Pos, const char *String){ |
| 26 | unsigned ID = PP.getDiagnostics().getCustomDiagID(Diagnostic::Error, String); |
| 27 | PP.Diag(Pos, ID); |
| 28 | } |
| 29 | |
| 30 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 31 | // USING THE DIAGNOSTIC CHECKER: |
| 32 | // |
| 33 | // Indicating that a line expects an error or a warning is simple. Put a comment |
| 34 | // on the line that has the diagnostic, use "expected-{error,warning}" to tag |
| 35 | // if it's an expected error or warning, and place the expected text between {{ |
| 36 | // and }} markers. The full text doesn't have to be included, only enough to |
| 37 | // ensure that the correct diagnostic was emitted. |
| 38 | // |
| 39 | // Here's an example: |
| 40 | // |
| 41 | // int A = B; // expected-error {{use of undeclared identifier 'B'}} |
| 42 | // |
| 43 | // You can place as many diagnostics on one line as you wish. To make the code |
| 44 | // more readable, you can use slash-newline to separate out the diagnostics. |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 45 | // |
| 46 | // The simple syntax above allows each specification to match exactly one error. |
| 47 | // You can use the extended syntax to customize this. The extended syntax is |
| 48 | // "expected-<type> <n> {{diag text}}", where <type> is one of "error", |
| 49 | // "warning" or "note", and <n> is a positive integer. This allows the |
| 50 | // diagnostic to appear as many times as specified. Example: |
| 51 | // |
| 52 | // void f(); // expected-note 2 {{previous declaration is here}} |
| 53 | // |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 54 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 55 | /// FindDiagnostics - Go through the comment and see if it indicates expected |
| 56 | /// diagnostics. If so, then put them in a diagnostic list. |
| 57 | /// |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 58 | static void FindDiagnostics(const char *CommentStart, unsigned CommentLen, |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 59 | DiagList &ExpectedDiags, |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 60 | Preprocessor &PP, SourceLocation Pos, |
| 61 | const char *ExpectedStr) { |
| 62 | const char *CommentEnd = CommentStart+CommentLen; |
| 63 | unsigned ExpectedStrLen = strlen(ExpectedStr); |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 64 | |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 65 | // Find all expected-foo diagnostics in the string and add them to |
| 66 | // ExpectedDiags. |
| 67 | while (CommentStart != CommentEnd) { |
| 68 | CommentStart = std::find(CommentStart, CommentEnd, 'e'); |
| 69 | if (unsigned(CommentEnd-CommentStart) < ExpectedStrLen) return; |
| 70 | |
| 71 | // If this isn't expected-foo, ignore it. |
| 72 | if (memcmp(CommentStart, ExpectedStr, ExpectedStrLen)) { |
| 73 | ++CommentStart; |
| 74 | continue; |
| 75 | } |
| 76 | |
| 77 | CommentStart += ExpectedStrLen; |
| 78 | |
| 79 | // Skip whitespace. |
| 80 | while (CommentStart != CommentEnd && |
| 81 | isspace(CommentStart[0])) |
| 82 | ++CommentStart; |
| 83 | |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 84 | // Default, if we find the '{' now, is 1 time. |
| 85 | int Times = 1; |
| 86 | int Temp = 0; |
| 87 | // In extended syntax, there could be a digit now. |
| 88 | while (CommentStart != CommentEnd && |
| 89 | CommentStart[0] >= '0' && CommentStart[0] <= '9') { |
| 90 | Temp *= 10; |
| 91 | Temp += CommentStart[0] - '0'; |
| 92 | ++CommentStart; |
| 93 | } |
| 94 | if (Temp > 0) |
| 95 | Times = Temp; |
| 96 | |
| 97 | // Skip whitespace again. |
| 98 | while (CommentStart != CommentEnd && |
| 99 | isspace(CommentStart[0])) |
| 100 | ++CommentStart; |
| 101 | |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 102 | // We should have a {{ now. |
| 103 | if (CommentEnd-CommentStart < 2 || |
| 104 | CommentStart[0] != '{' || CommentStart[1] != '{') { |
| 105 | if (std::find(CommentStart, CommentEnd, '{') != CommentEnd) |
| 106 | EmitError(PP, Pos, "bogus characters before '{{' in expected string"); |
| 107 | else |
| 108 | EmitError(PP, Pos, "cannot find start ('{{') of expected string"); |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 109 | return; |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 110 | } |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 111 | CommentStart += 2; |
| 112 | |
| 113 | // Find the }}. |
| 114 | const char *ExpectedEnd = CommentStart; |
| 115 | while (1) { |
| 116 | ExpectedEnd = std::find(ExpectedEnd, CommentEnd, '}'); |
| 117 | if (CommentEnd-ExpectedEnd < 2) { |
| 118 | EmitError(PP, Pos, "cannot find end ('}}') of expected string"); |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | if (ExpectedEnd[1] == '}') |
| 123 | break; |
| 124 | |
| 125 | ++ExpectedEnd; // Skip over singular }'s |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 126 | } |
| 127 | |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 128 | std::string Msg(CommentStart, ExpectedEnd); |
| 129 | std::string::size_type FindPos; |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 130 | while ((FindPos = Msg.find("\\n")) != std::string::npos) |
Sebastian Redl | ad3c91c | 2008-10-26 19:05:16 +0000 | [diff] [blame] | 131 | Msg.replace(FindPos, 2, "\n"); |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 132 | // Add is possibly multiple times. |
| 133 | for (int i = 0; i < Times; ++i) |
| 134 | ExpectedDiags.push_back(std::make_pair(Pos, Msg)); |
| 135 | |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 136 | CommentStart = ExpectedEnd; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 137 | } |
| 138 | } |
| 139 | |
Ted Kremenek | 95041a2 | 2007-12-19 22:51:13 +0000 | [diff] [blame] | 140 | /// FindExpectedDiags - Lex the main source file to find all of the |
| 141 | // expected errors and warnings. |
| 142 | static void FindExpectedDiags(Preprocessor &PP, |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 143 | DiagList &ExpectedErrors, |
Douglas Gregor | 233f74b | 2008-09-11 02:46:36 +0000 | [diff] [blame] | 144 | DiagList &ExpectedWarnings, |
| 145 | DiagList &ExpectedNotes) { |
Chris Lattner | a39f048 | 2008-11-21 01:18:36 +0000 | [diff] [blame] | 146 | // Create a raw lexer to pull all the comments out of the main file. We don't |
| 147 | // want to look in #include'd headers for expected-error strings. |
Chris Lattner | 2b2453a | 2009-01-17 06:22:33 +0000 | [diff] [blame] | 148 | FileID FID = PP.getSourceManager().getMainFileID(); |
Chris Lattner | a39f048 | 2008-11-21 01:18:36 +0000 | [diff] [blame] | 149 | |
| 150 | // Create a lexer to lex all the tokens of the main file in raw mode. |
Chris Lattner | 4448a01 | 2009-01-17 07:41:36 +0000 | [diff] [blame] | 151 | Lexer RawLex(FID, PP.getSourceManager(), PP.getLangOptions()); |
Chris Lattner | a39f048 | 2008-11-21 01:18:36 +0000 | [diff] [blame] | 152 | |
| 153 | // Return comments as tokens, this is how we find expected diagnostics. |
| 154 | RawLex.SetCommentRetentionState(true); |
| 155 | |
Chris Lattner | d217773 | 2007-07-20 16:59:19 +0000 | [diff] [blame] | 156 | Token Tok; |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 157 | Tok.setKind(tok::comment); |
| 158 | while (Tok.isNot(tok::eof)) { |
Chris Lattner | a39f048 | 2008-11-21 01:18:36 +0000 | [diff] [blame] | 159 | RawLex.Lex(Tok); |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 160 | if (!Tok.is(tok::comment)) continue; |
| 161 | |
| 162 | std::string Comment = PP.getSpelling(Tok); |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 163 | if (Comment.empty()) continue; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 164 | |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 165 | |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 166 | // Find all expected errors. |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 167 | FindDiagnostics(&Comment[0], Comment.size(), ExpectedErrors, PP, |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 168 | Tok.getLocation(), "expected-error"); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 169 | |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 170 | // Find all expected warnings. |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 171 | FindDiagnostics(&Comment[0], Comment.size(), ExpectedWarnings, PP, |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 172 | Tok.getLocation(), "expected-warning"); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 173 | |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 174 | // Find all expected notes. |
Chris Lattner | 0947b4e | 2008-11-24 01:28:17 +0000 | [diff] [blame] | 175 | FindDiagnostics(&Comment[0], Comment.size(), ExpectedNotes, PP, |
Chris Lattner | b2c8c55 | 2008-11-23 23:38:26 +0000 | [diff] [blame] | 176 | Tok.getLocation(), "expected-note"); |
| 177 | }; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | /// PrintProblem - This takes a diagnostic map of the delta between expected and |
| 181 | /// seen diagnostics. If there's anything in it, then something unexpected |
| 182 | /// happened. Print the map out in a nice format and return "true". If the map |
| 183 | /// is empty and we're not going to print things, then return "false". |
| 184 | /// |
| 185 | static bool PrintProblem(SourceManager &SourceMgr, |
| 186 | const_diag_iterator diag_begin, |
| 187 | const_diag_iterator diag_end, |
| 188 | const char *Msg) { |
| 189 | if (diag_begin == diag_end) return false; |
| 190 | |
| 191 | fprintf(stderr, "%s\n", Msg); |
| 192 | |
| 193 | for (const_diag_iterator I = diag_begin, E = diag_end; I != E; ++I) |
| 194 | fprintf(stderr, " Line %d: %s\n", |
Chris Lattner | f7cf85b | 2009-01-16 07:36:28 +0000 | [diff] [blame] | 195 | SourceMgr.getInstantiationLineNumber(I->first), |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 196 | I->second.c_str()); |
| 197 | |
| 198 | return true; |
| 199 | } |
| 200 | |
Chris Lattner | 4e69fd5 | 2009-02-04 02:15:34 +0000 | [diff] [blame] | 201 | /// CompareDiagLists - Compare two diagnostic lists and return the difference |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 202 | /// between them. |
| 203 | /// |
| 204 | static bool CompareDiagLists(SourceManager &SourceMgr, |
| 205 | const_diag_iterator d1_begin, |
| 206 | const_diag_iterator d1_end, |
| 207 | const_diag_iterator d2_begin, |
| 208 | const_diag_iterator d2_end, |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 209 | const char *MsgLeftOnly, |
| 210 | const char *MsgRightOnly) { |
| 211 | DiagList LeftOnly; |
| 212 | DiagList Left(d1_begin, d1_end); |
| 213 | DiagList Right(d2_begin, d2_end); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 214 | |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 215 | for (const_diag_iterator I = Left.begin(), E = Left.end(); I != E; ++I) { |
Chris Lattner | f7cf85b | 2009-01-16 07:36:28 +0000 | [diff] [blame] | 216 | unsigned LineNo1 = SourceMgr.getInstantiationLineNumber(I->first); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 217 | const std::string &Diag1 = I->second; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 218 | |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 219 | DiagList::iterator II, IE; |
| 220 | for (II = Right.begin(), IE = Right.end(); II != IE; ++II) { |
Chris Lattner | f7cf85b | 2009-01-16 07:36:28 +0000 | [diff] [blame] | 221 | unsigned LineNo2 = SourceMgr.getInstantiationLineNumber(II->first); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 222 | if (LineNo1 != LineNo2) continue; |
| 223 | |
| 224 | const std::string &Diag2 = II->second; |
| 225 | if (Diag2.find(Diag1) != std::string::npos || |
| 226 | Diag1.find(Diag2) != std::string::npos) { |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 227 | break; |
| 228 | } |
| 229 | } |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 230 | if (II == IE) { |
| 231 | // Not found. |
| 232 | LeftOnly.push_back(*I); |
| 233 | } else { |
| 234 | // Found. The same cannot be found twice. |
| 235 | Right.erase(II); |
| 236 | } |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 237 | } |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 238 | // Now all that's left in Right are those that were not matched. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 239 | |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 240 | return PrintProblem(SourceMgr, LeftOnly.begin(), LeftOnly.end(), MsgLeftOnly) |
| 241 | | PrintProblem(SourceMgr, Right.begin(), Right.end(), MsgRightOnly); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | /// CheckResults - This compares the expected results to those that |
| 245 | /// were actually reported. It emits any discrepencies. Return "true" if there |
| 246 | /// were problems. Return "false" otherwise. |
| 247 | /// |
| 248 | static bool CheckResults(Preprocessor &PP, |
| 249 | const DiagList &ExpectedErrors, |
Douglas Gregor | 233f74b | 2008-09-11 02:46:36 +0000 | [diff] [blame] | 250 | const DiagList &ExpectedWarnings, |
| 251 | const DiagList &ExpectedNotes) { |
Nico Weber | 7bfaaae | 2008-08-10 19:59:06 +0000 | [diff] [blame] | 252 | const DiagnosticClient *DiagClient = PP.getDiagnostics().getClient(); |
| 253 | assert(DiagClient != 0 && |
| 254 | "DiagChecker requires a valid TextDiagnosticBuffer"); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 255 | const TextDiagnosticBuffer &Diags = |
Nico Weber | 7bfaaae | 2008-08-10 19:59:06 +0000 | [diff] [blame] | 256 | static_cast<const TextDiagnosticBuffer&>(*DiagClient); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 257 | SourceManager &SourceMgr = PP.getSourceManager(); |
| 258 | |
| 259 | // We want to capture the delta between what was expected and what was |
| 260 | // seen. |
| 261 | // |
| 262 | // Expected \ Seen - set expected but not seen |
| 263 | // Seen \ Expected - set seen but not expected |
| 264 | bool HadProblem = false; |
| 265 | |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 266 | // See if there are error mismatches. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 267 | HadProblem |= CompareDiagLists(SourceMgr, |
| 268 | ExpectedErrors.begin(), ExpectedErrors.end(), |
| 269 | Diags.err_begin(), Diags.err_end(), |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 270 | "Errors expected but not seen:", |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 271 | "Errors seen but not expected:"); |
| 272 | |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 273 | // See if there are warning mismatches. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 274 | HadProblem |= CompareDiagLists(SourceMgr, |
| 275 | ExpectedWarnings.begin(), |
| 276 | ExpectedWarnings.end(), |
| 277 | Diags.warn_begin(), Diags.warn_end(), |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 278 | "Warnings expected but not seen:", |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 279 | "Warnings seen but not expected:"); |
| 280 | |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 281 | // See if there are note mismatches. |
Douglas Gregor | 233f74b | 2008-09-11 02:46:36 +0000 | [diff] [blame] | 282 | HadProblem |= CompareDiagLists(SourceMgr, |
| 283 | ExpectedNotes.begin(), |
| 284 | ExpectedNotes.end(), |
| 285 | Diags.note_begin(), Diags.note_end(), |
Sebastian Redl | 3cb0692 | 2009-02-07 19:52:04 +0000 | [diff] [blame] | 286 | "Notes expected but not seen:", |
Douglas Gregor | 233f74b | 2008-09-11 02:46:36 +0000 | [diff] [blame] | 287 | "Notes seen but not expected:"); |
| 288 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 289 | return HadProblem; |
| 290 | } |
| 291 | |
Chris Lattner | 009e9f7 | 2007-08-10 18:27:41 +0000 | [diff] [blame] | 292 | |
Argyrios Kyrtzidis | 14d4140 | 2008-06-13 12:15:34 +0000 | [diff] [blame] | 293 | /// CheckDiagnostics - Gather the expected diagnostics and check them. |
| 294 | bool clang::CheckDiagnostics(Preprocessor &PP) { |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 295 | // Gather the set of expected diagnostics. |
Douglas Gregor | 233f74b | 2008-09-11 02:46:36 +0000 | [diff] [blame] | 296 | DiagList ExpectedErrors, ExpectedWarnings, ExpectedNotes; |
| 297 | FindExpectedDiags(PP, ExpectedErrors, ExpectedWarnings, ExpectedNotes); |
Ted Kremenek | 4457978 | 2007-09-25 18:37:20 +0000 | [diff] [blame] | 298 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 299 | // Check that the expected diagnostics occurred. |
Douglas Gregor | 233f74b | 2008-09-11 02:46:36 +0000 | [diff] [blame] | 300 | return CheckResults(PP, ExpectedErrors, ExpectedWarnings, ExpectedNotes); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 301 | } |