Author: hans
Date: Tue Aug  8 11:38:07 2017
New Revision: 310395

URL: http://llvm.org/viewvc/llvm-project?rev=310395&view=rev
Log:
Merging r308722:
------------------------------------------------------------------------
r308722 | ibiryukov | 2017-07-21 02:24:00 -0700 (Fri, 21 Jul 2017) | 13 lines

Fixed failing assert in code completion.

Summary:
The code was accessing uninstantiated default argument.
This resulted in failing assertion at ParmVarDecl::getDefaultArg().

Reviewers: erikjv, klimek, bkramer, krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D35682
------------------------------------------------------------------------

Added:
    cfe/branches/release_50/test/CodeCompletion/uninstantiated_params.cpp
      - copied unchanged from r308722, 
cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
Modified:
    cfe/branches/release_50/   (props changed)
    cfe/branches/release_50/lib/Sema/SemaCodeComplete.cpp

Propchange: cfe/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug  8 11:38:07 2017
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:308455,308824,308897,308996,309058,309112-309113,309226,309263,309327,309382-309383,309488,309503,309523,309722,309752,309975,310057,310158,310191,310359
+/cfe/trunk:308455,308722,308824,308897,308996,309058,309112-309113,309226,309263,309327,309382-309383,309488,309503,309523,309722,309752,309975,310057,310158,310191,310359
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_50/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/lib/Sema/SemaCodeComplete.cpp?rev=310395&r1=310394&r2=310395&view=diff
==============================================================================
--- cfe/branches/release_50/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/branches/release_50/lib/Sema/SemaCodeComplete.cpp Tue Aug  8 11:38:07 
2017
@@ -2401,10 +2401,7 @@ formatBlockPlaceholder(const PrintingPol
 static std::string GetDefaultValueString(const ParmVarDecl *Param,
                                          const SourceManager &SM,
                                          const LangOptions &LangOpts) {
-  const Expr *defaultArg = Param->getDefaultArg();
-  if (!defaultArg)
-    return "";
-  const SourceRange SrcRange = defaultArg->getSourceRange();
+  const SourceRange SrcRange = Param->getDefaultArgRange();
   CharSourceRange CharSrcRange = CharSourceRange::getTokenRange(SrcRange);
   bool Invalid = CharSrcRange.isInvalid();
   if (Invalid)


_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to