diff --git a/include/gong/AST/DeclBase.h b/include/gong/AST/DeclBase.h index eea1b80..fb6638b 100644 --- a/include/gong/AST/DeclBase.h +++ b/include/gong/AST/DeclBase.h @@ -58,8 +58,7 @@ class UsingDirectiveDecl; namespace llvm { // DeclContext* is only 4-byte aligned on 32-bit systems. -template<> - class PointerLikeTypeTraits { +template <> class PointerLikeTypeTraits { typedef gong::DeclContext* PT; public: static inline void *getAsVoidPointer(PT P) { return P; } @@ -860,7 +859,7 @@ class DeclContext { DeclContext(Decl::Kind K) : DeclKind(K), ExternalLexicalStorage(false), - ExternalVisibleStorage(false), LookupPtr(0, false), FirstDecl(0), + ExternalVisibleStorage(false), LookupPtr(), FirstDecl(0), LastDecl(0) { } public: diff --git a/include/gong/Frontend/DiagnosticRenderer.h b/include/gong/Frontend/DiagnosticRenderer.h index c2ab753..24ffbb9 100644 --- a/include/gong/Frontend/DiagnosticRenderer.h +++ b/include/gong/Frontend/DiagnosticRenderer.h @@ -27,10 +27,11 @@ namespace gong { class DiagnosticOptions; //class LangOptions; -class StoredDiagnostic; +//class StoredDiagnostic; -typedef llvm::PointerUnion DiagOrStoredDiag; +//typedef llvm::PointerUnion DiagOrStoredDiag; +typedef void* DiagOrStoredDiag; /// \brief Class to encapsulate the logic for formatting a diagnostic message. /// Actual "printing" logic is implemented by subclasses. @@ -134,7 +135,7 @@ class DiagnosticRenderer { const SourceManager *SM, DiagOrStoredDiag D = (Diagnostic *)0); - void emitStoredDiagnostic(StoredDiagnostic &Diag); + //void emitStoredDiagnostic(StoredDiagnostic &Diag); }; /// Subclass of DiagnosticRender that turns all subdiagostics into explicit diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index f7aca24..a88344b 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -603,7 +603,7 @@ DeclRefExpr *DeclRefExpr::Create(ASTContext &Context, if (FoundD) Size += sizeof(NamedDecl *); - void *Mem = Context.Allocate(Size, llvm::alignOf()); + void *Mem = Context.Allocate(Size, alignof(DeclRefExpr)); return new (Mem) DeclRefExpr(Context, /*QualifierLoc,*/ D, RefersToEnclosingLocal, /*NameInfo,*/ L, FoundD, T/*, VK*/); @@ -623,7 +623,7 @@ DeclRefExpr *DeclRefExpr::CreateEmpty(ASTContext &Context, if (HasTemplateKWAndArgsInfo) Size += ASTTemplateKWAndArgsInfo::sizeFor(NumTemplateArgs); - void *Mem = Context.Allocate(Size, llvm::alignOf()); + void *Mem = Context.Allocate(Size, alignof(DeclRefExpr)); return new (Mem) DeclRefExpr(EmptyShell()); } @@ -917,7 +917,7 @@ StringLiteral *StringLiteral::Create(ASTContext &C, StringRef Str, // any concatenated string tokens. void *Mem = C.Allocate(sizeof(StringLiteral)+ sizeof(SourceLocation)*(NumStrs-1), - llvm::alignOf()); + alignof(StringLiteral)); StringLiteral *SL = new (Mem) StringLiteral(Ty); // OPTIMIZE: could allocate this appended to the StringLiteral. @@ -934,7 +934,7 @@ StringLiteral *StringLiteral::Create(ASTContext &C, StringRef Str, StringLiteral *StringLiteral::CreateEmpty(ASTContext &C, unsigned NumStrs) { void *Mem = C.Allocate(sizeof(StringLiteral)+ sizeof(SourceLocation)*(NumStrs-1), - llvm::alignOf()); + alignof(StringLiteral)); StringLiteral *SL = new (Mem) StringLiteral(QualType()); SL->CharByteWidth = 0; SL->Length = 0; @@ -3543,8 +3543,7 @@ ObjCMessageExpr *ObjCMessageExpr::alloc(ASTContext &C, unsigned NumStoredSelLocs) { unsigned Size = sizeof(ObjCMessageExpr) + sizeof(void *) + NumArgs * sizeof(Expr *) + NumStoredSelLocs * sizeof(SourceLocation); - return (ObjCMessageExpr *)C.Allocate(Size, - llvm::AlignOf::Alignment); + return (ObjCMessageExpr *)C.Allocate(Size, alignof(ObjCMessageExpr)); } void ObjCMessageExpr::getSelectorLocs( @@ -3926,7 +3925,7 @@ PseudoObjectExpr *PseudoObjectExpr::Create(ASTContext &Context, EmptyShell sh, unsigned numSemanticExprs) { void *buffer = Context.Allocate(sizeof(PseudoObjectExpr) + (1 + numSemanticExprs) * sizeof(Expr*), - llvm::alignOf()); + alignof(PseudoObjectExpr)); return new(buffer) PseudoObjectExpr(sh, numSemanticExprs); } @@ -3955,7 +3954,7 @@ PseudoObjectExpr *PseudoObjectExpr::Create(ASTContext &C, Expr *syntax, void *buffer = C.Allocate(sizeof(PseudoObjectExpr) + (1 + semantics.size()) * sizeof(Expr*), - llvm::alignOf()); + alignof(PseudoObjectExpr)); return new(buffer) PseudoObjectExpr(type, VK, syntax, semantics, resultIndex); } diff --git a/lib/Basic/SourceLocation.cpp b/lib/Basic/SourceLocation.cpp index 0fe4836..4a7a9ca 100644 --- a/lib/Basic/SourceLocation.cpp +++ b/lib/Basic/SourceLocation.cpp @@ -23,6 +23,6 @@ PresumedLoc PresumedLoc::build(const SourceManager &SM, SourceLocation Loc) { if (ID == -1) return PresumedLoc(); std::pair LC = SM.getLineAndColumn(Loc); - return PresumedLoc(SM.getMemoryBuffer(ID)->getBufferIdentifier(), LC.first, - LC.second, SM.getBufferInfo(ID).IncludeLoc); + return PresumedLoc(SM.getMemoryBuffer(ID)->getBufferIdentifier().data(), + LC.first, LC.second, SM.getBufferInfo(ID).IncludeLoc); } diff --git a/lib/Frontend/TextDiagnostic.cpp b/lib/Frontend/TextDiagnostic.cpp index e215af6..1728808 100644 --- a/lib/Frontend/TextDiagnostic.cpp +++ b/lib/Frontend/TextDiagnostic.cpp @@ -96,16 +96,17 @@ printableTextForNextCharacter(StringRef SourceLine, size_t *i, begin = reinterpret_cast(&*(SourceLine.begin() + *i)); end = begin + (SourceLine.size() - *i); - if (isLegalUTF8Sequence(begin, end)) { - UTF32 c; - UTF32 *cptr = &c; + if (llvm::isLegalUTF8Sequence(begin, end)) { + llvm::UTF32 c; + llvm::UTF32 *cptr = &c; unsigned char const *original_begin = begin; - unsigned char const *cp_end = begin+getNumBytesForUTF8(SourceLine[*i]); + unsigned char const *cp_end = + begin + llvm::getNumBytesForUTF8(SourceLine[*i]); - ConversionResult res = ConvertUTF8toUTF32(&begin, cp_end, &cptr, cptr+1, - strictConversion); + llvm::ConversionResult res = llvm::ConvertUTF8toUTF32( + &begin, cp_end, &cptr, cptr + 1, llvm::strictConversion); (void)res; - assert(conversionOK==res); + assert(llvm::conversionOK==res); assert(0 < begin-original_begin && "we must be further along in the string now"); *i += begin-original_begin; @@ -752,7 +753,7 @@ void TextDiagnostic::emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc, int FID = SM.FindBufferContainingLoc(Loc); if (FID != -1) { const llvm::MemoryBuffer* FE = SM.getMemoryBuffer(FID); - if (FE && FE->getBufferIdentifier()) { + if (FE && !FE->getBufferIdentifier().empty()) { OS << FE->getBufferIdentifier(); //if (FE->getDevice() == 0 && FE->getInode() == 0 // && FE->getFileMode() == 0) { diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index ba346e2..0a84e6f 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -102,7 +102,7 @@ void ParseDiagnosticArgs(DiagnosticOptions &DiagOpts, int argc, } int main(int argc_, const char **argv_) { - llvm::sys::PrintStackTraceOnErrorSignal(); + llvm::sys::PrintStackTraceOnErrorSignal(argv_[0]); llvm::PrettyStackTraceProgram X(argc_, argv_); llvm::InitializeAllTargets();