diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-06-04 18:30:46 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-06-04 18:30:46 +0000 |
commit | 7dcd73340ba51943b935064db038e526d4596e6e (patch) | |
tree | 8637c47d7d9621788ce0b624a4a36bf6dcd10795 /clang/lib/Sema/SemaExprCXX.cpp | |
parent | 878df1c2a9803e2b7965d52f5b21fb294dd18607 (diff) | |
download | bcm5719-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.cpp | 9 |
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: |