[llvm-branch-commits] [cfe-branch] r227375 - Merging r227368:

Hans Wennborg hans at hanshq.net
Wed Jan 28 13:59:15 PST 2015


Author: hans
Date: Wed Jan 28 15:59:15 2015
New Revision: 227375

URL: http://llvm.org/viewvc/llvm-project?rev=227375&view=rev
Log:
Merging r227368:
------------------------------------------------------------------------
r227368 | rikka | 2015-01-28 13:10:46 -0800 (Wed, 28 Jan 2015) | 9 lines

Revert a change from r222797 that is no longer needed and can cause
infinite recursion.

Also guard against said infinite recursion by adding an assert that will
trigger if CorrectDelayedTyposInExpr is called before a previous call to
CorrectDelayedTyposInExpr returns (i.e. if the TreeTransform run by
CorrectDelayedTyposInExpr calls a sequence of methods that
end up calling CorrectDelayedTyposInExpr, as the new test case had done
prior to this commit). Fixes PR22292.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_36/   (props changed)
    cfe/branches/release_36/lib/Sema/SemaExpr.cpp
    cfe/branches/release_36/lib/Sema/SemaExprCXX.cpp
    cfe/branches/release_36/test/SemaCXX/typo-correction-delayed.cpp

Propchange: cfe/branches/release_36/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 28 15:59:15 2015
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:226008,226049,226136,226282,226624,226707,226754,226863,226877,227062,227220,227251,227278,227295
+/cfe/trunk:226008,226049,226136,226282,226624,226707,226754,226863,226877,227062,227220,227251,227278,227295,227368
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_36/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/lib/Sema/SemaExpr.cpp?rev=227375&r1=227374&r2=227375&view=diff
==============================================================================
--- cfe/branches/release_36/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/release_36/lib/Sema/SemaExpr.cpp Wed Jan 28 15:59:15 2015
@@ -4762,12 +4762,8 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
                                      VK_RValue, RParenLoc);
 
   // Bail out early if calling a builtin with custom typechecking.
-  if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID)) {
-    ExprResult Res = CorrectDelayedTyposInExpr(TheCall);
-    if (!Res.isUsable() || !isa<CallExpr>(Res.get()))
-      return Res;
-    return CheckBuiltinFunctionCall(FDecl, BuiltinID, cast<CallExpr>(Res.get()));
-  }
+  if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID))
+    return CheckBuiltinFunctionCall(FDecl, BuiltinID, TheCall);
 
  retry:
   const FunctionType *FuncT;

Modified: cfe/branches/release_36/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/lib/Sema/SemaExprCXX.cpp?rev=227375&r1=227374&r2=227375&view=diff
==============================================================================
--- cfe/branches/release_36/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/branches/release_36/lib/Sema/SemaExprCXX.cpp Wed Jan 28 15:59:15 2015
@@ -6232,8 +6232,12 @@ ExprResult Sema::CorrectDelayedTyposInEx
   if (E && !ExprEvalContexts.empty() && ExprEvalContexts.back().NumTypos &&
       (E->isTypeDependent() || E->isValueDependent() ||
        E->isInstantiationDependent())) {
+    auto TyposInContext = ExprEvalContexts.back().NumTypos;
+    assert(TyposInContext < ~0U && "Recursive call of CorrectDelayedTyposInExpr");
+    ExprEvalContexts.back().NumTypos = ~0U;
     auto TyposResolved = DelayedTypos.size();
     auto Result = TransformTypos(*this, Filter).Transform(E);
+    ExprEvalContexts.back().NumTypos = TyposInContext;
     TyposResolved -= DelayedTypos.size();
     if (Result.isInvalid() || Result.get() != E) {
       ExprEvalContexts.back().NumTypos -= TyposResolved;

Modified: cfe/branches/release_36/test/SemaCXX/typo-correction-delayed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_36/test/SemaCXX/typo-correction-delayed.cpp?rev=227375&r1=227374&r2=227375&view=diff
==============================================================================
--- cfe/branches/release_36/test/SemaCXX/typo-correction-delayed.cpp (original)
+++ cfe/branches/release_36/test/SemaCXX/typo-correction-delayed.cpp Wed Jan 28 15:59:15 2015
@@ -166,6 +166,14 @@ namespace PR22250 {
 int getenv_s(size_t *y, char(&z)) {}
 }
 
+namespace PR22291 {
+template <unsigned I> void f() {
+  unsigned *prio_bits_array;  // expected-note {{'prio_bits_array' declared here}}
+  // expected-error at +1 {{use of undeclared identifier 'prio_op_array'; did you mean 'prio_bits_array'?}}
+  __atomic_store_n(prio_op_array + I, false, __ATOMIC_RELAXED);
+}
+}
+
 namespace PR22297 {
 double pow(double x, double y);
 struct TimeTicks {





More information about the llvm-branch-commits mailing list