[clang] 8dc70bd - [clang][cli] Fix build failure in CompilerInvocation

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 26 04:14:48 PST 2021


Author: Jan Svoboda
Date: 2021-02-26T13:14:23+01:00
New Revision: 8dc70bdcd0fe4efb65876dce0144d9c3386a2f07

URL: https://github.com/llvm/llvm-project/commit/8dc70bdcd0fe4efb65876dce0144d9c3386a2f07
DIFF: https://github.com/llvm/llvm-project/commit/8dc70bdcd0fe4efb65876dce0144d9c3386a2f07.diff

LOG: [clang][cli] Fix build failure in CompilerInvocation

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>.

Added: 
    

Modified: 
    clang/lib/Frontend/CompilerInvocation.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 4d4b942995d7..dac64183306a 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -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.


        


More information about the cfe-commits mailing list