aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-28 23:57:43 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-28 23:57:43 +0000
commit19645d2ae928580b62f9feff91c5aa5e19f5f20d (patch)
tree15b7fbbfc3bafa40a162602bc8e08d8ae51a5166 /lib/Serialization/ASTWriter.cpp
parentee591a90c2e26c1ba33a4befb364a1c35fb2c311 (diff)
[PCH] In ASTWriter::associateDeclWithFile don't bother finding the file loc
if we are not interested in the decl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143255 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r--lib/Serialization/ASTWriter.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 749c27b1aa..0c9f0a1247 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -3486,17 +3486,20 @@ static inline bool compLocDecl(std::pair<unsigned, serialization::DeclID> L,
return L.first < R.first;
}
-void ASTWriter::associateDeclWithFile(const Decl *D, DeclID ID,
- SourceLocation FileLoc) {
+void ASTWriter::associateDeclWithFile(const Decl *D, DeclID ID) {
assert(ID);
- assert(FileLoc.isValid());
- assert(FileLoc.isFileID());
+ assert(D);
+
+ SourceLocation Loc = D->getLocation();
+ if (Loc.isInvalid())
+ return;
// We only keep track of the file-level declarations of each file.
if (!D->getLexicalDeclContext()->isFileContext())
return;
SourceManager &SM = Context->getSourceManager();
+ SourceLocation FileLoc = SM.getFileLoc(Loc);
assert(SM.isLocalSourceLocation(FileLoc));
FileID FID = SM.getFileID(FileLoc);
if (FID.isInvalid())