@@ -618,8 +618,17 @@ class consumer : public clang::ASTConsumer {
618
618
619
619
struct action : clang::ASTFrontendAction {
620
620
void ExecuteAction () override {
621
+ clang::CompilerInstance &CI = getCompilerInstance ();
621
622
if (!include_header.empty ())
622
- installPPCallbacks ();
623
+ installPPCallbacks (CI);
624
+
625
+ // Setting DelayedTemplateParsing to false is equivalent invoking Clang with
626
+ // the -fno-delayed-template-parsing option. On Windows, Clang defaults to
627
+ // -fdelayed-template-parsing behavior to more closely match MSVC behavior.
628
+ // We do not want this behavior because it causes us to miss some expression
629
+ // nodes in template functions.
630
+ CI.getInvocation ().getLangOpts ().DelayedTemplateParsing = false ;
631
+
623
632
clang::ASTFrontendAction::ExecuteAction ();
624
633
}
625
634
@@ -632,10 +641,9 @@ struct action : clang::ASTFrontendAction {
632
641
// Install a callback that will be invoked on every preprocessor include
633
642
// statement. This is done so we can determine if a user-specified custom
634
643
// include statment needs to be added if any annotations are added.
635
- void installPPCallbacks () {
636
- clang::CompilerInstance &compiler_instance = getCompilerInstance ();
637
- clang::Preprocessor &preprocessor = compiler_instance.getPreprocessor ();
638
- clang::SourceManager &source_manager = compiler_instance.getSourceManager ();
644
+ void installPPCallbacks (clang::CompilerInstance &CI) {
645
+ clang::Preprocessor &preprocessor = CI.getPreprocessor ();
646
+ clang::SourceManager &source_manager = CI.getSourceManager ();
639
647
preprocessor.addPPCallbacks (
640
648
std::make_unique<PPCallbacks>(source_manager, file_includes_));
641
649
}
0 commit comments