summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/ctu-main.cpp
diff options
context:
space:
mode:
authorBalazs Keri <1.int32@gmail.com>2019-08-14 09:41:39 +0000
committerBalazs Keri <1.int32@gmail.com>2019-08-14 09:41:39 +0000
commitc50959431928097bbd675ff3a2346813982db176 (patch)
tree9d2eb3ce3260be37992ecd05c4a85a204b0966f3 /clang/test/Analysis/ctu-main.cpp
parent967583bc087c035fdc4422d05be1030eecf2b241 (diff)
downloadbcm5719-llvm-c50959431928097bbd675ff3a2346813982db176.tar.gz
bcm5719-llvm-c50959431928097bbd675ff3a2346813982db176.zip
[ASTImporter] Import default expression of param before creating the param.
Summary: The default expression of a parameter variable should be imported before the parameter variable object is created. Otherwise the function is created with an incomplete parameter variable (default argument is nullptr) and in this intermediary state the expression is imported. This import can have a reference to the incomplete parameter variable that causes crash. Reviewers: martong, a.sidorin, shafik Reviewed By: martong Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65577 llvm-svn: 368818
Diffstat (limited to 'clang/test/Analysis/ctu-main.cpp')
-rw-r--r--clang/test/Analysis/ctu-main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/Analysis/ctu-main.cpp b/clang/test/Analysis/ctu-main.cpp
index aae4808e90f..c4aee409ee2 100644
--- a/clang/test/Analysis/ctu-main.cpp
+++ b/clang/test/Analysis/ctu-main.cpp
@@ -125,6 +125,8 @@ public:
static const int Test;
};
+extern int testImportOfIncompleteDefaultParmDuringImport(int);
+
int main() {
clang_analyzer_eval(f(3) == 2); // expected-warning{{TRUE}}
clang_analyzer_eval(f(4) == 3); // expected-warning{{TRUE}}
@@ -157,5 +159,8 @@ int main() {
clang_analyzer_eval(extSubSCN.a == 1); // expected-warning{{TRUE}}
// clang_analyzer_eval(extSCC.a == 7); // TODO
clang_analyzer_eval(extU.a == 4); // expected-warning{{TRUE}}
+
clang_analyzer_eval(TestAnonUnionUSR::Test == 5); // expected-warning{{TRUE}}
+
+ clang_analyzer_eval(testImportOfIncompleteDefaultParmDuringImport(9) == 9); // expected-warning{{TRUE}}
}
OpenPOWER on IntegriCloud