[clang][cli] Fix build failure in CompilerInvocation
authorJan Svoboda <jan_svoboda@apple.com>
Fri, 26 Feb 2021 11:54:42 +0000 (12:54 +0100)
committerJan Svoboda <jan_svoboda@apple.com>
Fri, 26 Feb 2021 12:14:23 +0000 (13:14 +0100)
There is a report that https://reviews.llvm.org/D96280 causes a build failure with error: too few template arguments for class template 'SmallVector'. This patch attempts to fix that by explicitly specifying N for SmallVector<T, N>.

clang/lib/Frontend/CompilerInvocation.cpp

index 4d4b942..dac6418 100644 (file)
@@ -663,7 +663,7 @@ static bool RoundTrip(ParseFn Parse, GenerateFn Generate,
   // Generate arguments from the dummy invocation. If Generate is the
   // inverse of Parse, the newly generated arguments must have the same
   // semantics as the original.
-  SmallVector<const char *> GeneratedArgs1;
+  SmallVector<const char *, 16> GeneratedArgs1;
   Generate(DummyInvocation, GeneratedArgs1, SA);
 
   // Run the second parse, now on the generated arguments, and with the real
@@ -683,7 +683,7 @@ static bool RoundTrip(ParseFn Parse, GenerateFn Generate,
 
   // Generate arguments again, this time from the options we will end up using
   // for the rest of the compilation.
-  SmallVector<const char *> GeneratedArgs2;
+  SmallVector<const char *, 16> GeneratedArgs2;
   Generate(RealInvocation, GeneratedArgs2, SA);
 
   // Compares two lists of generated arguments.