From dbf5f413cd7a7b0448312a6f198b2a544087ac58 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 10 Jan 2019 16:01:05 -0500 Subject: Improvements around review of debug serialization info (#769) * * Make SourceView and SourceFile no longer derive from RefObject * Both have life time now managed by SourceManager * Tidied up a little around the serialization test code - just create the IRModule once * Simplified code around deleting SourceView/File. * Looked into generateIRForTranslationUnit - seems reasonable to just call it once, because it has side effects. --- source/slang/preprocessor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source/slang/preprocessor.cpp') diff --git a/source/slang/preprocessor.cpp b/source/slang/preprocessor.cpp index d91836c40..c038737b7 100644 --- a/source/slang/preprocessor.cpp +++ b/source/slang/preprocessor.cpp @@ -842,8 +842,7 @@ top: // We create a dummy file to represent the token-paste operation PathInfo pathInfo = PathInfo::makeTokenPaste(); - RefPtr sourceFile = sourceManager->createSourceFileWithString(pathInfo, sb.ProduceString()); - + SourceFile* sourceFile = sourceManager->createSourceFileWithString(pathInfo, sb.ProduceString()); SourceView* sourceView = sourceManager->createSourceView(sourceFile); Lexer lexer; @@ -1634,7 +1633,7 @@ static void HandleIncludeDirective(PreprocessorDirectiveContext* context) auto sourceManager = context->preprocessor->getCompileRequest()->getSourceManager(); // See if this an already loaded source file - RefPtr sourceFile = sourceManager->findSourceFileRecursively(filePathInfo.canonicalPath); + SourceFile* sourceFile = sourceManager->findSourceFileRecursively(filePathInfo.canonicalPath); // If not create a new one, and add to the list of known source files if (!sourceFile) { @@ -2268,8 +2267,8 @@ static void DefineMacro( auto sourceManager = preprocessor->translationUnit->compileRequest->getSourceManager(); - RefPtr keyFile = sourceManager->createSourceFileWithString(pathInfo, key); - RefPtr valueFile = sourceManager->createSourceFileWithString(pathInfo, value); + SourceFile* keyFile = sourceManager->createSourceFileWithString(pathInfo, key); + SourceFile* valueFile = sourceManager->createSourceFileWithString(pathInfo, value); SourceView* keyView = sourceManager->createSourceView(keyFile); SourceView* valueView = sourceManager->createSourceView(valueFile); -- cgit v1.2.3