Heads up, renaming attempt #2!

So, last time I tried, I needed a bit more tooling in place to do the renaming sanely. =] That’s taken care of, and so I’m hoping to do the renaming from ‘clang/lib/CodeGen/…’ to ‘clang/lib/IRGen/…’ over the holidays (hopefully minimal patches outstanding).

I’m also going to try to systematically clean up the naming of files and classes.

The current leading strategy for files:

lib/CodeGen/CGCall.cpp → lib/IRGen/Call.cpp
lib/CodeGen/CodeGenFunction.cpp → lib/IRGen/Function.cpp

The current leading strategy for classes:

clang::CGFoo → clang::irgen::Foo
clang::CodeGenBar → clang::irgen::Bar

I’m asking Doug and John to paint this bikeshed so that we don’t just go around in circles endlessly.

I really like having a prefix on file names so that they aren’t immediately confusable — visually, by IDEs, by C-x b, etc. — with files from other parts of the compiler. For example, I think it would be a real loss if there were three Decl.cpp files in clang: one in AST, one in Sema, and one in IRGen.

For lack of a better idea, let’s go with replacing everything that’s “CodeGen” with “IRGen” and “CG” with “IR”. “IR” has a pretty unambiguous meaning in the context of LLVM.

Everything in CodeGen is already in a namespace, “CodeGen”. This should be renamed to “irgen”.

Thanks for doing this!

John.

So, last time I tried, I needed a bit more tooling in place to do the
renaming sanely. =] That's taken care of, and so I'm hoping to do the
renaming from 'clang/lib/CodeGen/...' to 'clang/lib/IRGen/...' over the
holidays (hopefully minimal patches outstanding).

I'm also going to try to systematically clean up the naming of files and
classes.

The current leading strategy for files:

  lib/CodeGen/CGCall.cpp -> lib/IRGen/Call.cpp
  lib/CodeGen/CodeGenFunction.cpp -> lib/IRGen/Function.cpp

The current leading strategy for classes:

  clang::CGFoo -> clang::irgen::Foo
  clang::CodeGenBar -> clang::irgen::Bar

I'm asking Doug and John to paint this bikeshed so that we don't just go
around in circles endlessly.

I really like having a prefix on file names so that they aren't
immediately confusable — visually, by IDEs, by C-x b, etc. — with files
from other parts of the compiler. For example, I think it would be a real
loss if there were three Decl.cpp files in clang: one in AST, one in Sema,
and one in IRGen.

Sure.

For lack of a better idea, let's go with replacing everything that's
"CodeGen" with "IRGen" and "CG" with "IR". "IR" has a pretty unambiguous
meaning in the context of LLVM.

Can we pick just one prefix and have everything use that? Seems a great
opportunity to no longer wonder "is it CGFunction or CodeGenFunction?"

Should the prefix apply just to the files? 'clang::irgen::IRGenFunction'
seems needlessly redundant, but if that's your preferred shade of bikeshed,
I will make it so. ;]

You’re right. Using a single prefix is fine; it should be “IRGen”, which makes everything nice and consistent.

You keep trying to rename CodeGenFunction “Function”, and worse, you think you’re not out of your mind. CodeGenFunction/CodeGenModule/CGF/CGM should become IRGenFunction/IRGenModule/IGF/IGM. Otherwise, there’s no need to throw prefixes on things that aren’t already prefixed.

This is my preferred shade of bikeshed. :slight_smile:

John.

I find having the prefix in the identifier to be very useful for
grepability of the code.

I actually agree, but then why bother with the namespace? I could get rid
of that instead as the unnecessary disambiguation....

But anyways, I don't really care, I just don't understand. =] Carrying on
with the plan with John's bikeshed color.

llvm itself already has a Function.cpp so renaming CGFunction.cpp->Function.cpp would make that name ambiguous for things like setting line number breakpoints in gdb.