[PATCH] D33644: Add default values for function parameter chunks
Ivan Donchevskii via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 29 05:55:23 PDT 2017
yvvan created this revision.
Append optional chunks with their default values. For example: before - "int i", after - "int i = 10". This change affects only simple types.
https://reviews.llvm.org/D33644
Files:
lib/Sema/SemaCodeComplete.cpp
Index: lib/Sema/SemaCodeComplete.cpp
===================================================================
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -2279,6 +2279,15 @@
} else {
Type.getAsStringInternal(Result, Policy);
}
+ if (Param->hasDefaultArg()) {
+ APValue *defaultValue = Param->evaluateValue();
+ if (defaultValue) {
+ std::string defaultValueStr = defaultValue->getAsString(
+ Param->getASTContext(), Param->getType());
+ if (!defaultValueStr.empty())
+ Result += " = " + defaultValueStr;
+ }
+ }
return Result;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33644.100606.patch
Type: text/x-patch
Size: 641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170529/ef1ee78d/attachment.bin>
More information about the cfe-commits
mailing list