public:
/// \brief Initialize a new fix-it rewriter.
- FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr);
+ FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr,
+ const LangOptions &LangOpts);
/// \brief Destroy the fix-it rewriter.
~FixItRewriter();
namespace clang {
class SourceManager;
+class LangOptions;
class TextDiagnosticPrinter : public DiagnosticClient {
+ llvm::raw_ostream &OS;
+ const LangOptions *LangOpts;
SourceLocation LastWarningLoc;
FullSourceLoc LastLoc;
bool LastCaretDiagnosticWasNote;
- llvm::raw_ostream &OS;
+
bool ShowColumn;
bool CaretDiagnostics;
bool ShowLocation;
bool PrintRangeInfo;
public:
- TextDiagnosticPrinter(llvm::raw_ostream &os, bool showColumn = true,
+ TextDiagnosticPrinter(llvm::raw_ostream &os,
+ bool showColumn = true,
bool caretDiagnistics = true, bool showLocation = true,
bool printRangeInfo = true)
- : LastCaretDiagnosticWasNote(false), OS(os), ShowColumn(showColumn),
+ : OS(os), LangOpts(0),
+ LastCaretDiagnosticWasNote(false), ShowColumn(showColumn),
CaretDiagnostics(caretDiagnistics), ShowLocation(showLocation),
PrintRangeInfo(printRangeInfo) {}
+ void SetLangOpts(const LangOptions &LO) {
+ LangOpts = &LO;
+ }
+
void PrintIncludeStack(SourceLocation Loc, const SourceManager &SM);
void HighlightRange(const SourceRange &R,
- const SourceManager& SrcMgr,
+ const SourceManager &SrcMgr,
unsigned LineNo, FileID FID,
std::string &CaretLine,
const std::string &SourceLine);
/// includes a trigraph or an escaped newline) then this count includes bytes
/// that are part of that.
static unsigned MeasureTokenLength(SourceLocation Loc,
- const SourceManager &SM);
+ const SourceManager &SM,
+ const LangOptions &LangOpts);
//===--------------------------------------------------------------------===//
// Internal implementation interfaces.
namespace clang {
class SourceManager;
+ class LangOptions;
class Rewriter;
class Stmt;
/// are involved.
class Rewriter {
SourceManager *SourceMgr;
-
+ const LangOptions *LangOpts;
std::map<FileID, RewriteBuffer> RewriteBuffers;
public:
- explicit Rewriter(SourceManager &SM) : SourceMgr(&SM) {}
- explicit Rewriter() : SourceMgr(0) {}
+ explicit Rewriter(SourceManager &SM, const LangOptions &LO)
+ : SourceMgr(&SM), LangOpts(&LO) {}
+ explicit Rewriter() : SourceMgr(0), LangOpts(0) {}
- void setSourceMgr(SourceManager &SM) { SourceMgr = &SM; }
- SourceManager& getSourceMgr() { return *SourceMgr; }
+ void setSourceMgr(SourceManager &SM, const LangOptions &LO) {
+ SourceMgr = &SM;
+ LangOpts = &LO;
+ }
+ SourceManager &getSourceMgr() { return *SourceMgr; }
+ const LangOptions &getLangOpts() { return *LangOpts; }
/// isRewritable - Return true if this location is a raw file location, which
/// is rewritable. Locations from macros, etc are not rewritable.
#include "llvm/System/Path.h"
using namespace clang;
-FixItRewriter::FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr)
- : Diags(Diags), Rewrite(SourceMgr), NumFailures(0) {
+FixItRewriter::FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr,
+ const LangOptions &LangOpts)
+ : Diags(Diags), Rewrite(SourceMgr, LangOpts), NumFailures(0) {
Client = Diags.getClient();
Diags.setClient(this);
}
return; // FIXME: Emit a warning?
// Create a new rewriter to generate HTML.
- Rewriter R(const_cast<SourceManager&>(SMgr));
+ Rewriter R(const_cast<SourceManager&>(SMgr), PP->getLangOptions());
// Process the path.
unsigned n = D.size();
SourceRange Range,
const char *HighlightStart,
const char *HighlightEnd) {
-
- SourceManager& SM = R.getSourceMgr();
+ SourceManager &SM = R.getSourceMgr();
+ const LangOptions &LangOpts = R.getLangOpts();
SourceLocation InstantiationStart = SM.getInstantiationLoc(Range.getBegin());
unsigned StartLineNo = SM.getInstantiationLineNumber(InstantiationStart);
if (EndColNo) {
// Add in the length of the token, so that we cover multi-char tokens.
- EndColNo += Lexer::MeasureTokenLength(Range.getEnd(), SM) - 1;
+ EndColNo += Lexer::MeasureTokenLength(Range.getEnd(), SM, LangOpts)-1;
}
// Highlight the range. Make the span tag the outermost tag for the
SourceLocation::getFromRawEncoding(Record[2]),
SourceLocation::getFromRawEncoding(Record[3]),
Lexer::MeasureTokenLength(SpellingLoc,
- SourceMgr));
+ SourceMgr,
+ PP.getLangOptions()));
break;
}
- case pch::SM_LINE_TABLE: {
+ case pch::SM_LINE_TABLE:
if (ParseLineTable(SourceMgr, Record))
return Failure;
- }
+ break;
}
}
}
#include "clang/Analysis/PathDiagnostic.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/FileManager.h"
-#include "clang/Lex/Lexer.h"
+#include "clang/Lex/Preprocessor.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Casting.h"
class VISIBILITY_HIDDEN PlistDiagnostics : public PathDiagnosticClient {
std::vector<const PathDiagnostic*> BatchedDiags;
const std::string OutputFile;
+ const LangOptions &LangOpts;
public:
- PlistDiagnostics(const std::string& prefix);
+ PlistDiagnostics(const std::string& prefix, const LangOptions &LangOpts);
~PlistDiagnostics();
void HandlePathDiagnostic(const PathDiagnostic* D);
};
} // end anonymous namespace
-PlistDiagnostics::PlistDiagnostics(const std::string& output)
- : OutputFile(output) {}
+PlistDiagnostics::PlistDiagnostics(const std::string& output,
+ const LangOptions &LO)
+ : OutputFile(output), LangOpts(LO) {}
PathDiagnosticClient*
clang::CreatePlistDiagnosticClient(const std::string& s,
- Preprocessor*, PreprocessorFactory*) {
- return new PlistDiagnostics(s);
+ Preprocessor *PP, PreprocessorFactory*) {
+ return new PlistDiagnostics(s, PP->getLangOptions());
}
static void AddFID(FIDMap &FIDs, llvm::SmallVectorImpl<FileID> &V,
V.push_back(FID);
}
-static unsigned GetFID(const FIDMap& FIDs, const SourceManager* SM,
+static unsigned GetFID(const FIDMap& FIDs, const SourceManager &SM,
SourceLocation L) {
- FileID FID = SM->getFileID(SM->getInstantiationLoc(L));
+ FileID FID = SM.getFileID(SM.getInstantiationLoc(L));
FIDMap::const_iterator I = FIDs.find(FID);
assert(I != FIDs.end());
return I->second;
return o;
}
-static void EmitLocation(llvm::raw_ostream& o, const SourceManager* SM,
- SourceLocation L, const FIDMap& FM,
- const unsigned indent, bool extend = false) {
+static void EmitLocation(llvm::raw_ostream& o, const SourceManager &SM,
+ const LangOptions &LangOpts,
+ SourceLocation L, const FIDMap &FM,
+ unsigned indent, bool extend = false) {
- FullSourceLoc Loc(SM->getInstantiationLoc(L), const_cast<SourceManager&>(*SM));
+ FullSourceLoc Loc(SM.getInstantiationLoc(L), const_cast<SourceManager&>(SM));
// Add in the length of the token, so that we cover multi-char tokens.
- unsigned offset = extend ? Lexer::MeasureTokenLength(Loc, *SM) - 1 : 0;
+ unsigned offset =
+ extend ? Lexer::MeasureTokenLength(Loc, SM, LangOpts) - 1 : 0;
Indent(o, indent) << "<dict>\n";
Indent(o, indent) << " <key>line</key><integer>"
Indent(o, indent) << "</dict>\n";
}
-static void EmitLocation(llvm::raw_ostream& o, const SourceManager* SM,
+static void EmitLocation(llvm::raw_ostream& o, const SourceManager &SM,
+ const LangOptions &LangOpts,
const PathDiagnosticLocation &L, const FIDMap& FM,
- const unsigned indent, bool extend = false) {
- EmitLocation(o, SM, L.asLocation(), FM, indent, extend);
+ unsigned indent, bool extend = false) {
+ EmitLocation(o, SM, LangOpts, L.asLocation(), FM, indent, extend);
}
-static void EmitRange(llvm::raw_ostream& o, const SourceManager* SM,
- SourceRange R, const FIDMap& FM,
- const unsigned indent) {
-
+static void EmitRange(llvm::raw_ostream& o, const SourceManager &SM,
+ const LangOptions &LangOpts,
+ SourceRange R, const FIDMap &FM,
+ unsigned indent) {
Indent(o, indent) << "<array>\n";
- EmitLocation(o, SM, R.getBegin(), FM, indent+1);
- EmitLocation(o, SM, R.getEnd(), FM, indent+1, true);
+ EmitLocation(o, SM, LangOpts, R.getBegin(), FM, indent+1);
+ EmitLocation(o, SM, LangOpts, R.getEnd(), FM, indent+1, true);
Indent(o, indent) << "</array>\n";
}
static void ReportControlFlow(llvm::raw_ostream& o,
const PathDiagnosticControlFlowPiece& P,
- const FIDMap& FM, const SourceManager *SM,
+ const FIDMap& FM,
+ const SourceManager &SM,
+ const LangOptions &LangOpts,
unsigned indent) {
Indent(o, indent) << "<dict>\n";
// FIXME: Eventually remove (DEPRECATED)
// Output the start and end locations.
Indent(o, indent) << "<key>start</key>\n";
- EmitLocation(o, SM, P.getStartLocation(), FM, indent);
+ EmitLocation(o, SM, LangOpts, P.getStartLocation(), FM, indent);
Indent(o, indent) << "<key>end</key>\n";
- EmitLocation(o, SM, P.getEndLocation(), FM, indent);
+ EmitLocation(o, SM, LangOpts, P.getEndLocation(), FM, indent);
// Emit edges.
Indent(o, indent) << "<key>edges</key>\n";
Indent(o, indent) << "<dict>\n";
++indent;
Indent(o, indent) << "<key>start</key>\n";
- EmitRange(o, SM, I->getStart().asRange(), FM, indent+1);
+ EmitRange(o, SM, LangOpts, I->getStart().asRange(), FM, indent+1);
Indent(o, indent) << "<key>end</key>\n";
- EmitRange(o, SM, I->getEnd().asRange(), FM, indent+1);
+ EmitRange(o, SM, LangOpts, I->getEnd().asRange(), FM, indent+1);
--indent;
Indent(o, indent) << "</dict>\n";
}
}
static void ReportEvent(llvm::raw_ostream& o, const PathDiagnosticPiece& P,
- const FIDMap& FM, const SourceManager* SM,
+ const FIDMap& FM,
+ const SourceManager &SM,
+ const LangOptions &LangOpts,
unsigned indent) {
Indent(o, indent) << "<dict>\n";
FullSourceLoc L = P.getLocation().asLocation();
Indent(o, indent) << "<key>location</key>\n";
- EmitLocation(o, SM, L, FM, indent);
+ EmitLocation(o, SM, LangOpts, L, FM, indent);
// Output the ranges (if any).
PathDiagnosticPiece::range_iterator RI = P.ranges_begin(),
Indent(o, indent) << "<key>ranges</key>\n";
Indent(o, indent) << "<array>\n";
++indent;
- for ( ; RI != RE; ++RI ) EmitRange(o, SM, *RI, FM, indent+1);
+ for (; RI != RE; ++RI)
+ EmitRange(o, SM, LangOpts, *RI, FM, indent+1);
--indent;
Indent(o, indent) << "</array>\n";
}
static void ReportMacro(llvm::raw_ostream& o,
const PathDiagnosticMacroPiece& P,
- const FIDMap& FM, const SourceManager *SM,
+ const FIDMap& FM, const SourceManager &SM,
+ const LangOptions &LangOpts,
unsigned indent) {
for (PathDiagnosticMacroPiece::const_iterator I=P.begin(), E=P.end();
default:
break;
case PathDiagnosticPiece::Event:
- ReportEvent(o, cast<PathDiagnosticEventPiece>(**I), FM, SM, indent);
+ ReportEvent(o, cast<PathDiagnosticEventPiece>(**I), FM, SM, LangOpts,
+ indent);
break;
case PathDiagnosticPiece::Macro:
- ReportMacro(o, cast<PathDiagnosticMacroPiece>(**I), FM, SM, indent);
+ ReportMacro(o, cast<PathDiagnosticMacroPiece>(**I), FM, SM, LangOpts,
+ indent);
break;
}
}
}
static void ReportDiag(llvm::raw_ostream& o, const PathDiagnosticPiece& P,
- const FIDMap& FM, const SourceManager* SM) {
+ const FIDMap& FM, const SourceManager &SM,
+ const LangOptions &LangOpts) {
unsigned indent = 4;
switch (P.getKind()) {
case PathDiagnosticPiece::ControlFlow:
ReportControlFlow(o, cast<PathDiagnosticControlFlowPiece>(P), FM, SM,
- indent);
+ LangOpts, indent);
break;
case PathDiagnosticPiece::Event:
- ReportEvent(o, cast<PathDiagnosticEventPiece>(P), FM, SM, indent);
+ ReportEvent(o, cast<PathDiagnosticEventPiece>(P), FM, SM, LangOpts,
+ indent);
break;
case PathDiagnosticPiece::Macro:
- ReportMacro(o, cast<PathDiagnosticMacroPiece>(P), FM, SM, indent);
+ ReportMacro(o, cast<PathDiagnosticMacroPiece>(P), FM, SM, LangOpts,
+ indent);
break;
}
}
o << " <array>\n";
for (PathDiagnostic::const_iterator I=D->begin(), E=D->end(); I != E; ++I)
- ReportDiag(o, *I, FM, SM);
+ ReportDiag(o, *I, FM, *SM, LangOpts);
o << " </array>\n";
// Output the location of the bug.
o << " <key>location</key>\n";
- EmitLocation(o, SM, D->getLocation(), FM, 2);
+ EmitLocation(o, *SM, LangOpts, D->getLocation(), FM, 2);
// Close up the entry.
o << " </dict>\n";
--EndColNo; // Zero base the col #.
// Add in the length of the token, so that we cover multi-char tokens.
- EndColNo += Lexer::MeasureTokenLength(End, SM);
+ EndColNo += Lexer::MeasureTokenLength(End, SM, *LangOpts);
} else {
EndColNo = CaretLine.size();
}
continue;
// Add in the length of the token, so that we cover multi-char tokens.
- unsigned TokSize = Lexer::MeasureTokenLength(E, SM);
+ unsigned TokSize = Lexer::MeasureTokenLength(E, SM, *LangOpts);
OS << '{' << SM.getLineNumber(BInfo.first, BInfo.second) << ':'
<< SM.getColumnNumber(BInfo.first, BInfo.second) << '-'
/// includes a trigraph or an escaped newline) then this count includes bytes
/// that are part of that.
unsigned Lexer::MeasureTokenLength(SourceLocation Loc,
- const SourceManager &SM) {
+ const SourceManager &SM,
+ const LangOptions &LangOpts) {
// TODO: this could be special cased for common tokens like identifiers, ')',
// etc to make this faster, if it mattered. Just look at StrData[0] to handle
// all obviously single-char tokens. This could use
std::pair<const char *,const char *> Buffer = SM.getBufferData(LocInfo.first);
const char *StrData = Buffer.first+LocInfo.second;
- // Create a langops struct and enable trigraphs. This is sufficient for
- // measuring tokens.
- LangOptions LangOpts;
- LangOpts.Trigraphs = true;
-
// Create a lexer starting at the beginning of this token.
Lexer TheLexer(Loc, LangOpts, Buffer.first, StrData, Buffer.second);
Token TheTok;
if (Loc.isInvalid() || !Loc.isFileID())
return SourceLocation();
- unsigned Len = Lexer::MeasureTokenLength(Loc, getSourceManager());
+ unsigned Len = Lexer::MeasureTokenLength(Loc, getSourceManager(), Features);
return AdvanceToTokenCharacter(Loc, Len);
}
unsigned EOffset = SM.getFileOffset(E);
// Include the whole end token in the range.
- EOffset += Lexer::MeasureTokenLength(E, R.getSourceMgr());
+ EOffset += Lexer::MeasureTokenLength(E, R.getSourceMgr(), R.getLangOpts());
HighlightRange(R.getEditBuffer(FID), BOffset, EOffset,
SM.getBufferData(FID).first, StartTag, EndTag);
// Adjust the end offset to the end of the last token, instead of being the
// start of the last token.
- EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr);
+ EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr, *LangOpts);
return EndOff-StartOff;
}
// Adjust the end offset to the end of the last token, instead of being the
// start of the last token.
- EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr);
+ EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr, *LangOpts);
return std::string(Ptr, Ptr+EndOff-StartOff);
}
// Adjust the end offset to the end of the last token, instead of being the
// start of the last token.
- EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr);
+ EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr, *LangOpts);
// Advance the iterators to the right spot, yay for linear time algorithms.
RewriteBuffer::iterator Start = RB.begin();
}
void HTMLPrinter::Initialize(ASTContext &context) {
- R.setSourceMgr(context.getSourceManager());
+ R.setSourceMgr(context.getSourceManager(), context.getLangOptions());
}
HTMLPrinter::~HTMLPrinter() {
MainFileStart = MainBuf->getBufferStart();
MainFileEnd = MainBuf->getBufferEnd();
- Rewrite.setSourceMgr(Context->getSourceManager());
+ Rewrite.setSourceMgr(Context->getSourceManager(), LangOpts);
if (IsHeader)
Preamble = "#pragma once\n";
SourceManager &SM = PP.getSourceManager();
Rewriter Rewrite;
- Rewrite.setSourceMgr(SM);
+ Rewrite.setSourceMgr(SM, PP.getLangOptions());
RewriteBuffer &RB = Rewrite.getEditBuffer(SM.getMainFileID());
std::vector<Token> RawTokens;
MainFileStart = MainBuf->getBufferStart();
MainFileEnd = MainBuf->getBufferEnd();
- Rewrite.setSourceMgr(Context->getSourceManager());
+ Rewrite.setSourceMgr(Context->getSourceManager(), Context->getLangOptions());
// declaring objc_selector outside the parameter list removes a silly
// scope related warning...
// have no ivars (thus not synthesized) then no need to synthesize this class.
if ((CDecl->isForwardDecl() || NumIvars == 0) &&
(!RCDecl || !ObjCSynthesizedStructs.count(RCDecl))) {
- endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
+ endBuf += Lexer::MeasureTokenLength(LocEnd, *SM, LangOpts);
ReplaceText(LocStart, endBuf-startBuf, Result.c_str(), Result.size());
return;
}
SourceLocation L = RCDecl ? CDecl->getSuperClassLoc() :
CDecl->getClassLoc();
const char *endHeader = SM->getCharacterData(L);
- endHeader += Lexer::MeasureTokenLength(L, *SM);
+ endHeader += Lexer::MeasureTokenLength(L, *SM, LangOpts);
if (CDecl->protocol_begin() != CDecl->protocol_end()) {
// advance to the end of the referenced protocols.
// Don't forget to add a ';'!!
InsertText(LocEnd.getFileLocWithOffset(1), ";", 1);
} else { // we don't have any instance variables - insert super struct.
- endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
+ endBuf += Lexer::MeasureTokenLength(LocEnd, *SM, LangOpts);
Result += " {\n struct ";
Result += RCDecl->getNameAsString();
Result += "_IMPL ";
LangObjCXX("ObjC++", llvm::cl::desc("Set base language to Objective-C++"),
llvm::cl::Hidden);
+static llvm::cl::opt<bool>
+ObjCExclusiveGC("fobjc-gc-only",
+ llvm::cl::desc("Use GC exclusively for Objective-C related "
+ "memory management"));
+
+static llvm::cl::opt<bool>
+ObjCEnableGC("fobjc-gc",
+ llvm::cl::desc("Enable Objective-C garbage collection"));
+
+static llvm::cl::opt<LangOptions::VisibilityMode>
+SymbolVisibility("fvisibility",
+ llvm::cl::desc("Set the default symbol visibility:"),
+ llvm::cl::init(LangOptions::Default),
+ llvm::cl::values(clEnumValN(LangOptions::Default, "default",
+ "Use default symbol visibility"),
+ clEnumValN(LangOptions::Hidden, "hidden",
+ "Use hidden symbol visibility"),
+ clEnumValN(LangOptions::Protected,"protected",
+ "Use protected symbol visibility"),
+ clEnumValEnd));
+
+static llvm::cl::opt<bool>
+OverflowChecking("ftrapv",
+ llvm::cl::desc("Trap on integer overflow"),
+ llvm::cl::init(false));
+
+
/// InitializeBaseLanguage - Handle the -x foo options.
static void InitializeBaseLanguage() {
if (LangObjC)
Options.CPlusPlus = 1;
break;
}
+
+ if (ObjCExclusiveGC)
+ Options.setGCMode(LangOptions::GCOnly);
+ else if (ObjCEnableGC)
+ Options.setGCMode(LangOptions::HybridGC);
+
+ Options.setVisibilityMode(SymbolVisibility);
+ Options.OverflowChecking = OverflowChecking;
}
/// LangStds - Language standards we support.
Options.setMainFileName(MainFileName.c_str());
}
-static llvm::cl::opt<bool>
-ObjCExclusiveGC("fobjc-gc-only",
- llvm::cl::desc("Use GC exclusively for Objective-C related "
- "memory management"));
-
-static llvm::cl::opt<bool>
-ObjCEnableGC("fobjc-gc",
- llvm::cl::desc("Enable Objective-C garbage collection"));
-
-void InitializeGCMode(LangOptions &Options) {
- if (ObjCExclusiveGC)
- Options.setGCMode(LangOptions::GCOnly);
- else if (ObjCEnableGC)
- Options.setGCMode(LangOptions::HybridGC);
-}
-
-static llvm::cl::opt<LangOptions::VisibilityMode>
-SymbolVisibility("fvisibility",
- llvm::cl::desc("Set the default symbol visibility:"),
- llvm::cl::init(LangOptions::Default),
- llvm::cl::values(clEnumValN(LangOptions::Default, "default",
- "Use default symbol visibility"),
- clEnumValN(LangOptions::Hidden, "hidden",
- "Use hidden symbol visibility"),
- clEnumValN(LangOptions::Protected,"protected",
- "Use protected symbol visibility"),
- clEnumValEnd));
-
-static llvm::cl::opt<bool>
-OverflowChecking("ftrapv",
- llvm::cl::desc("Trap on integer overflow"),
- llvm::cl::init(false));
-
//===----------------------------------------------------------------------===//
// Target Triple Processing.
//===----------------------------------------------------------------------===//
llvm::TimeRegion Timer(ClangFrontendTimer);
Consumer.reset(new ASTConsumer());
FixItRewrite = new FixItRewriter(PP.getDiagnostics(),
- PP.getSourceManager());
+ PP.getSourceManager(),
+ PP.getLangOptions());
break;
}
// locations now.
if (!FixItRewrite)
FixItRewrite = new FixItRewriter(PP.getDiagnostics(),
- PP.getSourceManager());
+ PP.getSourceManager(),
+ PP.getLangOptions());
bool AddedFixitLocation = false;
for (unsigned Idx = 0, Last = FixItAtLocations.size();
if (InputFilenames.empty())
InputFilenames.push_back("-");
- // Create a file manager object to provide access to and cache the filesystem.
- FileManager FileMgr;
-
// Create the diagnostic client for reporting errors or for
// implementing -verify.
DiagnosticClient* TextDiagClient = 0;
llvm::OwningPtr<SourceManager> SourceMgr;
+ // Create a file manager object to provide access to and cache the filesystem.
+ FileManager FileMgr;
+
for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
const std::string &InFile = InputFilenames[i];
// Initialize language options, inferring file types from input filenames.
LangOptions LangInfo;
+
+ if (!VerifyDiagnostics)
+ static_cast<TextDiagnosticPrinter*>(TextDiagClient)
+ ->SetLangOpts(LangInfo);
+
+
InitializeBaseLanguage();
LangKind LK = GetLanguage(InFile);
InitializeLangOptions(LangInfo, LK);
- InitializeGCMode(LangInfo);
- LangInfo.setVisibilityMode(SymbolVisibility);
- LangInfo.OverflowChecking = OverflowChecking;
InitializeLanguageStandard(LangInfo, LK, Target.get());
// Process the -I options and set them in the HeaderInfo.
HeaderSearch HeaderInfo(FileMgr);
+
InitializeIncludePaths(argv[0], HeaderInfo, FileMgr, LangInfo);
// Set up the preprocessor with these options.