blob: c5900b30cd862e911c8d4e71ba622c5765a19e55 [file] [log] [blame]
Ted Kremeneka90ccfe2008-01-31 19:34:24 +00001//= RValues.cpp - Abstract RValues for Path-Sens. Value Tracking -*- 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//
Zhongxing Xu1c96b242008-10-17 05:57:07 +000010// This file defines SVal, Loc, and NonLoc, classes that represent
Ted Kremeneka90ccfe2008-01-31 19:34:24 +000011// abstract r-values for use with path-sensitive value tracking.
12//
13//===----------------------------------------------------------------------===//
14
Ted Kremenek9e240492008-10-04 05:50:14 +000015#include "clang/Analysis/PathSensitive/GRState.h"
Daniel Dunbarc4a1dea2008-08-11 05:35:13 +000016#include "clang/Basic/IdentifierTable.h"
Ted Kremenekd70d0b02008-02-16 01:12:31 +000017#include "llvm/Support/Streams.h"
Ted Kremeneka90ccfe2008-01-31 19:34:24 +000018
19using namespace clang;
20using llvm::dyn_cast;
21using llvm::cast;
22using llvm::APSInt;
23
24//===----------------------------------------------------------------------===//
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +000025// Symbol iteration within an SVal.
Ted Kremenek90e14812008-02-14 23:25:54 +000026//===----------------------------------------------------------------------===//
Ted Kremeneka6e4d212008-02-01 06:36:40 +000027
Ted Kremenek718c4f72008-04-29 22:17:41 +000028
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +000029//===----------------------------------------------------------------------===//
30// Utility methods.
31//===----------------------------------------------------------------------===//
Ted Kremeneka6e4d212008-02-01 06:36:40 +000032
Ted Kremenek94c96982009-03-03 22:06:47 +000033/// getAsLocSymbol - If this SVal is a location (subclasses Loc) and
34/// wraps a symbol, return that SymbolRef. Otherwise return a SymbolRef
35/// where 'isValid()' returns false.
36SymbolRef SVal::getAsLocSymbol() const {
37 if (const loc::SymbolVal *X = dyn_cast<loc::SymbolVal>(this))
38 return X->getSymbol();
39
40 if (const loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(this)) {
41 const MemRegion *R = X->getRegion();
42
43 while (R) {
44 // Blast through region views.
45 if (const TypedViewRegion *View = dyn_cast<TypedViewRegion>(R)) {
46 R = View->getSuperRegion();
47 continue;
48 }
49
50 if (const SymbolicRegion *SymR = dyn_cast<SymbolicRegion>(R))
51 return SymR->getSymbol();
52
53 break;
54 }
55 }
56
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +000057 return 0;
Ted Kremenek94c96982009-03-03 22:06:47 +000058}
59
60/// getAsSymbol - If this Sval wraps a symbol return that SymbolRef.
61/// Otherwise return a SymbolRef where 'isValid()' returns false.
62SymbolRef SVal::getAsSymbol() const {
63 if (const nonloc::SymbolVal *X = dyn_cast<nonloc::SymbolVal>(this))
64 return X->getSymbol();
65
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +000066 if (const nonloc::SymExprVal *X = dyn_cast<nonloc::SymExprVal>(this))
67 if (SymbolRef Y = dyn_cast<SymbolData>(X->getSymbolicExpression()))
68 return Y;
69
Ted Kremenek94c96982009-03-03 22:06:47 +000070 return getAsLocSymbol();
71}
72
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +000073/// getAsSymbolicExpression - If this Sval wraps a symbolic expression then
74/// return that expression. Otherwise return NULL.
75const SymExpr *SVal::getAsSymbolicExpression() const {
76 if (const nonloc::SymExprVal *X = dyn_cast<nonloc::SymExprVal>(this))
77 return X->getSymbolicExpression();
78
79 return getAsSymbol();
80}
81
82bool SVal::symbol_iterator::operator==(const symbol_iterator &X) const {
83 return itr == X.itr;
84}
85
86bool SVal::symbol_iterator::operator!=(const symbol_iterator &X) const {
87 return itr != X.itr;
88}
89
90SVal::symbol_iterator::symbol_iterator(const SymExpr *SE) {
91 itr.push_back(SE);
92 while (!isa<SymbolData>(itr.back())) expand();
93}
94
95SVal::symbol_iterator& SVal::symbol_iterator::operator++() {
96 assert(!itr.empty() && "attempting to iterate on an 'end' iterator");
97 assert(isa<SymbolData>(itr.back()));
98 itr.pop_back();
99 if (!itr.empty())
100 while (!isa<SymbolData>(itr.back())) expand();
101 return *this;
102}
103
104SymbolRef SVal::symbol_iterator::operator*() {
105 assert(!itr.empty() && "attempting to dereference an 'end' iterator");
106 return cast<SymbolData>(itr.back());
107}
108
109void SVal::symbol_iterator::expand() {
110 const SymExpr *SE = itr.back();
111 itr.pop_back();
112
113 if (const SymIntExpr *SIE = dyn_cast<SymIntExpr>(SE)) {
114 itr.push_back(SIE->getLHS());
115 return;
116 }
117 else if (const SymSymExpr *SSE = dyn_cast<SymSymExpr>(SE)) {
118 itr.push_back(SSE->getLHS());
119 itr.push_back(SSE->getRHS());
120 return;
121 }
122
123 assert(false && "unhandled expansion case");
124}
125
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000126//===----------------------------------------------------------------------===//
Ted Kremeneka6fac4e2008-10-30 18:01:28 +0000127// Other Iterators.
128//===----------------------------------------------------------------------===//
129
130nonloc::CompoundVal::iterator nonloc::CompoundVal::begin() const {
131 return getValue()->begin();
132}
133
134nonloc::CompoundVal::iterator nonloc::CompoundVal::end() const {
135 return getValue()->end();
136}
137
138//===----------------------------------------------------------------------===//
Ted Kremenek40fc5c72008-07-18 15:54:51 +0000139// Useful predicates.
140//===----------------------------------------------------------------------===//
141
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000142bool SVal::isZeroConstant() const {
143 if (isa<loc::ConcreteInt>(*this))
144 return cast<loc::ConcreteInt>(*this).getValue() == 0;
145 else if (isa<nonloc::ConcreteInt>(*this))
146 return cast<nonloc::ConcreteInt>(*this).getValue() == 0;
Ted Kremenek40fc5c72008-07-18 15:54:51 +0000147 else
148 return false;
149}
150
151
152//===----------------------------------------------------------------------===//
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000153// Transfer function dispatch for Non-Locs.
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000154//===----------------------------------------------------------------------===//
Ted Kremeneka6e4d212008-02-01 06:36:40 +0000155
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000156SVal nonloc::ConcreteInt::EvalBinOp(BasicValueFactory& BasicVals,
Ted Kremenek75b0a1c2008-07-18 15:59:33 +0000157 BinaryOperator::Opcode Op,
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000158 const nonloc::ConcreteInt& R) const {
Ted Kremenekaa1c4e52008-02-21 18:02:17 +0000159
Ted Kremenek75b0a1c2008-07-18 15:59:33 +0000160 const llvm::APSInt* X =
161 BasicVals.EvaluateAPSInt(Op, getValue(), R.getValue());
Ted Kremenek8cc13ea2008-02-28 20:32:03 +0000162
163 if (X)
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000164 return nonloc::ConcreteInt(*X);
Ted Kremenek8cc13ea2008-02-28 20:32:03 +0000165 else
166 return UndefinedVal();
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000167}
168
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000169 // Bitwise-Complement.
170
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000171nonloc::ConcreteInt
172nonloc::ConcreteInt::EvalComplement(BasicValueFactory& BasicVals) const {
Ted Kremenek240f1f02008-03-07 20:13:31 +0000173 return BasicVals.getValue(~getValue());
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000174}
175
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000176 // Unary Minus.
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000177
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000178nonloc::ConcreteInt
179nonloc::ConcreteInt::EvalMinus(BasicValueFactory& BasicVals, UnaryOperator* U) const {
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000180 assert (U->getType() == U->getSubExpr()->getType());
181 assert (U->getType()->isIntegerType());
Ted Kremenek240f1f02008-03-07 20:13:31 +0000182 return BasicVals.getValue(-getValue());
Ted Kremenekc5d3b4c2008-02-04 16:58:30 +0000183}
184
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000185//===----------------------------------------------------------------------===//
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000186// Transfer function dispatch for Locs.
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000187//===----------------------------------------------------------------------===//
188
Ted Kremenekccaad9d2008-10-30 17:53:23 +0000189SVal loc::ConcreteInt::EvalBinOp(BasicValueFactory& BasicVals,
190 BinaryOperator::Opcode Op,
191 const loc::ConcreteInt& R) const {
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000192
193 assert (Op == BinaryOperator::Add || Op == BinaryOperator::Sub ||
194 (Op >= BinaryOperator::LT && Op <= BinaryOperator::NE));
195
Ted Kremenek240f1f02008-03-07 20:13:31 +0000196 const llvm::APSInt* X = BasicVals.EvaluateAPSInt(Op, getValue(), R.getValue());
Ted Kremenek8cc13ea2008-02-28 20:32:03 +0000197
198 if (X)
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000199 return loc::ConcreteInt(*X);
Ted Kremenek8cc13ea2008-02-28 20:32:03 +0000200 else
201 return UndefinedVal();
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000202}
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000203
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000204//===----------------------------------------------------------------------===//
Ted Kremenekda9ae602009-04-08 18:51:08 +0000205// Utility methods for constructing SVals.
206//===----------------------------------------------------------------------===//
207
208SVal SVal::MakeZero(BasicValueFactory &BasicVals, QualType T) {
209 if (Loc::IsLocType(T))
210 return Loc::MakeNull(BasicVals);
211
212 if (T->isIntegerType())
213 return NonLoc::MakeVal(BasicVals, 0, T);
214
215 // FIXME: Handle floats.
216 // FIXME: Handle structs.
217 return UnknownVal();
218}
219
220//===----------------------------------------------------------------------===//
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000221// Utility methods for constructing Non-Locs.
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000222//===----------------------------------------------------------------------===//
Zhongxing Xu4193eca2008-12-20 06:32:12 +0000223
224NonLoc NonLoc::MakeVal(SymbolRef sym) {
225 return nonloc::SymbolVal(sym);
226}
227
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +0000228NonLoc NonLoc::MakeVal(SymbolManager& SymMgr, const SymExpr *lhs,
229 BinaryOperator::Opcode op, const APSInt& v, QualType T) {
Zhongxing Xua129eb92009-03-25 05:58:37 +0000230 // The Environment ensures we always get a persistent APSInt in
231 // BasicValueFactory, so we don't need to get the APSInt from
232 // BasicValueFactory again.
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +0000233 assert(!Loc::IsLocType(T));
234 return nonloc::SymExprVal(SymMgr.getSymIntExpr(lhs, op, v, T));
Zhongxing Xua129eb92009-03-25 05:58:37 +0000235}
236
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +0000237NonLoc NonLoc::MakeVal(SymbolManager& SymMgr, const SymExpr *lhs,
238 BinaryOperator::Opcode op, const SymExpr *rhs,
239QualType T) {
Zhongxing Xua129eb92009-03-25 05:58:37 +0000240 assert(SymMgr.getType(lhs) == SymMgr.getType(rhs));
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +0000241 assert(!Loc::IsLocType(T));
242 return nonloc::SymExprVal(SymMgr.getSymSymExpr(lhs, op, rhs, T));
Zhongxing Xua129eb92009-03-25 05:58:37 +0000243}
244
Ted Kremenek14553ab2009-01-30 00:08:43 +0000245NonLoc NonLoc::MakeIntVal(BasicValueFactory& BasicVals, uint64_t X,
246 bool isUnsigned) {
247 return nonloc::ConcreteInt(BasicVals.getIntValue(X, isUnsigned));
Zhongxing Xu6613d082008-11-24 02:18:56 +0000248}
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000249
Zhongxing Xu8b862732008-11-24 09:38:21 +0000250NonLoc NonLoc::MakeVal(BasicValueFactory& BasicVals, uint64_t X,
251 unsigned BitWidth, bool isUnsigned) {
252 return nonloc::ConcreteInt(BasicVals.getValue(X, BitWidth, isUnsigned));
253}
254
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000255NonLoc NonLoc::MakeVal(BasicValueFactory& BasicVals, uint64_t X, QualType T) {
256 return nonloc::ConcreteInt(BasicVals.getValue(X, T));
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000257}
258
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000259NonLoc NonLoc::MakeVal(BasicValueFactory& BasicVals, IntegerLiteral* I) {
Ted Kremenekaa1c4e52008-02-21 18:02:17 +0000260
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000261 return nonloc::ConcreteInt(BasicVals.getValue(APSInt(I->getValue(),
Ted Kremenekaa1c4e52008-02-21 18:02:17 +0000262 I->getType()->isUnsignedIntegerType())));
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000263}
264
Zhongxing Xue8a964b2008-11-22 13:21:46 +0000265NonLoc NonLoc::MakeVal(BasicValueFactory& BasicVals, const llvm::APInt& I,
266 bool isUnsigned) {
267 return nonloc::ConcreteInt(BasicVals.getValue(I, isUnsigned));
268}
269
Zhongxing Xu8b862732008-11-24 09:38:21 +0000270NonLoc NonLoc::MakeVal(BasicValueFactory& BasicVals, const llvm::APSInt& I) {
271 return nonloc::ConcreteInt(BasicVals.getValue(I));
272}
273
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000274NonLoc NonLoc::MakeIntTruthVal(BasicValueFactory& BasicVals, bool b) {
275 return nonloc::ConcreteInt(BasicVals.getTruthValue(b));
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000276}
277
Ted Kremenek632e8b82008-10-30 17:44:46 +0000278NonLoc NonLoc::MakeCompoundVal(QualType T, llvm::ImmutableList<SVal> Vals,
Zhongxing Xu6764b722008-10-30 04:58:00 +0000279 BasicValueFactory& BasicVals) {
Ted Kremenek632e8b82008-10-30 17:44:46 +0000280 return nonloc::CompoundVal(BasicVals.getCompoundValData(T, Vals));
Zhongxing Xu6764b722008-10-30 04:58:00 +0000281}
282
Zhongxing Xua1718c72009-04-03 07:33:13 +0000283SVal SVal::GetRValueSymbolVal(SymbolManager& SymMgr, MemRegionManager& MRMgr,
284 const MemRegion* R) {
Ted Kremenek9ab6b9c2009-01-22 18:23:34 +0000285 SymbolRef sym = SymMgr.getRegionRValueSymbol(R);
286
Ted Kremenekec099f12009-03-18 22:10:22 +0000287 if (const TypedRegion* TR = dyn_cast<TypedRegion>(R)) {
288 QualType T = TR->getRValueType(SymMgr.getContext());
289
290 if (Loc::IsLocType(T))
Zhongxing Xua1718c72009-04-03 07:33:13 +0000291 return Loc::MakeVal(MRMgr.getSymbolicRegion(sym));
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000292
Ted Kremenekec099f12009-03-18 22:10:22 +0000293 // Only handle integers for now.
294 if (T->isIntegerType())
295 return NonLoc::MakeVal(sym);
296 }
297
298 return UnknownVal();
Zhongxing Xueabf7762008-11-19 11:03:17 +0000299}
300
Ted Kremenekbb9b2712009-03-20 20:10:45 +0000301SVal SVal::GetConjuredSymbolVal(SymbolManager &SymMgr, const Expr* E,
302 unsigned Count) {
303
304 QualType T = E->getType();
305
306 if (Loc::IsLocType(T)) {
307 SymbolRef Sym = SymMgr.getConjuredSymbol(E, Count);
308 return loc::SymbolVal(Sym);
309 }
310 else if (T->isIntegerType() && T->isScalarType()) {
311 SymbolRef Sym = SymMgr.getConjuredSymbol(E, Count);
312 return nonloc::SymbolVal(Sym);
313 }
314
315 return UnknownVal();
316}
317
Ted Kremenek632e8b82008-10-30 17:44:46 +0000318nonloc::LocAsInteger nonloc::LocAsInteger::Make(BasicValueFactory& Vals, Loc V,
319 unsigned Bits) {
320 return LocAsInteger(Vals.getPersistentSValWithData(V, Bits));
321}
322
Ted Kremenek2a502572008-02-12 21:37:56 +0000323//===----------------------------------------------------------------------===//
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000324// Utility methods for constructing Locs.
Ted Kremenek2a502572008-02-12 21:37:56 +0000325//===----------------------------------------------------------------------===//
326
Zhongxing Xu2fdf5552008-12-09 10:51:19 +0000327Loc Loc::MakeVal(const MemRegion* R) { return loc::MemRegionVal(R); }
328
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000329Loc Loc::MakeVal(AddrLabelExpr* E) { return loc::GotoLabel(E->getLabel()); }
Ted Kremenekcf78b6a2008-02-06 22:50:25 +0000330
Zhongxing Xu4193eca2008-12-20 06:32:12 +0000331Loc Loc::MakeVal(SymbolRef sym) { return loc::SymbolVal(sym); }
332
Ted Kremenekda9ae602009-04-08 18:51:08 +0000333Loc Loc::MakeNull(BasicValueFactory &BasicVals) {
334 return loc::ConcreteInt(BasicVals.getZeroWithPtrWidth());
335}
336
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000337//===----------------------------------------------------------------------===//
338// Pretty-Printing.
339//===----------------------------------------------------------------------===//
340
Daniel Dunbar4a77edb2009-03-10 18:00:19 +0000341void SVal::printStdErr() const { print(llvm::errs()); }
Ted Kremenek2a502572008-02-12 21:37:56 +0000342
Zhongxing Xu1c96b242008-10-17 05:57:07 +0000343void SVal::print(std::ostream& Out) const {
Ted Kremenekb8b41612008-10-30 18:35:10 +0000344 llvm::raw_os_ostream out(Out);
345 print(out);
Ted Kremeneka90ccfe2008-01-31 19:34:24 +0000346}
347
Zhongxing Xu9012bff2008-10-24 06:00:12 +0000348void SVal::print(llvm::raw_ostream& Out) const {
349
350 switch (getBaseKind()) {
351
352 case UnknownKind:
353 Out << "Invalid"; break;
354
355 case NonLocKind:
356 cast<NonLoc>(this)->print(Out); break;
357
358 case LocKind:
359 cast<Loc>(this)->print(Out); break;
360
361 case UndefinedKind:
362 Out << "Undefined"; break;
363
364 default:
365 assert (false && "Invalid SVal.");
366 }
367}
368
Zhongxing Xu9012bff2008-10-24 06:00:12 +0000369void NonLoc::print(llvm::raw_ostream& Out) const {
370
371 switch (getSubKind()) {
372
373 case nonloc::ConcreteIntKind:
374 Out << cast<nonloc::ConcreteInt>(this)->getValue().getZExtValue();
375
376 if (cast<nonloc::ConcreteInt>(this)->getValue().isUnsigned())
377 Out << 'U';
378
379 break;
380
381 case nonloc::SymbolValKind:
382 Out << '$' << cast<nonloc::SymbolVal>(this)->getSymbol();
383 break;
384
Ted Kremeneke0e4ebf2009-03-26 03:35:11 +0000385 case nonloc::SymExprValKind: {
386 const nonloc::SymExprVal& C = *cast<nonloc::SymExprVal>(this);
387 const SymExpr *SE = C.getSymbolicExpression();
388 Out << SE;
Zhongxing Xu9012bff2008-10-24 06:00:12 +0000389 break;
390 }
391
392 case nonloc::LocAsIntegerKind: {
393 const nonloc::LocAsInteger& C = *cast<nonloc::LocAsInteger>(this);
394 C.getLoc().print(Out);
395 Out << " [as " << C.getNumBits() << " bit integer]";
396 break;
397 }
398
Ted Kremeneka6fac4e2008-10-30 18:01:28 +0000399 case nonloc::CompoundValKind: {
400 const nonloc::CompoundVal& C = *cast<nonloc::CompoundVal>(this);
Ted Kremenekb8b41612008-10-30 18:35:10 +0000401 Out << " {";
402 bool first = true;
403 for (nonloc::CompoundVal::iterator I=C.begin(), E=C.end(); I!=E; ++I) {
404 if (first) { Out << ' '; first = false; }
405 else Out << ", ";
Ted Kremeneka6fac4e2008-10-30 18:01:28 +0000406 (*I).print(Out);
Ted Kremenekb8b41612008-10-30 18:35:10 +0000407 }
Ted Kremeneka6fac4e2008-10-30 18:01:28 +0000408 Out << " }";
409 break;
410 }
411
Zhongxing Xu9012bff2008-10-24 06:00:12 +0000412 default:
413 assert (false && "Pretty-printed not implemented for this NonLoc.");
414 break;
415 }
416}
417
418void Loc::print(llvm::raw_ostream& Out) const {
419
420 switch (getSubKind()) {
421
422 case loc::ConcreteIntKind:
423 Out << cast<loc::ConcreteInt>(this)->getValue().getZExtValue()
424 << " (Loc)";
425 break;
426
427 case loc::SymbolValKind:
428 Out << '$' << cast<loc::SymbolVal>(this)->getSymbol();
429 break;
430
431 case loc::GotoLabelKind:
432 Out << "&&"
433 << cast<loc::GotoLabel>(this)->getLabel()->getID()->getName();
434 break;
435
436 case loc::MemRegionKind:
437 Out << '&' << cast<loc::MemRegionVal>(this)->getRegion()->getString();
438 break;
439
440 case loc::FuncValKind:
441 Out << "function "
442 << cast<loc::FuncVal>(this)->getDecl()->getIdentifier()->getName();
443 break;
444
Zhongxing Xu9012bff2008-10-24 06:00:12 +0000445 default:
446 assert (false && "Pretty-printing not implemented for this Loc.");
447 break;
448 }
449}