if (VD->hasLocalStorage() && !Live(VD,AD)) {
SourceRange R = B->getRHS()->getSourceRange();
Diags.Report(DR->getSourceRange().getBegin(), diag::warn_dead_store,
- 0, 0, &R, 1);
+ Ctx.getSourceManager(), 0, 0, &R, 1);
}
}
else if(DeclStmt* DS = dyn_cast<DeclStmt>(S))
if (!E->isConstantExpr(Ctx,NULL)) {
// Flag a warning.
SourceRange R = E->getSourceRange();
- Diags.Report(V->getLocation(), diag::warn_dead_store, 0, 0,
- &R,1);
+ Diags.Report(V->getLocation(), diag::warn_dead_store,
+ Ctx.getSourceManager(), 0, 0, &R, 1);
}
}
}
if (V(VD,AD) == Uninitialized)
if (AlreadyWarned.insert(VD))
- Diags.Report(DR->getSourceRange().getBegin(), diag::warn_uninit_val);
+ Diags.Report(DR->getSourceRange().getBegin(), diag::warn_uninit_val,
+ Ctx.getSourceManager());
}
};
} // end anonymous namespace
/// compilation, return true, otherwise return false. DiagID is a member of
/// the diag::kind enum.
void Diagnostic::Report(SourceLocation Pos, unsigned DiagID,
+ SourceManager& SrcMgr,
const std::string *Strs, unsigned NumStrs,
const SourceRange *Ranges, unsigned NumRanges) {
// Figure out the diagnostic level of this message.
}
// Are we going to ignore this diagnosic?
- if (Client.IgnoreDiagnostic(DiagLevel, Pos))
+ if (Client.IgnoreDiagnostic(DiagLevel, Pos, SrcMgr))
return;
// Finally, report it.
- Client.HandleDiagnostic(*this, DiagLevel, Pos, (diag::kind)DiagID,
+ Client.HandleDiagnostic(*this, DiagLevel, Pos, (diag::kind)DiagID, SrcMgr,
Strs, NumStrs, Ranges, NumRanges);
++NumDiagnostics;
}
/// non-portable.
void TargetInfo::DiagnoseNonPortability(SourceLocation Loc, unsigned DiagKind) {
NonPortable = true;
- if (Diag && Loc.isValid()) Diag->Report(Loc, DiagKind);
+ if (Diag && Loc.isValid()) Diag->Report(Loc, DiagKind, SrcMgr);
}
/// GetTargetDefineMap - Get the set of target #defines in an associative
//===--------------------------------------------------------------------===//
ComplexPairTy VisitStmt(Stmt *S) {
- S->dump(CGF.getContext().SourceMgr);
+ S->dump(CGF.getContext().getSourceManager());
assert(0 && "Stmt can't have complex result type!");
return ComplexPairTy();
}
//===--------------------------------------------------------------------===//
Value *VisitStmt(Stmt *S) {
- S->dump(CGF.getContext().SourceMgr);
+ S->dump(CGF.getContext().getSourceManager());
assert(0 && "Stmt can't have complex result type!");
return 0;
}
"cannot codegen this %0 yet");
SourceRange Range = S->getSourceRange();
std::string Msg = Type;
- getDiags().Report(S->getLocStart(), DiagID, &Msg, 1, &Range, 1);
+ getDiags().Report(S->getLocStart(), DiagID, Context.getSourceManager(),
+ &Msg, 1, &Range, 1);
}
/// ReplaceMapValuesWith - This is a really slow and bad function that
ASTDumper() : DeclPrinter() {}
void Initialize(ASTContext &Context, unsigned MainFileID) {
- SM = &Context.SourceMgr;
+ SM = &Context.getSourceManager();
}
virtual void HandleTopLevelDecl(Decl *D) {
SourceManager *SM;
public:
void Initialize(ASTContext &Context, unsigned MainFileID) {
- SM = &Context.SourceMgr;
+ SM = &Context.getSourceManager();
}
virtual void HandleTopLevelDecl(Decl *D) {
SourceManager *SM;
public:
virtual void Initialize(ASTContext &Context, unsigned MainFileID) {
- SM = &Context.SourceMgr;
+ SM = &Context.getSourceManager();
}
virtual void VisitCFG(CFG& C) {
public:
void Initialize(ASTContext &context, unsigned mainFileID) {
Context = &context;
- SM = &Context->SourceMgr;
+ SM = &Context->getSourceManager();
MsgSendFunctionDecl = 0;
MsgSendSuperFunctionDecl = 0;
MsgSendStretFunctionDecl = 0;
MainFileEnd = MainBuf->getBufferEnd();
- Rewrite.setSourceMgr(Context->SourceMgr);
+ Rewrite.setSourceMgr(Context->getSourceManager());
// declaring objc_selector outside the parameter list removes a silly
// scope related warning...
const char *s = "struct objc_selector; struct objc_class;\n"
unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error,
"rewriter could not replace sub-expression due to macros");
SourceRange Range = Exp->getSourceRange();
- Diags.Report(Exp->getAtLoc(), DiagID, 0, 0, &Range, 1);
+ Diags.Report(Exp->getAtLoc(), DiagID, Context->getSourceManager(),
+ 0, 0, &Range, 1);
delete Replacement;
return Exp;
}
/// CreateTargetInfo - Return the set of target info objects as specified by
/// the -arch command line option.
-TargetInfo *clang::CreateTargetInfo(const std::vector<std::string>& triples,
+TargetInfo *clang::CreateTargetInfo(SourceManager& SrcMgr,
+ const std::vector<std::string>& triples,
Diagnostic *Diags) {
assert (!triples.empty() && "No target triple.");
if (!PrimaryTarget)
return NULL;
- TargetInfo *TI = new TargetInfo(PrimaryTarget, Diags);
+ TargetInfo *TI = new TargetInfo(SrcMgr, PrimaryTarget, Diags);
// Add all secondary targets.
for (unsigned i = 1, e = triples.size(); i != e; ++i) {
Diagnostic::Level Level,
SourceLocation Pos,
diag::kind ID,
+ SourceManager& SrcMgr,
const std::string *Strs,
unsigned NumStrs,
const SourceRange *,
private:
DiagList Errors, Warnings;
public:
- TextDiagnosticBuffer(SourceManager &SM) : TextDiagnostics(SM) {}
+ TextDiagnosticBuffer() {}
const_iterator err_begin() const { return Errors.begin(); }
const_iterator err_end() const { return Errors.end(); }
virtual void HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level DiagLevel,
SourceLocation Pos,
- diag::kind ID, const std::string *Strs,
+ diag::kind ID,
+ SourceManager& SrcMgr,
+ const std::string *Strs,
unsigned NumStrs,
const SourceRange *Ranges,
unsigned NumRanges);
" diagnostics"));
void TextDiagnosticPrinter::
-PrintIncludeStack(SourceLocation Pos) {
+PrintIncludeStack(SourceLocation Pos, SourceManager& SourceMgr) {
if (Pos.isInvalid()) return;
Pos = SourceMgr.getLogicalLoc(Pos);
// Print out the other include frames first.
- PrintIncludeStack(SourceMgr.getIncludeLoc(Pos));
+ PrintIncludeStack(SourceMgr.getIncludeLoc(Pos),SourceMgr);
unsigned LineNo = SourceMgr.getLineNumber(Pos);
std::cerr << "In file included from " << SourceMgr.getSourceName(Pos)
/// HighlightRange - Given a SourceRange and a line number, highlight (with ~'s)
/// any characters in LineNo that intersect the SourceRange.
-void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
+void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
+ SourceManager& SourceMgr,
unsigned LineNo,
std::string &CaratLine,
const std::string &SourceLine) {
Diagnostic::Level Level,
SourceLocation Pos,
diag::kind ID,
+ SourceManager& SourceMgr,
const std::string *Strs,
unsigned NumStrs,
const SourceRange *Ranges,
// "included from" lines.
if (LastWarningLoc != SourceMgr.getIncludeLoc(LPos)) {
LastWarningLoc = SourceMgr.getIncludeLoc(LPos);
- PrintIncludeStack(LastWarningLoc);
+ PrintIncludeStack(LastWarningLoc,SourceMgr);
}
// Compute the column number. Rewind from the current position to the start
// Highlight all of the characters covered by Ranges with ~ characters.
for (unsigned i = 0; i != NumRanges; ++i)
- HighlightRange(Ranges[i], LineNo, CaratLine, SourceLine);
+ HighlightRange(Ranges[i], SourceMgr, LineNo, CaratLine, SourceLine);
// Next, insert the carat itself.
if (ColNo-1 < CaratLine.size())
class TextDiagnosticPrinter : public TextDiagnostics {
SourceLocation LastWarningLoc;
public:
- TextDiagnosticPrinter(SourceManager &sourceMgr)
- : TextDiagnostics(sourceMgr) {}
+ TextDiagnosticPrinter() {}
- void PrintIncludeStack(SourceLocation Pos);
- void HighlightRange(const SourceRange &R, unsigned LineNo,
+ void PrintIncludeStack(SourceLocation Pos, SourceManager& SrcMgr);
+ void HighlightRange(const SourceRange &R,
+ SourceManager& SrcMgr,
+ unsigned LineNo,
std::string &CaratLine,
const std::string &SourceLine);
virtual void HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level DiagLevel,
SourceLocation Pos,
- diag::kind ID, const std::string *Strs,
+ diag::kind ID,
+ SourceManager& SrcMgr,
+ const std::string *Strs,
unsigned NumStrs,
const SourceRange *Ranges,
unsigned NumRanges);
}
bool TextDiagnostics::IgnoreDiagnostic(Diagnostic::Level Level,
- SourceLocation Pos) {
+ SourceLocation Pos,
+ SourceManager& SourceMgr) {
if (Pos.isValid()) {
// If this is a warning or note, and if it a system header, suppress the
// diagnostic.
class TextDiagnostics : public DiagnosticClient {
HeaderSearch *TheHeaderSearch;
protected:
- SourceManager &SourceMgr;
-
std::string FormatDiagnostic(Diagnostic &Diags, Diagnostic::Level Level,
diag::kind ID,
const std::string *Strs,
unsigned NumStrs);
public:
- TextDiagnostics(SourceManager &sourceMgr) : SourceMgr(sourceMgr) {}
+ TextDiagnostics() {}
virtual ~TextDiagnostics();
void setHeaderSearch(HeaderSearch &HS) { TheHeaderSearch = &HS; }
virtual bool IgnoreDiagnostic(Diagnostic::Level Level,
- SourceLocation Pos);
+ SourceLocation Pos,
+ SourceManager& SrcMgr);
+
virtual void HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level DiagLevel,
SourceLocation Pos,
- diag::kind ID, const std::string *Strs,
+ diag::kind ID,
+ SourceManager& SrcMgr,
+ const std::string *Strs,
unsigned NumStrs,
const SourceRange *Ranges,
unsigned NumRanges) = 0;
Sezr.EnterBlock();
// Emit the SourceManager.
- Sezr.Emit(Context->SourceMgr);
+ Sezr.Emit(Context->getSourceManager());
// Emit the LangOptions.
Sezr.Emit(LangOpts);
assert (FoundBlock);
// Read the SourceManager.
- SourceManager::CreateAndRegister(Dezr,FMgr);
+ SourceManager& SrcMgr = *SourceManager::CreateAndRegister(Dezr,FMgr);
// Read the LangOptions.
TU->LangOpts.Read(Dezr);
std::vector<std::string> triples;
triples.push_back(triple);
delete [] triple;
- Dezr.RegisterPtr(PtrID,CreateTargetInfo(triples,NULL));
+ Dezr.RegisterPtr(PtrID,CreateTargetInfo(SrcMgr,triples,NULL));
}
// For Selectors, we must read the identifier table first because the
std::auto_ptr<TextDiagnostics> DiagClient;
if (!VerifyDiagnostics) {
// Print diagnostics to stderr by default.
- DiagClient.reset(new TextDiagnosticPrinter(SourceMgr));
+ DiagClient.reset(new TextDiagnosticPrinter());
} else {
// When checking diagnostics, just buffer them up.
- DiagClient.reset(new TextDiagnosticBuffer(SourceMgr));
+ DiagClient.reset(new TextDiagnosticBuffer());
if (InputFilenames.size() != 1) {
fprintf(stderr,
{ // Create triples, and create the TargetInfo.
std::vector<std::string> triples;
CreateTargetTriples(triples);
- Target = CreateTargetInfo(triples,&Diags);
+ Target = CreateTargetInfo(SourceMgr,triples,&Diags);
if (Target == 0) {
fprintf(stderr, "Sorry, I don't know what target this is: %s\n",
// -I- is a deprecated GCC feature, scan for it and reject it.
for (unsigned i = 0, e = I_dirs.size(); i != e; ++i) {
if (I_dirs[i] == "-") {
- Diags.Report(SourceLocation(), diag::err_pp_I_dash_not_supported);
+ Diags.Report(SourceLocation(), diag::err_pp_I_dash_not_supported,
+ SourceMgr);
+
I_dirs.erase(I_dirs.begin()+i);
--i;
}
class Diagnostic;
class ASTConsumer;
class IdentifierTable;
+class SourceManager;
/// DoPrintPreprocessedInput - Implement -E mode.
void DoPrintPreprocessedInput(unsigned MainFileID, Preprocessor &PP,
/// CreateTargetInfo - Return the set of target info objects as specified by
/// the -arch command line option.
-TargetInfo *CreateTargetInfo(const std::vector<std::string>& triples,
+TargetInfo *CreateTargetInfo(SourceManager& SrcMgr,
+ const std::vector<std::string>& triples,
Diagnostic *Diags);
/// EmitLLVMFromASTs - Implement -emit-llvm, which generates llvm IR from C.
/// the specified Token's location, translating the token's start
/// position in the current buffer into a SourcePosition object for rendering.
void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID) {
- Diags.Report(Loc, DiagID);
+ Diags.Report(Loc, DiagID, SourceMgr);
}
void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
const std::string &Msg) {
- Diags.Report(Loc, DiagID, &Msg, 1);
+ Diags.Report(Loc, DiagID, SourceMgr, &Msg, 1);
}
void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
/// "_Imaginary" (lacking an FP type). This returns a diagnostic to issue or
/// diag::NUM_DIAGNOSTICS if there is no error. After calling this method,
/// DeclSpec is guaranteed self-consistent, even if an error occurred.
-void DeclSpec::Finish(Diagnostic &D, const LangOptions &Lang) {
+void DeclSpec::Finish(Diagnostic &D, SourceManager& SrcMgr,
+ const LangOptions &Lang) {
// Check the type specifier components first.
// signed/unsigned are only valid with int/char.
if (TypeSpecType == TST_unspecified)
TypeSpecType = TST_int; // unsigned -> unsigned int, signed -> signed int.
else if (TypeSpecType != TST_int && TypeSpecType != TST_char) {
- Diag(D, TSSLoc, diag::err_invalid_sign_spec,
+ Diag(D, TSSLoc, SrcMgr, diag::err_invalid_sign_spec,
getSpecifierName( (TST)TypeSpecType));
// signed double -> double.
TypeSpecSign = TSS_unspecified;
if (TypeSpecType == TST_unspecified)
TypeSpecType = TST_int; // short -> short int, long long -> long long int.
else if (TypeSpecType != TST_int) {
- Diag(D, TSWLoc,
+ Diag(D, TSWLoc, SrcMgr,
TypeSpecWidth == TSW_short ? diag::err_invalid_short_spec
: diag::err_invalid_longlong_spec,
getSpecifierName( (TST)TypeSpecType));
if (TypeSpecType == TST_unspecified)
TypeSpecType = TST_int; // long -> long int.
else if (TypeSpecType != TST_int && TypeSpecType != TST_double) {
- Diag(D, TSWLoc, diag::err_invalid_long_spec,
+ Diag(D, TSWLoc, SrcMgr, diag::err_invalid_long_spec,
getSpecifierName( (TST)TypeSpecType));
TypeSpecType = TST_int;
}
// disallow their use. Need information about the backend.
if (TypeSpecComplex != TSC_unspecified) {
if (TypeSpecType == TST_unspecified) {
- Diag(D, TSCLoc, diag::ext_plain_complex);
+ Diag(D, TSCLoc, SrcMgr, diag::ext_plain_complex);
TypeSpecType = TST_double; // _Complex -> _Complex double.
} else if (TypeSpecType == TST_int || TypeSpecType == TST_char) {
// Note that this intentionally doesn't include _Complex _Bool.
- Diag(D, TSTLoc, diag::ext_integer_complex);
+ Diag(D, TSTLoc, SrcMgr, diag::ext_integer_complex);
} else if (TypeSpecType != TST_float && TypeSpecType != TST_double) {
- Diag(D, TSCLoc, diag::err_invalid_complex_spec,
+ Diag(D, TSCLoc, SrcMgr, diag::err_invalid_complex_spec,
getSpecifierName( (TST)TypeSpecType));
TypeSpecComplex = TSC_unspecified;
}
StorageClassSpec = SCS_extern; // '__thread int' -> 'extern __thread int'
} else if (StorageClassSpec != SCS_extern &&
StorageClassSpec != SCS_static) {
- Diag(D, getStorageClassSpecLoc(), diag::err_invalid_thread_spec,
+ Diag(D, getStorageClassSpecLoc(), SrcMgr, diag::err_invalid_thread_spec,
getSpecifierName( (SCS)StorageClassSpec));
SCS_thread_specified = false;
}
default:
// If this is not a declaration specifier token, we're done reading decl
// specifiers. First verify that DeclSpec's are consistent.
- DS.Finish(Diags, getLang());
+ DS.Finish(Diags, PP.getSourceManager(), getLang());
return;
// GNU attributes support.
default:
// If this is not a type-qualifier token, we're done reading type
// qualifiers. First verify that DeclSpec's are consistent.
- DS.Finish(Diags, getLang());
+ DS.Finish(Diags, PP.getSourceManager(), getLang());
return;
case tok::kw_const:
isInvalid = DS.SetTypeQual(DeclSpec::TQ_const , Loc, PrevSpec,
void Parser::Diag(SourceLocation Loc, unsigned DiagID,
const std::string &Msg) {
- Diags.Report(Loc, DiagID, &Msg, 1);
+ Diags.Report(Loc, DiagID, PP.getSourceManager(), &Msg, 1);
}
/// MatchRHSPunctuation - For punctuation with a LHS and RHS (e.g. '['/']'),
//===----------------------------------------------------------------------===//
bool Sema::Diag(SourceLocation Loc, unsigned DiagID) {
- PP.getDiagnostics().Report(Loc, DiagID);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager());
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg) {
- PP.getDiagnostics().Report(Loc, DiagID, &Msg, 1);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(), &Msg, 1);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
const std::string &Msg2) {
std::string MsgArr[] = { Msg1, Msg2 };
- PP.getDiagnostics().Report(Loc, DiagID, MsgArr, 2);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(), MsgArr, 2);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, SourceRange Range) {
- PP.getDiagnostics().Report(Loc, DiagID, 0, 0, &Range, 1);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(), 0,0, &Range,1);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
SourceRange Range) {
- PP.getDiagnostics().Report(Loc, DiagID, &Msg, 1, &Range, 1);
+ PP.getDiagnostics().Report(Loc,DiagID,PP.getSourceManager(),&Msg,1,&Range,1);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
const std::string &Msg2, SourceRange Range) {
std::string MsgArr[] = { Msg1, Msg2 };
- PP.getDiagnostics().Report(Loc, DiagID, MsgArr, 2, &Range, 1);
+ PP.getDiagnostics().Report(Loc,DiagID,PP.getSourceManager(),
+ MsgArr,2,&Range,1);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID,
SourceRange R1, SourceRange R2) {
SourceRange RangeArr[] = { R1, R2 };
- PP.getDiagnostics().Report(Loc, DiagID, 0, 0, RangeArr, 2);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(),
+ 0, 0, RangeArr, 2);
return true;
}
bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
SourceRange R1, SourceRange R2) {
SourceRange RangeArr[] = { R1, R2 };
- PP.getDiagnostics().Report(Loc, DiagID, &Msg, 1, RangeArr, 2);
+ PP.getDiagnostics().Report(Loc, DiagID, PP.getSourceManager(), &Msg,
+ 1, RangeArr, 2);
return true;
}
const std::string &Msg2, SourceRange R1, SourceRange R2) {
std::string MsgArr[] = { Msg1, Msg2 };
SourceRange RangeArr[] = { R1, R2 };
- PP.getDiagnostics().Report(Range, DiagID, MsgArr, 2, RangeArr, 2);
+ PP.getDiagnostics().Report(Range, DiagID, PP.getSourceManager(), MsgArr, 2,
+ RangeArr, 2);
return true;
}
QualType ObjcConstantStringType;
RecordDecl *CFConstantStringTypeDecl;
-public:
-
+
SourceManager &SourceMgr;
+public:
TargetInfo &Target;
IdentifierTable &Idents;
SelectorTable &Selectors;
+ SourceManager& getSourceManager() { return SourceMgr; }
+
/// This is intentionally not serialized. It is populated by the
/// ASTContext ctor, and there are no external pointers/references to
/// internal variables of BuiltinInfo.
class DiagnosticClient;
class SourceLocation;
class SourceRange;
+ class SourceManager;
// Import the diagnostic enums themselves.
namespace diag {
/// Report - Issue the message to the client. DiagID is a member of the
/// diag::kind enum.
- void Report(SourceLocation Pos, unsigned DiagID,
+ void Report(SourceLocation Pos, unsigned DiagID, SourceManager& SrcMgr,
const std::string *Strs = 0, unsigned NumStrs = 0,
const SourceRange *Ranges = 0, unsigned NumRanges = 0);
};
/// IgnoreDiagnostic - If the client wants to ignore this diagnostic, then
/// return true.
virtual bool IgnoreDiagnostic(Diagnostic::Level DiagLevel,
- SourceLocation Pos) = 0;
+ SourceLocation Pos,
+ SourceManager& SrcMgr) = 0;
/// HandleDiagnostic - Handle this diagnostic, reporting it to the user or
/// capturing it to a log as needed.
virtual void HandleDiagnostic(Diagnostic &Diags,
Diagnostic::Level DiagLevel, SourceLocation Pos,
- diag::kind ID, const std::string *Strs,
+ diag::kind ID, SourceManager& SrcMgr,
+ const std::string *Strs,
unsigned NumStrs, const SourceRange *Ranges,
unsigned NumRanges) = 0;
};
class TargetInfoImpl;
class Diagnostic;
+class SourceManager;
+
namespace Builtin { struct Info; }
/// TargetInfo - This class exposes information about the current target set.
/// diagnostic info, but does expect them to be alive for as long as it is.
///
class TargetInfo {
+ /// SrcMgr - The SourceManager associated with this TargetInfo.
+ SourceManager& SrcMgr;
+
/// Primary - This tracks the primary target in the target set.
///
const TargetInfoImpl *PrimaryTarget;
unsigned WCharWidth, WCharAlign;
public:
- TargetInfo(const TargetInfoImpl *Primary, Diagnostic *D = 0) {
+ TargetInfo(SourceManager& SMgr, const TargetInfoImpl *Primary,
+ Diagnostic *D = 0) : SrcMgr(SMgr) {
PrimaryTarget = Primary;
Diag = D;
NonPortable = false;
class IdentifierInfo;
/// DeclSpec - This class captures information about "declaration specifiers",
-/// which encompasses storage-class-specifiers, type-specifiers, type-qualifiers,
-/// and function-specifiers.
+/// which encompasses storage-class-specifiers, type-specifiers,
+/// type-qualifiers, and function-specifiers.
class DeclSpec {
public:
SourceRange Range;
/// Finish - This does final analysis of the declspec, issuing diagnostics for
/// things like "_Imaginary" (lacking an FP type). After calling this method,
/// DeclSpec is guaranteed self-consistent, even if an error occurred.
- void Finish(Diagnostic &D, const LangOptions &Lang);
+ void Finish(Diagnostic &D, SourceManager& SrcMgr, const LangOptions &Lang);
private:
- void Diag(Diagnostic &D, SourceLocation Loc, unsigned DiagID) {
- D.Report(Loc, DiagID);
+ void Diag(Diagnostic &D, SourceLocation Loc, SourceManager& SrcMgr,
+ unsigned DiagID) {
+ D.Report(Loc, DiagID, SrcMgr);
}
- void Diag(Diagnostic &D, SourceLocation Loc, unsigned DiagID,
- const std::string &info) {
- D.Report(Loc, DiagID, &info, 1);
+
+ void Diag(Diagnostic &D, SourceLocation Loc, SourceManager& SrcMgr,
+ unsigned DiagID, const std::string &info) {
+ D.Report(Loc, DiagID, SrcMgr, &info, 1);
}
};