Skip to content

Commit 77ae111

Browse files
lwesiersAlexeySachkov
authored andcommitted
Add ResetAllOptionOccurrences before creating CompilerInvocation
After this change: llvm/llvm-project@7bdad08 To be more precise, in this line: https://github.com/llvm/llvm-project/blob/d2a710ea784eea43c63e3831224de6355f1e4a6f/clang/lib/Frontend/CompilerInvocation.cpp#L3587 We have a problem during second compilation of user kernel via opencl-clang in the same process. When we hit this place two times - it will abort the compilation, because we are trying to assign the same flag twice which is wrong. message error: clang (LLVM option parsing): for the --pgo-warn-misexpect option: may only occur zero or one times!
1 parent 5fcd66e commit 77ae111

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

common_clang.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
245245
compiler->createFileManager(OverlayFS);
246246
compiler->createSourceManager(compiler->getFileManager());
247247

248+
// Calling ResetAllOptionOccurrences as WA for issue from here:
249+
// https://reviews.llvm.org/D66324?id=219733#1680231
250+
llvm::cl::ResetAllOptionOccurrences();
248251
// Create compiler invocation from user args before trickering with it
249252
clang::CompilerInvocation::CreateFromArgs(compiler->getInvocation(),
250253
optionsParser.args(), *Diags);

0 commit comments

Comments
 (0)