diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-27 01:32:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-27 01:32:48 +0000 |
commit | c8dfe5ece04e683106eb96c58a2999f70b53ac21 (patch) | |
tree | 0042003e927d0563cd605faf6d398542cb50a7c1 /lib/Frontend/ASTUnit.cpp | |
parent | 5fe8c04009eff540ebaa0cceb2e75c3908322e11 (diff) |
When given unsaved files in clang_createTranslationUnitFromSourceFile,
copy the source buffers provided rather than referencing them
directly, so that the caller can free those buffers immediately after
calling clang_createTranslationUnitFromSourceFile(). Otherwise, we
risk hitting those buffers later (when building source ranges, forming
diagnostics, etc.).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97296 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 8874622a24..ef14df1034 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -162,6 +162,7 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename, if (!FromFile) { Diags.Report(diag::err_fe_remap_missing_from_file) << RemappedFiles[I].first; + delete RemappedFiles[I].second; continue; } |