diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2015-05-04 18:23:54 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2015-05-04 18:23:54 +0000 |
commit | e4983b9522b4bb9638581fab0af186bc11c589ab (patch) | |
tree | 54239ceb749cc14ae618f2addb8c1975a0022d86 | |
parent | 2f12d29b03b69f9e5bdf55bc8cd2167d683cb85f (diff) |
Merging r232425:
------------------------------------------------------------------------
r232425 | rtrieu | 2015-03-16 17:49:43 -0400 (Mon, 16 Mar 2015) | 4 lines
Take the non-reference type when constructing a dummy expression.
Otherwise, Expr will assert during construction with a reference type.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@236440 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/ThreadSafety.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/thread-safety-reference-handling.cpp | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/Analysis/ThreadSafety.cpp b/lib/Analysis/ThreadSafety.cpp index a986c587f8..f45d6e7ef1 100644 --- a/lib/Analysis/ThreadSafety.cpp +++ b/lib/Analysis/ThreadSafety.cpp @@ -2108,8 +2108,8 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) { // Create a dummy expression, VarDecl *VD = const_cast<VarDecl*>(AD.getVarDecl()); - DeclRefExpr DRE(VD, false, VD->getType(), VK_LValue, - AD.getTriggerStmt()->getLocEnd()); + DeclRefExpr DRE(VD, false, VD->getType().getNonReferenceType(), + VK_LValue, AD.getTriggerStmt()->getLocEnd()); LocksetBuilder.handleCall(&DRE, DD); break; } diff --git a/test/SemaCXX/thread-safety-reference-handling.cpp b/test/SemaCXX/thread-safety-reference-handling.cpp new file mode 100644 index 0000000000..2f7eb48d34 --- /dev/null +++ b/test/SemaCXX/thread-safety-reference-handling.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety-analysis -std=c++11 %s +// expected-no-diagnostics + +class Base { +public: + Base() {} + virtual ~Base(); +}; + +class S : public Base { +public: + ~S() override = default; +}; + +void Test() { + const S &s = S(); +} |