diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGCoroutine.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 18 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.h | 1 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 1 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenAction.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CoverageMappingGen.cpp | 7 | ||||
-rw-r--r-- | clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp | 2 |
9 files changed, 19 insertions, 23 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 3f784fc..e1f7ea0 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -1148,7 +1148,8 @@ llvm::Value *CodeGenFunction::emitCountedByPointerSize( assert(E->getCastKind() == CK_LValueToRValue && "must be an LValue to RValue cast"); - const MemberExpr *ME = dyn_cast<MemberExpr>(E->getSubExpr()); + const MemberExpr *ME = + dyn_cast<MemberExpr>(E->getSubExpr()->IgnoreParenNoopCasts(getContext())); if (!ME) return nullptr; diff --git a/clang/lib/CodeGen/CGCoroutine.cpp b/clang/lib/CodeGen/CGCoroutine.cpp index 5ee9089..827385f 100644 --- a/clang/lib/CodeGen/CGCoroutine.cpp +++ b/clang/lib/CodeGen/CGCoroutine.cpp @@ -435,7 +435,7 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const &CoroName, llvm::FunctionType *LTy = CGM.getTypes().GetFunctionType(FI); llvm::Function *Fn = llvm::Function::Create( - LTy, llvm::GlobalValue::PrivateLinkage, FuncName, &CGM.getModule()); + LTy, llvm::GlobalValue::InternalLinkage, FuncName, &CGM.getModule()); Fn->addParamAttr(0, llvm::Attribute::AttrKind::NonNull); Fn->addParamAttr(0, llvm::Attribute::AttrKind::NoUndef); diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 77fc3a2..1ce834d 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -643,16 +643,7 @@ unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc, bool Force) { } StringRef CGDebugInfo::getCurrentDirname() { - if (!CGM.getCodeGenOpts().DebugCompilationDir.empty()) - return CGM.getCodeGenOpts().DebugCompilationDir; - - if (!CWDName.empty()) - return CWDName; - llvm::ErrorOr<std::string> CWD = - CGM.getFileSystem()->getCurrentWorkingDirectory(); - if (!CWD) - return StringRef(); - return CWDName = internString(*CWD); + return CGM.getCodeGenOpts().DebugCompilationDir; } void CGDebugInfo::CreateCompileUnit() { @@ -2641,6 +2632,8 @@ void CGDebugInfo::emitVTableSymbol(llvm::GlobalVariable *VTable, const CXXRecordDecl *RD) { if (!CGM.getTarget().getCXXABI().isItaniumFamily()) return; + if (DebugKind <= llvm::codegenoptions::DebugLineTablesOnly) + return; ASTContext &Context = CGM.getContext(); StringRef SymbolName = "_vtable$"; @@ -3246,6 +3239,9 @@ llvm::DIModule *CGDebugInfo::getOrCreateModuleRef(ASTSourceDescriptor Mod, std::string Remapped = remapDIPath(Path); StringRef Relative(Remapped); StringRef CompDir = TheCU->getDirectory(); + if (CompDir.empty()) + return Remapped; + if (Relative.consume_front(CompDir)) Relative.consume_front(llvm::sys::path::get_separator()); @@ -4805,7 +4801,7 @@ void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke, const FunctionDecl *CalleeDecl) { if (!CallOrInvoke) return; - auto *Func = CallOrInvoke->getCalledFunction(); + auto *Func = dyn_cast<llvm::Function>(CallOrInvoke->getCalledOperand()); if (!Func) return; if (Func->getSubprogram()) diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index 411b2e7..497d3a6 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -158,7 +158,6 @@ class CGDebugInfo { /// This is a storage for names that are constructed on demand. For /// example, C++ destructors, C++ operators etc.. llvm::BumpPtrAllocator DebugInfoNames; - StringRef CWDName; llvm::DenseMap<const char *, llvm::TrackingMDRef> DIFileCache; llvm::DenseMap<const FunctionDecl *, llvm::TrackingMDRef> SPCache; diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 90aed79..5a3d4e4 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -93,6 +93,7 @@ static llvm::StringRef GetUBSanTrapForHandler(SanitizerHandler ID) { LIST_SANITIZER_CHECKS #undef SANITIZER_CHECK } + llvm_unreachable("unhandled switch case"); } /// CreateTempAlloca - This creates a alloca and inserts it into the entry diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp index e25b694..04c9192 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp @@ -2278,8 +2278,12 @@ void CGOpenMPRuntimeGPU::processRequiresDirective(const OMPRequiresDecl *D) { case OffloadArch::SM_100a: case OffloadArch::SM_101: case OffloadArch::SM_101a: + case OffloadArch::SM_103: + case OffloadArch::SM_103a: case OffloadArch::SM_120: case OffloadArch::SM_120a: + case OffloadArch::SM_121: + case OffloadArch::SM_121a: case OffloadArch::GFX600: case OffloadArch::GFX601: case OffloadArch::GFX602: diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index 2c0767f..dc54c97 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -978,7 +978,7 @@ CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { CI.getPreprocessor()); std::unique_ptr<BackendConsumer> Result(new BackendConsumer( - CI, BA, &CI.getVirtualFileSystem(), *VMContext, std::move(LinkModules), + CI, BA, CI.getVirtualFileSystemPtr(), *VMContext, std::move(LinkModules), InFile, std::move(OS), CoverageInfo)); BEConsumer = Result.get(); @@ -1156,7 +1156,7 @@ void CodeGenAction::ExecuteAction() { // Set clang diagnostic handler. To do this we need to create a fake // BackendConsumer. - BackendConsumer Result(CI, BA, &CI.getVirtualFileSystem(), *VMContext, + BackendConsumer Result(CI, BA, CI.getVirtualFileSystemPtr(), *VMContext, std::move(LinkModules), "", nullptr, nullptr, TheModule.get()); diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 4aafac3..38aaceb 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -2449,12 +2449,7 @@ CoverageMappingModuleGen::CoverageMappingModuleGen( : CGM(CGM), SourceInfo(SourceInfo) {} std::string CoverageMappingModuleGen::getCurrentDirname() { - if (!CGM.getCodeGenOpts().CoverageCompilationDir.empty()) - return CGM.getCodeGenOpts().CoverageCompilationDir; - - SmallString<256> CWD; - llvm::sys::fs::current_path(CWD); - return CWD.str().str(); + return CGM.getCodeGenOpts().CoverageCompilationDir; } std::string CoverageMappingModuleGen::normalizeFilename(StringRef Filename) { diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp index 95971e5..074f2a5 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp @@ -146,7 +146,7 @@ public: : CI(CI), Diags(CI.getDiagnostics()), MainFileName(MainFileName), OutputFileName(OutputFileName), Ctx(nullptr), MMap(CI.getPreprocessor().getHeaderSearchInfo().getModuleMap()), - FS(&CI.getVirtualFileSystem()), + FS(CI.getVirtualFileSystemPtr()), HeaderSearchOpts(CI.getHeaderSearchOpts()), PreprocessorOpts(CI.getPreprocessorOpts()), TargetOpts(CI.getTargetOpts()), LangOpts(CI.getLangOpts()), |