diff options
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 89fc00087..5e35bf165 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -656,6 +656,16 @@ bool isFromStdLib(Decl* decl) return false; } +bool isDeclInDifferentModule(IRGenContext* context, Decl* decl) +{ + return getModuleDecl(decl) != context->getMainModuleDecl(); +} + +bool isForceInlineEarly(Decl* decl) +{ + return decl->hasModifier<UnsafeForceInlineEarlyAttribute>(); +} + bool isImportedDecl(IRGenContext* context, Decl* decl, bool& outIsExplicitExtern) { // If the declaration has the extern attribute then it must be imported @@ -6295,7 +6305,10 @@ void maybeEmitDebugLine(IRGenContext* context, StmtLoweringVisitor& visitor, Stm IRInst* debugSourceInst = nullptr; if (context->shared->mapSourceFileToDebugSourceInst.tryGetValue(source, debugSourceInst)) { - auto humaneLoc = context->getLinkage()->getSourceManager()->getHumaneLoc(stmt->loc, SourceLocType::Emit); + // When working with RenderDoc, we need to use actual source loc instead of the nominal one, + // since RenderDoc has the builtin support to split a source file into multiple files based on + // line directives in the file. + auto humaneLoc = context->getLinkage()->getSourceManager()->getHumaneLoc(stmt->loc, SourceLocType::Actual); visitor.startBlockIfNeeded(stmt); context->irBuilder->emitDebugLine(debugSourceInst, humaneLoc.line, humaneLoc.line, humaneLoc.column, humaneLoc.column + 1); } @@ -9132,6 +9145,10 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> // (although we might have to give in eventually), so // this case should really only occur for builtin declarations. } + else if (isDeclInDifferentModule(context, decl) && !isForceInlineEarly(decl)) + { + + } else if (emitBody) { // This is a function definition, so we need to actually |
