================ @@ -1472,5 +1473,38 @@ IdentifierInfo *ParseHLSLRootSignature(Sema &Actions, return DeclIdent; } +void HandleRootSignatureTarget(Sema &S, StringRef EntryRootSig) { + ASTConsumer *Consumer = &S.getASTConsumer(); + + // Minimally initalize the parser. This does a couple things: + // - initializes Sema scope handling + // - invokes HLSLExternalSemaSource + // - invokes the preprocessor to lex the macros in the file + std::unique_ptr<Parser> P(new Parser(S.getPreprocessor(), S, true)); + S.getPreprocessor().EnterMainSourceFile(); + + bool HaveLexer = S.getPreprocessor().getCurrentLexer(); + if (HaveLexer) { + P->Initialize(); + S.ActOnStartOfTranslationUnit(); + + // Skim through the file to parse to find the define + while (P->getCurToken().getKind() != tok::eof) + P->ConsumeAnyToken(); + ---------------- inbelic wrote:
For some reason this is required when invoking with `clang-dxc`. Without it the `OBJ` portion of this [test case](https://github.com/llvm/llvm-project/pull/156373/files#diff-38f2db6a18b59091b883cc1c74cbfb3adfe6efb5cf461d146de185844d91cfc9) will fail with an error that `EntryRS` is not defined. If these lines are removed all other test cases still pass. The other test-cases are all invoked directly with `clang -cc1` and will invoke the [`MacroDefined` callback](https://github.com/llvm/llvm-project/blob/50d72e692c0d45134422956fff10e779ce822b7f/clang/lib/Frontend/FrontendActions.cpp#L1272) during the first lex in `P->Initialize()`. Perhaps there is some option that `clang-dxc` invokes `clang -cc1` that disables macro expansion before directly needed? https://github.com/llvm/llvm-project/pull/156373 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits