Modified: CreateTargetInfo(). Now takes Diagnostic* instead of Diagnostic&.
Modified: ctor of SerializationTest: Now takes LangOptions argument. We
will eventually serialize this as well.
llvm-svn: 44630
This commit is contained in:
parent
dc71f08586
commit
dd1a7aade5
|
|
@ -32,7 +32,8 @@ ASTConsumer *CreateDeadStoreChecker(Diagnostic &Diags);
|
||||||
ASTConsumer *CreateUnitValsChecker(Diagnostic &Diags);
|
ASTConsumer *CreateUnitValsChecker(Diagnostic &Diags);
|
||||||
ASTConsumer *CreateLLVMEmitter(Diagnostic &Diags, const LangOptions &Features);
|
ASTConsumer *CreateLLVMEmitter(Diagnostic &Diags, const LangOptions &Features);
|
||||||
ASTConsumer *CreateCodeRewriterTest(Diagnostic &Diags);
|
ASTConsumer *CreateCodeRewriterTest(Diagnostic &Diags);
|
||||||
ASTConsumer *CreateSerializationTest(Diagnostic &Diags, FileManager& FMgr);
|
ASTConsumer *CreateSerializationTest(Diagnostic &Diags, FileManager& FMgr,
|
||||||
|
const LangOptions &LOpts);
|
||||||
|
|
||||||
} // end clang namespace
|
} // end clang namespace
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ class SerializationTest : public ASTConsumer {
|
||||||
ASTContext* Context;
|
ASTContext* Context;
|
||||||
Diagnostic &Diags;
|
Diagnostic &Diags;
|
||||||
FileManager &FMgr;
|
FileManager &FMgr;
|
||||||
|
const LangOptions& LangOpts;
|
||||||
std::list<Decl*> Decls;
|
std::list<Decl*> Decls;
|
||||||
|
|
||||||
enum { BasicMetadataBlock = 1,
|
enum { BasicMetadataBlock = 1,
|
||||||
|
|
@ -63,8 +64,8 @@ class SerializationTest : public ASTConsumer {
|
||||||
DeclsBlock = 3 };
|
DeclsBlock = 3 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SerializationTest(Diagnostic &d, FileManager& fmgr)
|
SerializationTest(Diagnostic &d, FileManager& fmgr, const LangOptions& LOpts)
|
||||||
: Context(NULL), Diags(d), FMgr(fmgr) {};
|
: Context(NULL), Diags(d), FMgr(fmgr), LangOpts(LOpts) {};
|
||||||
|
|
||||||
~SerializationTest();
|
~SerializationTest();
|
||||||
|
|
||||||
|
|
@ -84,8 +85,9 @@ private:
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
ASTConsumer*
|
ASTConsumer*
|
||||||
clang::CreateSerializationTest(Diagnostic &Diags, FileManager& FMgr) {
|
clang::CreateSerializationTest(Diagnostic &Diags, FileManager& FMgr,
|
||||||
return new SerializationTest(Diags,FMgr);
|
const LangOptions &LOpts) {
|
||||||
|
return new SerializationTest(Diags,FMgr,LOpts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WritePreamble(llvm::BitstreamWriter& Stream) {
|
static void WritePreamble(llvm::BitstreamWriter& Stream) {
|
||||||
|
|
@ -272,7 +274,7 @@ void SerializationTest::Deserialize(llvm::sys::Path& Filename,
|
||||||
std::vector<std::string> triples;
|
std::vector<std::string> triples;
|
||||||
triples.push_back(triple);
|
triples.push_back(triple);
|
||||||
delete [] triple;
|
delete [] triple;
|
||||||
Dezr.RegisterPtr(PtrID,CreateTargetInfo(triples,Diags));
|
Dezr.RegisterPtr(PtrID,CreateTargetInfo(triples,&Diags));
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Selectors, we must read the identifier table first because the
|
// For Selectors, we must read the identifier table first because the
|
||||||
|
|
|
||||||
|
|
@ -691,7 +691,7 @@ static TargetInfoImpl *CreateTarget(const std::string& T) {
|
||||||
/// CreateTargetInfo - Return the set of target info objects as specified by
|
/// CreateTargetInfo - Return the set of target info objects as specified by
|
||||||
/// the -arch command line option.
|
/// the -arch command line option.
|
||||||
TargetInfo *clang::CreateTargetInfo(const std::vector<std::string>& triples,
|
TargetInfo *clang::CreateTargetInfo(const std::vector<std::string>& triples,
|
||||||
Diagnostic &Diags) {
|
Diagnostic *Diags) {
|
||||||
|
|
||||||
assert (!triples.empty() && "No target triple.");
|
assert (!triples.empty() && "No target triple.");
|
||||||
|
|
||||||
|
|
@ -701,7 +701,7 @@ TargetInfo *clang::CreateTargetInfo(const std::vector<std::string>& triples,
|
||||||
if (!PrimaryTarget)
|
if (!PrimaryTarget)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
TargetInfo *TI = new TargetInfo(PrimaryTarget, &Diags);
|
TargetInfo *TI = new TargetInfo(PrimaryTarget, Diags);
|
||||||
|
|
||||||
// Add all secondary targets.
|
// Add all secondary targets.
|
||||||
for (unsigned i = 1, e = triples.size(); i != e; ++i) {
|
for (unsigned i = 1, e = triples.size(); i != e; ++i) {
|
||||||
|
|
|
||||||
|
|
@ -848,7 +848,7 @@ static ASTConsumer* CreateASTConsumer(Diagnostic& Diag, FileManager& FileMgr,
|
||||||
return CreateUnitValsChecker(Diag);
|
return CreateUnitValsChecker(Diag);
|
||||||
|
|
||||||
case TestSerialization:
|
case TestSerialization:
|
||||||
return CreateSerializationTest(Diag, FileMgr);
|
return CreateSerializationTest(Diag, FileMgr, LangOpts);
|
||||||
|
|
||||||
case EmitLLVM:
|
case EmitLLVM:
|
||||||
return CreateLLVMEmitter(Diag, LangOpts);
|
return CreateLLVMEmitter(Diag, LangOpts);
|
||||||
|
|
@ -1004,7 +1004,7 @@ int main(int argc, char **argv) {
|
||||||
{ // Create triples, and create the TargetInfo.
|
{ // Create triples, and create the TargetInfo.
|
||||||
std::vector<std::string> triples;
|
std::vector<std::string> triples;
|
||||||
CreateTargetTriples(triples);
|
CreateTargetTriples(triples);
|
||||||
Target = CreateTargetInfo(triples,Diags);
|
Target = CreateTargetInfo(triples,&Diags);
|
||||||
|
|
||||||
if (Target == 0) {
|
if (Target == 0) {
|
||||||
fprintf(stderr, "Sorry, I don't know what target this is: %s\n",
|
fprintf(stderr, "Sorry, I don't know what target this is: %s\n",
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ MinimalAction *CreatePrintParserActionsAction(IdentifierTable &);
|
||||||
/// CreateTargetInfo - Return the set of target info objects as specified by
|
/// CreateTargetInfo - Return the set of target info objects as specified by
|
||||||
/// the -arch command line option.
|
/// the -arch command line option.
|
||||||
TargetInfo *CreateTargetInfo(const std::vector<std::string>& triples,
|
TargetInfo *CreateTargetInfo(const std::vector<std::string>& triples,
|
||||||
Diagnostic &Diags);
|
Diagnostic *Diags);
|
||||||
|
|
||||||
/// EmitLLVMFromASTs - Implement -emit-llvm, which generates llvm IR from C.
|
/// EmitLLVMFromASTs - Implement -emit-llvm, which generates llvm IR from C.
|
||||||
void EmitLLVMFromASTs(Preprocessor &PP, unsigned MainFileID,
|
void EmitLLVMFromASTs(Preprocessor &PP, unsigned MainFileID,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue