diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-28 23:57:47 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-28 23:57:47 +0000 |
commit | 7362e9bacb5f7537d92e360351bee53b8904f42a (patch) | |
tree | c7e72de1fc716007500f0be1958e920e73a168f2 /clang/lib/Serialization/ASTWriter.cpp | |
parent | df53da872501188319e3914d48eccdd1aa83ed11 (diff) | |
download | bcm5719-llvm-7362e9bacb5f7537d92e360351bee53b8904f42a.tar.gz bcm5719-llvm-7362e9bacb5f7537d92e360351bee53b8904f42a.zip |
[PCH] Sort the file decls by file offset not raw source location.
Currently sorting by raw source location does work as intended but who knows
what may change in the future..
llvm-svn: 143256
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 0c9f0a1247c..1b44baa9ce5 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -3501,7 +3501,9 @@ void ASTWriter::associateDeclWithFile(const Decl *D, DeclID ID) { SourceManager &SM = Context->getSourceManager(); SourceLocation FileLoc = SM.getFileLoc(Loc); assert(SM.isLocalSourceLocation(FileLoc)); - FileID FID = SM.getFileID(FileLoc); + FileID FID; + unsigned Offset; + llvm::tie(FID, Offset) = SM.getDecomposedLoc(FileLoc); if (FID.isInvalid()) return; const SrcMgr::SLocEntry *Entry = &SM.getSLocEntry(FID); @@ -3511,11 +3513,10 @@ void ASTWriter::associateDeclWithFile(const Decl *D, DeclID ID) { if (!Info) Info = new DeclIDInFileInfo(); - unsigned RawLoc = FileLoc.getRawEncoding(); - std::pair<unsigned, serialization::DeclID> LocDecl(RawLoc, ID); + std::pair<unsigned, serialization::DeclID> LocDecl(Offset, ID); LocDeclIDsTy &Decls = Info->DeclIDs; - if (Decls.empty() || Decls.back().first <= RawLoc) { + if (Decls.empty() || Decls.back().first <= Offset) { Decls.push_back(LocDecl); return; } |