diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-18 22:40:25 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-18 22:40:25 +0000 |
commit | db0ac5572fcf7e6d529ff70f4871707f66c4a623 (patch) | |
tree | 36b1086ba3976b218924c6e3732c81fdc309ad86 /clang/lib/Sema/SemaTemplateDeduction.cpp | |
parent | 9a217b6787f4b4e1f5dd2279d35942a4569c6972 (diff) | |
download | bcm5719-llvm-db0ac5572fcf7e6d529ff70f4871707f66c4a623.tar.gz bcm5719-llvm-db0ac5572fcf7e6d529ff70f4871707f66c4a623.zip |
Split RequireCompleteType into a function that actually requires that the type
is complete (with an error produced if not) and a function that merely queries
whether the type is complete. Either way we'll trigger instantiation if
necessary, but only the former will diagnose and recover from missing module
imports.
The intent of this change is to prevent a class of bugs where code would call
RequireCompleteType(..., 0) and then ignore the result. With modules, we must
check the return value and use it to determine whether the definition of the
type is visible.
This also fixes a debug info quality issue: calls to isCompleteType do not
trigger the emission of debug information for a type in limited-debug-info
mode. This allows us to avoid emitting debug information for type definitions
in more cases where we believe it is safe to do so.
llvm-svn: 256049
Diffstat (limited to 'clang/lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateDeduction.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 66b9abc3000..18ad12a63ca 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -1440,7 +1440,7 @@ DeduceTemplateArgumentsByTypeMatch(Sema &S, // We cannot inspect base classes as part of deduction when the type // is incomplete, so either instantiate any templates necessary to // complete the type, or skip over it if it cannot be completed. - if (S.RequireCompleteType(Info.getLocation(), Arg, 0)) + if (!S.isCompleteType(Info.getLocation(), Arg)) return Result; // Use data recursion to crawl through the list of base classes. @@ -3132,8 +3132,10 @@ static bool AdjustFunctionParmAndArgTypesForDeduction(Sema &S, if (ParamRefType) { // If the argument has incomplete array type, try to complete its type. - if (ArgType->isIncompleteArrayType() && !S.RequireCompleteExprType(Arg, 0)) + if (ArgType->isIncompleteArrayType()) { + S.completeExprArrayBound(Arg); ArgType = Arg->getType(); + } // C++0x [temp.deduct.call]p3: // If P is an rvalue reference to a cv-unqualified template |