summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/ASTImporterTest.cpp
diff options
context:
space:
mode:
authorAleksei Sidorin <a.sidorin@samsung.com>2018-05-14 16:12:31 +0000
committerAleksei Sidorin <a.sidorin@samsung.com>2018-05-14 16:12:31 +0000
commit54d6af5be63690e31cbb26d79f4f2dd2a5ba6291 (patch)
treed33aec4a4d993dab88f80d39e3a8f2a9a0ef0b75 /clang/unittests/AST/ASTImporterTest.cpp
parent4a20f3b3f916872dbeeaefbfdc083fcba791d6bf (diff)
downloadbcm5719-llvm-54d6af5be63690e31cbb26d79f4f2dd2a5ba6291.tar.gz
bcm5719-llvm-54d6af5be63690e31cbb26d79f4f2dd2a5ba6291.zip
[ASTImporter] Turn StringRefs back to std::strings to avoid use-after-free
This is a workaround for the issue in buildASTFromCodeWithArgs() where a local buffer can be used to store the program text referred by SourceManager. FIXME: Fix the root issue in buildASTFromCodeWithArgs(). llvm-svn: 332256
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r--clang/unittests/AST/ASTImporterTest.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index 0e3105b5104..debcfe67d96 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -207,8 +207,8 @@ class ASTImporterTestBase : public ::testing::TestWithParam<ArgVector> {
struct TU {
// Buffer for the context, must live in the test scope.
- StringRef Code;
- StringRef FileName;
+ std::string Code;
+ std::string FileName;
std::unique_ptr<ASTUnit> Unit;
TranslationUnitDecl *TUDecl = nullptr;
TU(StringRef Code, StringRef FileName, ArgVector Args)
OpenPOWER on IntegriCloud