summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-06-04 18:30:46 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-06-04 18:30:46 +0000
commit7dcd73340ba51943b935064db038e526d4596e6e (patch)
tree8637c47d7d9621788ce0b624a4a36bf6dcd10795 /clang/lib/Sema/SemaExprCXX.cpp
parent878df1c2a9803e2b7965d52f5b21fb294dd18607 (diff)
downloadbcm5719-llvm-7dcd73340ba51943b935064db038e526d4596e6e.tar.gz
bcm5719-llvm-7dcd73340ba51943b935064db038e526d4596e6e.zip
Factor out repeated code to build a DeclRefExpr and mark it referenced.
llvm-svn: 362537
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 5884cf906fd..1eb6a7114ff 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -3633,12 +3633,9 @@ ExprResult Sema::CheckConditionVariable(VarDecl *ConditionVar,
diag::err_invalid_use_of_array_type)
<< ConditionVar->getSourceRange());
- ExprResult Condition = DeclRefExpr::Create(
- Context, NestedNameSpecifierLoc(), SourceLocation(), ConditionVar,
- /*enclosing*/ false, ConditionVar->getLocation(),
- ConditionVar->getType().getNonReferenceType(), VK_LValue);
-
- MarkDeclRefReferenced(cast<DeclRefExpr>(Condition.get()));
+ ExprResult Condition = BuildDeclRefExpr(
+ ConditionVar, ConditionVar->getType().getNonReferenceType(), VK_LValue,
+ ConditionVar->getLocation());
switch (CK) {
case ConditionKind::Boolean:
OpenPOWER on IntegriCloud