[llvm-branch-commits] [cfe-branch] r236440 - Merging r232425:

Tom Stellard thomas.stellard at amd.com
Mon May 4 11:23:55 PDT 2015


Author: tstellar
Date: Mon May  4 13:23:54 2015
New Revision: 236440

URL: http://llvm.org/viewvc/llvm-project?rev=236440&view=rev
Log:
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.

------------------------------------------------------------------------

Added:
    cfe/branches/release_36/test/SemaCXX/thread-safety-reference-handling.cpp
Modified:
    cfe/branches/release_36/lib/Analysis/ThreadSafety.cpp

Modified: cfe/branches/release_36/lib/Analysis/ThreadSafety.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/lib/Analysis/ThreadSafety.cpp?rev=236440&r1=236439&r2=236440&view=diff
==============================================================================
--- cfe/branches/release_36/lib/Analysis/ThreadSafety.cpp (original)
+++ cfe/branches/release_36/lib/Analysis/ThreadSafety.cpp Mon May  4 13:23:54 2015
@@ -2108,8 +2108,8 @@ void ThreadSafetyAnalyzer::runAnalysis(A
 
           // 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;
         }

Added: cfe/branches/release_36/test/SemaCXX/thread-safety-reference-handling.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/test/SemaCXX/thread-safety-reference-handling.cpp?rev=236440&view=auto
==============================================================================
--- cfe/branches/release_36/test/SemaCXX/thread-safety-reference-handling.cpp (added)
+++ cfe/branches/release_36/test/SemaCXX/thread-safety-reference-handling.cpp Mon May  4 13:23:54 2015
@@ -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();
+}





More information about the llvm-branch-commits mailing list