blob: 465acf03f3cc9f0fe211fe5241f2fb8515e34c30 [file] [log] [blame]
Ted Kremenek61f3e052008-04-03 04:42:52 +00001// BugReporter.cpp - Generate PathDiagnostics for Bugs ------------*- C++ -*--//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines BugReporter, a utility class for generating
11// PathDiagnostics for analyses based on GRSimpleVals.
12//
13//===----------------------------------------------------------------------===//
14
15#include "clang/Analysis/PathSensitive/BugReporter.h"
Ted Kremenek50a6d0c2008-04-09 21:41:14 +000016#include "clang/Analysis/PathSensitive/GRExprEngine.h"
Ted Kremenek61f3e052008-04-03 04:42:52 +000017#include "clang/Basic/SourceManager.h"
18#include "clang/Basic/SourceLocation.h"
19#include "clang/AST/ASTContext.h"
20#include "clang/AST/CFG.h"
21#include "clang/AST/Expr.h"
22#include "clang/Analysis/ProgramPoint.h"
23#include "clang/Analysis/PathDiagnostic.h"
24#include <sstream>
25
26using namespace clang;
27
28BugReporter::~BugReporter() {}
Ted Kremenek50a6d0c2008-04-09 21:41:14 +000029BugType::~BugType() {}
30BugReport::~BugReport() {}
Ted Kremenek5e55cda2008-04-11 18:40:29 +000031RangedBugReport::~RangedBugReport() {}
32
Ted Kremenek50a6d0c2008-04-09 21:41:14 +000033ExplodedGraph<ValueState>& BugReporter::getGraph() { return Eng.getGraph(); }
Ted Kremenek61f3e052008-04-03 04:42:52 +000034
35static inline Stmt* GetStmt(const ProgramPoint& P) {
36 if (const PostStmt* PS = dyn_cast<PostStmt>(&P)) {
37 return PS->getStmt();
38 }
39 else if (const BlockEdge* BE = dyn_cast<BlockEdge>(&P)) {
40 return BE->getSrc()->getTerminator();
41 }
42 else if (const BlockEntrance* BE = dyn_cast<BlockEntrance>(&P)) {
43 return BE->getFirstStmt();
44 }
45
46 assert (false && "Unsupported ProgramPoint.");
47 return NULL;
48}
49
Ted Kremenek706e3cf2008-04-07 23:35:17 +000050static inline Stmt* GetStmt(const CFGBlock* B) {
Ted Kremenek2673c9f2008-04-25 19:01:27 +000051 if (B->empty()) {
52 assert (B->getTerminator() && "Empty block should have a terminator.");
53 return const_cast<Stmt*>(B->getTerminator());
54 }
55 else
56 return (*B)[0];
Ted Kremenek706e3cf2008-04-07 23:35:17 +000057}
58
Ted Kremenekd2f642b2008-04-14 17:39:48 +000059Stmt* BugReport::getStmt() const {
60 return N ? GetStmt(N->getLocation()) : NULL;
61}
Ted Kremenekbd7efa82008-04-17 23:44:37 +000062
63static inline ExplodedNode<ValueState>*
64GetNextNode(ExplodedNode<ValueState>* N) {
65 return N->pred_empty() ? NULL : *(N->pred_begin());
66}
Ted Kremenek2673c9f2008-04-25 19:01:27 +000067
68static void ExecutionContinues(std::ostream& os, SourceManager& SMgr,
69 ExplodedNode<ValueState>* N) {
Ted Kremenek61f3e052008-04-03 04:42:52 +000070
Ted Kremenek2673c9f2008-04-25 19:01:27 +000071 Stmt* S = GetStmt(N->getLocation());
72
73 if (!S)
74 return;
75
76 os << "Execution continue on line "
77 << SMgr.getLogicalLineNumber(S->getLocStart()) << '.';
78}
Ted Kremenekd2f642b2008-04-14 17:39:48 +000079
Ted Kremenekbd7efa82008-04-17 23:44:37 +000080static Stmt* GetLastStmt(ExplodedNode<ValueState>* N) {
81 assert (isa<BlockEntrance>(N->getLocation()));
82
83 for (N = GetNextNode(N); N; N = GetNextNode(N)) {
84
85 ProgramPoint P = N->getLocation();
86
87 if (PostStmt* PS = dyn_cast<PostStmt>(&P))
88 return PS->getStmt();
89 }
90
91 return NULL;
92}
93
94PathDiagnosticPiece*
95BugReport::getEndPath(BugReporter& BR,
96 ExplodedNode<ValueState>* EndPathNode) const {
97
98 ProgramPoint ProgP = EndPathNode->getLocation();
99 Stmt *S = NULL;
100
101 if (BlockEntrance* BE = dyn_cast<BlockEntrance>(&ProgP))
102 if (BE->getBlock() == &BR.getCFG().getExit())
103 S = GetLastStmt(EndPathNode);
104 if (!S)
105 S = GetStmt(ProgP);
Ted Kremenek61f3e052008-04-03 04:42:52 +0000106
107 if (!S)
108 return NULL;
109
Ted Kremenekbd7efa82008-04-17 23:44:37 +0000110 FullSourceLoc L(S->getLocStart(), BR.getContext().getSourceManager());
Ted Kremenek50a6d0c2008-04-09 21:41:14 +0000111
112 PathDiagnosticPiece* P =
113 new PathDiagnosticPiece(L, getDescription());
Ted Kremenek61f3e052008-04-03 04:42:52 +0000114
Ted Kremenekde7161f2008-04-03 18:00:37 +0000115 const SourceRange *Beg, *End;
116 getRanges(Beg, End);
117
118 if (Beg == End) {
119 if (Expr* E = dyn_cast<Expr>(S))
120 P->addRange(E->getSourceRange());
121 }
122 else {
123 assert (Beg < End);
124 for (; Beg != End; ++Beg)
125 P->addRange(*Beg);
126 }
Ted Kremenek61f3e052008-04-03 04:42:52 +0000127
128 return P;
129}
130
Ted Kremenek50a6d0c2008-04-09 21:41:14 +0000131void BugReport::getRanges(const SourceRange*& beg,
Ted Kremenekd2f642b2008-04-14 17:39:48 +0000132 const SourceRange*& end) const {
Ted Kremenekf1ae7052008-04-03 17:57:38 +0000133 beg = NULL;
134 end = NULL;
135}
136
Ted Kremenekd2f642b2008-04-14 17:39:48 +0000137FullSourceLoc BugReport::getLocation(SourceManager& Mgr) {
138
139 if (!N)
140 return FullSourceLoc();
141
142 Stmt* S = GetStmt(N->getLocation());
143
144 if (!S)
145 return FullSourceLoc();
146
147 return FullSourceLoc(S->getLocStart(), Mgr);
148}
149
Ted Kremenek50a6d0c2008-04-09 21:41:14 +0000150PathDiagnosticPiece* BugReport::VisitNode(ExplodedNode<ValueState>* N,
151 ExplodedNode<ValueState>* PrevN,
152 ExplodedGraph<ValueState>& G,
Ted Kremenek8dd56462008-04-18 03:39:05 +0000153 BugReporter& BR) {
Ted Kremenek50a6d0c2008-04-09 21:41:14 +0000154 return NULL;
155}
156
Ted Kremeneka43a1eb2008-04-23 23:02:12 +0000157static std::pair<ExplodedGraph<ValueState>*, ExplodedNode<ValueState>*>
158MakeReportGraph(ExplodedGraph<ValueState>* G, ExplodedNode<ValueState>* N) {
Ted Kremenekd2f642b2008-04-14 17:39:48 +0000159
Ted Kremeneka43a1eb2008-04-23 23:02:12 +0000160 llvm::OwningPtr<ExplodedGraph<ValueState> > GTrim(G->Trim(&N, &N+1));
161
Ted Kremenek910e9992008-04-25 01:25:15 +0000162 // Find the error node in the trimmed graph.
Ted Kremenek94826a72008-04-03 04:59:14 +0000163
Ted Kremenek910e9992008-04-25 01:25:15 +0000164 ExplodedNode<ValueState>* NOld = N;
165 N = 0;
Ted Kremenek94826a72008-04-03 04:59:14 +0000166
Ted Kremenek50a6d0c2008-04-09 21:41:14 +0000167 for (ExplodedGraph<ValueState>::node_iterator
Ted Kremenekbd7efa82008-04-17 23:44:37 +0000168 I = GTrim->nodes_begin(), E = GTrim->nodes_end(); I != E; ++I) {
Ted Kremenek94826a72008-04-03 04:59:14 +0000169
Ted Kremenek910e9992008-04-25 01:25:15 +0000170 if (I->getState() == NOld->getState() &&
171 I->getLocation() == NOld->getLocation()) {
Ted Kremeneka43a1eb2008-04-23 23:02:12 +0000172 N = &*I;
Ted Kremenek94826a72008-04-03 04:59:14 +0000173 break;
174 }
175 }
176
Ted Kremeneka43a1eb2008-04-23 23:02:12 +0000177 assert(N);
Ted Kremenekbd7efa82008-04-17 23:44:37 +0000178
Ted Kremeneka43a1eb2008-04-23 23:02:12 +0000179 // Create a new graph with a single path.
180
181 G = new ExplodedGraph<ValueState>(GTrim->getCFG(), GTrim->getCodeDecl(),
182 GTrim->getContext());
183
184
Ted Kremenek6aaca9c2008-04-23 23:04:32 +0000185 ExplodedNode<ValueState> *Last = 0, *First = 0;
Ted Kremeneka43a1eb2008-04-23 23:02:12 +0000186
187 while (N) {
188 ExplodedNode<ValueState>* NewN =
189 G->getNode(N->getLocation(), N->getState());
190
Ted Kremenek6aaca9c2008-04-23 23:04:32 +0000191 if (!First) First = NewN;
Ted Kremeneka43a1eb2008-04-23 23:02:12 +0000192 if (Last) Last->addPredecessor(NewN);
193
194 Last = NewN;
195 N = N->pred_empty() ? 0 : *(N->pred_begin());
196 }
197
Ted Kremenek6aaca9c2008-04-23 23:04:32 +0000198 return std::make_pair(G, First);
Ted Kremeneka43a1eb2008-04-23 23:02:12 +0000199}
200
201void BugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
202 BugReport& R) {
203
204 ExplodedNode<ValueState>* N = R.getEndNode();
205
206 if (!N) return;
207
208 // Construct a new graph that contains only a single path from the error
209 // node to a root.
210
211 const std::pair<ExplodedGraph<ValueState>*,ExplodedNode<ValueState>*>
212 GPair = MakeReportGraph(&getGraph(), N);
213
214 llvm::OwningPtr<ExplodedGraph<ValueState> > ReportGraph(GPair.first);
215 assert(GPair.second->getLocation() == N->getLocation());
216 N = GPair.second;
217
218 // Start building the path diagnostic...
219
Ted Kremenekbd7efa82008-04-17 23:44:37 +0000220 if (PathDiagnosticPiece* Piece = R.getEndPath(*this, N))
221 PD.push_back(Piece);
222 else
223 return;
Ted Kremenek6837faa2008-04-09 00:20:43 +0000224
225 ExplodedNode<ValueState>* NextNode = N->pred_empty()
226 ? NULL : *(N->pred_begin());
227
Ted Kremenekbd7efa82008-04-17 23:44:37 +0000228 SourceManager& SMgr = Ctx.getSourceManager();
229
Ted Kremenek6837faa2008-04-09 00:20:43 +0000230 while (NextNode) {
Ted Kremenek61f3e052008-04-03 04:42:52 +0000231
232 ExplodedNode<ValueState>* LastNode = N;
Ted Kremenek6837faa2008-04-09 00:20:43 +0000233 N = NextNode;
Ted Kremenekbd7efa82008-04-17 23:44:37 +0000234 NextNode = GetNextNode(N);
Ted Kremenek61f3e052008-04-03 04:42:52 +0000235
236 ProgramPoint P = N->getLocation();
237
238 if (const BlockEdge* BE = dyn_cast<BlockEdge>(&P)) {
239
240 CFGBlock* Src = BE->getSrc();
241 CFGBlock* Dst = BE->getDst();
242
243 Stmt* T = Src->getTerminator();
244
245 if (!T)
246 continue;
247
248 FullSourceLoc L(T->getLocStart(), SMgr);
249
250 switch (T->getStmtClass()) {
251 default:
252 break;
253
254 case Stmt::GotoStmtClass:
255 case Stmt::IndirectGotoStmtClass: {
256
257 Stmt* S = GetStmt(LastNode->getLocation());
258
259 if (!S)
260 continue;
261
262 std::ostringstream os;
263
264 os << "Control jumps to line "
Ted Kremenek706e3cf2008-04-07 23:35:17 +0000265 << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
Ted Kremenek61f3e052008-04-03 04:42:52 +0000266
267 PD.push_front(new PathDiagnosticPiece(L, os.str()));
268 break;
269 }
270
271 case Stmt::SwitchStmtClass: {
272
273 // Figure out what case arm we took.
Ted Kremenek5a429952008-04-23 23:35:07 +0000274
Ted Kremenek61f3e052008-04-03 04:42:52 +0000275 std::ostringstream os;
Ted Kremenek5a429952008-04-23 23:35:07 +0000276
277 if (Stmt* S = Dst->getLabel())
278 switch (S->getStmtClass()) {
279
Ted Kremenek61f3e052008-04-03 04:42:52 +0000280 default:
Ted Kremenek5a429952008-04-23 23:35:07 +0000281 assert(false && "Not a valid switch label.");
282 continue;
283
Ted Kremenek8b904552008-04-22 22:29:46 +0000284 case Stmt::DefaultStmtClass: {
Ted Kremenek61f3e052008-04-03 04:42:52 +0000285
286 os << "Control jumps to the 'default' case at line "
Ted Kremenek6837faa2008-04-09 00:20:43 +0000287 << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
Ted Kremenek61f3e052008-04-03 04:42:52 +0000288
289 break;
290 }
291
292 case Stmt::CaseStmtClass: {
293
294 os << "Control jumps to 'case ";
295
Ted Kremenek5a429952008-04-23 23:35:07 +0000296 CaseStmt* Case = cast<CaseStmt>(S);
297 Expr* LHS = Case->getLHS()->IgnoreParenCasts();
Ted Kremenek61f3e052008-04-03 04:42:52 +0000298
Ted Kremenek5a429952008-04-23 23:35:07 +0000299 // Determine if it is an enum.
Ted Kremenek61f3e052008-04-03 04:42:52 +0000300
Ted Kremenek5a429952008-04-23 23:35:07 +0000301 bool GetRawInt = true;
Ted Kremenek61f3e052008-04-03 04:42:52 +0000302
Ted Kremenek5a429952008-04-23 23:35:07 +0000303 if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(LHS)) {
304
305 // FIXME: Maybe this should be an assertion. Are there cases
306 // were it is not an EnumConstantDecl?
307
308 EnumConstantDecl* D = dyn_cast<EnumConstantDecl>(DR->getDecl());
309
310 if (D) {
311 GetRawInt = false;
312 os << D->getName();
313 }
Ted Kremenek61f3e052008-04-03 04:42:52 +0000314 }
Ted Kremenek5a429952008-04-23 23:35:07 +0000315
316 if (GetRawInt) {
Ted Kremenek61f3e052008-04-03 04:42:52 +0000317
Ted Kremenek5a429952008-04-23 23:35:07 +0000318 // Not an enum.
319 Expr* CondE = cast<SwitchStmt>(T)->getCond();
320 unsigned bits = Ctx.getTypeSize(CondE->getType());
321 llvm::APSInt V(bits, false);
Ted Kremenek61f3e052008-04-03 04:42:52 +0000322
Ted Kremenek5a429952008-04-23 23:35:07 +0000323 if (!LHS->isIntegerConstantExpr(V, Ctx, 0, true)) {
324 assert (false && "Case condition must be constant.");
Ted Kremenek61f3e052008-04-03 04:42:52 +0000325 continue;
326 }
327
Ted Kremenek5a429952008-04-23 23:35:07 +0000328 os << V.toString();
Ted Kremenek2673c9f2008-04-25 19:01:27 +0000329 }
Ted Kremenek5a429952008-04-23 23:35:07 +0000330
Ted Kremenek61f3e052008-04-03 04:42:52 +0000331 os << ":' at line "
Ted Kremenek5a429952008-04-23 23:35:07 +0000332 << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
Ted Kremenek61f3e052008-04-03 04:42:52 +0000333
334 break;
335
336 }
337 }
Ted Kremenek56783922008-04-25 01:29:56 +0000338 else {
Ted Kremenek2673c9f2008-04-25 19:01:27 +0000339 os << "'Default' branch taken.";
340 ExecutionContinues(os, SMgr, LastNode);
Ted Kremenek56783922008-04-25 01:29:56 +0000341 }
Ted Kremenek61f3e052008-04-03 04:42:52 +0000342
343 PD.push_front(new PathDiagnosticPiece(L, os.str()));
344 break;
345 }
Ted Kremenek2673c9f2008-04-25 19:01:27 +0000346
347 case Stmt::BreakStmtClass:
348 case Stmt::ContinueStmtClass: {
349 std::ostringstream os;
350 ExecutionContinues(os, SMgr, LastNode);
351 PD.push_front(new PathDiagnosticPiece(L, os.str()));
352 break;
353 }
Ted Kremenek706e3cf2008-04-07 23:35:17 +0000354
355 case Stmt::ConditionalOperatorClass: {
Ted Kremenek61f3e052008-04-03 04:42:52 +0000356
Ted Kremenek706e3cf2008-04-07 23:35:17 +0000357 std::ostringstream os;
358 os << "'?' condition evaluates to ";
359
360 if (*(Src->succ_begin()+1) == Dst)
361 os << "false.";
362 else
363 os << "true.";
Ted Kremenek61f3e052008-04-03 04:42:52 +0000364
Ted Kremenek706e3cf2008-04-07 23:35:17 +0000365 PD.push_front(new PathDiagnosticPiece(L, os.str()));
366
367 break;
368 }
369
370 case Stmt::DoStmtClass: {
371
372 if (*(Src->succ_begin()) == Dst) {
373
374 std::ostringstream os;
375
376 os << "Loop condition is true. Execution continues on line "
377 << SMgr.getLogicalLineNumber(GetStmt(Dst)->getLocStart()) << '.';
378
379 PD.push_front(new PathDiagnosticPiece(L, os.str()));
380 }
381 else
382 PD.push_front(new PathDiagnosticPiece(L,
383 "Loop condition is false. Exiting loop."));
384
385 break;
386 }
387
Ted Kremenek61f3e052008-04-03 04:42:52 +0000388 case Stmt::WhileStmtClass:
Ted Kremenek706e3cf2008-04-07 23:35:17 +0000389 case Stmt::ForStmtClass: {
390
391 if (*(Src->succ_begin()+1) == Dst) {
392
393 std::ostringstream os;
394
395 os << "Loop condition is false. Execution continues on line "
396 << SMgr.getLogicalLineNumber(GetStmt(Dst)->getLocStart()) << '.';
397
398 PD.push_front(new PathDiagnosticPiece(L, os.str()));
399 }
400 else
401 PD.push_front(new PathDiagnosticPiece(L,
402 "Loop condition is true. Entering loop body."));
403
404 break;
405 }
406
Ted Kremenek61f3e052008-04-03 04:42:52 +0000407 case Stmt::IfStmtClass: {
408
409 if (*(Src->succ_begin()+1) == Dst)
410 PD.push_front(new PathDiagnosticPiece(L, "Taking false branch."));
411 else
412 PD.push_front(new PathDiagnosticPiece(L, "Taking true branch."));
413
414 break;
415 }
416 }
Ted Kremenek6837faa2008-04-09 00:20:43 +0000417 }
Ted Kremenek5a429952008-04-23 23:35:07 +0000418
419 if (PathDiagnosticPiece* p = R.VisitNode(N, NextNode, *ReportGraph, *this))
420 PD.push_front(p);
Ted Kremenek61f3e052008-04-03 04:42:52 +0000421 }
422}
423
Ted Kremenek95cc1ba2008-04-18 20:54:29 +0000424bool BugTypeCacheLocation::isCached(BugReport& R) {
425
426 ExplodedNode<ValueState>* N = R.getEndNode();
Ted Kremenek61f3e052008-04-03 04:42:52 +0000427
Ted Kremenek329d2cc2008-04-18 02:24:50 +0000428 if (!N)
429 return false;
Ted Kremenek95cc1ba2008-04-18 20:54:29 +0000430
431 // Cache the location of the error. Don't emit the same
Ted Kremenek61f3e052008-04-03 04:42:52 +0000432 // warning for the same error type that occurs at the same program
433 // location but along a different path.
434
435 void* p = N->getLocation().getRawData();
436
437 if (CachedErrors.count(p))
438 return true;
439
Ted Kremenek95cc1ba2008-04-18 20:54:29 +0000440 CachedErrors.insert(p);
Ted Kremenek61f3e052008-04-03 04:42:52 +0000441 return false;
442}
443
Ted Kremenek75840e12008-04-18 01:56:37 +0000444void BugReporter::EmitWarning(BugReport& R) {
445
Ted Kremenek95cc1ba2008-04-18 20:54:29 +0000446 if (R.getBugType().isCached(R))
Ted Kremenek61f3e052008-04-03 04:42:52 +0000447 return;
Ted Kremenek75840e12008-04-18 01:56:37 +0000448
Ted Kremenek55851142008-04-22 16:15:03 +0000449 llvm::OwningPtr<PathDiagnostic> D(new PathDiagnostic(R.getName()));
450 GeneratePathDiagnostic(*D.get(), R);
Ted Kremenek072192b2008-04-30 23:47:44 +0000451
452 // Get the meta data.
453
454 std::pair<const char**, const char**> Meta = R.getExtraDescriptiveText();
455
456 for (const char** s = Meta.first; s != Meta.second; ++s)
457 D->addMeta(*s);
Ted Kremenek75840e12008-04-18 01:56:37 +0000458
459 // Emit a full diagnostic for the path if we have a PathDiagnosticClient.
Ted Kremenek70d17222008-04-03 07:33:55 +0000460
Ted Kremenek55851142008-04-22 16:15:03 +0000461 if (PD && !D->empty()) {
462 PD->HandlePathDiagnostic(D.take());
Ted Kremenek75840e12008-04-18 01:56:37 +0000463 return;
464 }
Ted Kremenekd2f642b2008-04-14 17:39:48 +0000465
Ted Kremenek75840e12008-04-18 01:56:37 +0000466 // We don't have a PathDiagnosticClient, but we can still emit a single
467 // line diagnostic. Determine the location.
Ted Kremenek61f3e052008-04-03 04:42:52 +0000468
Ted Kremenek55851142008-04-22 16:15:03 +0000469 FullSourceLoc L = D->empty() ? R.getLocation(Ctx.getSourceManager())
470 : D->back()->getLocation();
Ted Kremenek75840e12008-04-18 01:56:37 +0000471
472
473 // Determine the range.
Ted Kremenek5fcca682008-04-14 18:06:42 +0000474
Ted Kremenek4bb6ac22008-04-10 16:12:38 +0000475 const SourceRange *Beg, *End;
Ted Kremenek5fcca682008-04-14 18:06:42 +0000476
Ted Kremenek55851142008-04-22 16:15:03 +0000477 if (!D->empty()) {
478 Beg = D->back()->ranges_begin();
479 End = D->back()->ranges_end();
Ted Kremenek75840e12008-04-18 01:56:37 +0000480 }
481 else
482 R.getRanges(Beg, End);
483
Ted Kremenek2f0e89e2008-04-18 22:56:53 +0000484 if (PD) {
Ted Kremenek2f0e89e2008-04-18 22:56:53 +0000485 PathDiagnosticPiece* piece = new PathDiagnosticPiece(L, R.getDescription());
486
487 for ( ; Beg != End; ++Beg)
488 piece->addRange(*Beg);
489
Ted Kremenek55851142008-04-22 16:15:03 +0000490 D->push_back(piece);
491 PD->HandlePathDiagnostic(D.take());
Ted Kremenek2f0e89e2008-04-18 22:56:53 +0000492 }
493 else {
494 std::ostringstream os;
495 os << "[CHECKER] ";
496
Ted Kremenek55851142008-04-22 16:15:03 +0000497 if (D->empty())
Ted Kremenek2f0e89e2008-04-18 22:56:53 +0000498 os << R.getDescription();
499 else
Ted Kremenek55851142008-04-22 16:15:03 +0000500 os << D->back()->getString();
Ted Kremenek2f0e89e2008-04-18 22:56:53 +0000501
502
503 unsigned ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning,
504 os.str().c_str());
505
506 Diag.Report(L, ErrorDiag, NULL, 0, Beg, End - Beg);
507 }
Ted Kremenek61f3e052008-04-03 04:42:52 +0000508}