[PATCH] D137517: [TargetParser] Generate the defs for RISCV CPUs using llvm-tblgen.

Sergei Barannikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 21 13:02:26 PST 2022


barannikov88 added inline comments.


================
Comment at: llvm/utils/TableGen/RISCVTargetDefEmitter.cpp:16
+#include <iostream>
+namespace llvm {
+
----------------
fpetrogalli wrote:
> barannikov88 wrote:
> > This [[ https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions | should be ]] `using namespace llvm;`
> Hum, if I do this, I get:
> 
> ```
> Undefined symbols for architecture arm64:
>   "llvm::EmitRISCVTargetDef(llvm::RecordKeeper&, llvm::raw_ostream&)", referenced from:
>       (anonymous namespace)::LLVMTableGenMain(llvm::raw_ostream&, llvm::RecordKeeper&) in TableGen.cpp.o
> ld: symbol(s) not found for architecture arm64
> ```
> 
> It is a bit surprising because the linking command has `utils/TableGen/CMakeFiles/llvm-tblgen.dir/RISCVTargetDefEmitter.cpp.o` into it... Some of the files in this folder do not use the convention you pointed at, it it OK if I live it as it is?
Right, after `using namespace llvm` you have to write
`llvm::EmitRISCVTargetDef` with explicit `llvm::` qualification. This is the whole point of this guideline :)
Please see the [[ https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions | link ]].



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137517/new/

https://reviews.llvm.org/D137517



More information about the cfe-commits mailing list